This commit is contained in:
zmagod 2017-11-03 10:11:23 +01:00
parent 5bc38414d1
commit 55d05b013b
4 changed files with 5 additions and 4 deletions

View file

@ -914,7 +914,7 @@ ActiveRecord::Schema.define(version: 20171026090804) do
CASE
WHEN (teams.created_by_id = user_teams.user_id) THEN false
ELSE true
END AS can_be_leaved,
END AS can_be_left,
user_teams.id AS user_team_id,
user_teams.user_id
FROM (teams

View file

@ -7,7 +7,7 @@ SELECT
FROM user_teams
WHERE user_teams.team_id = teams.id
) AS members,
CASE WHEN teams.created_by_id = user_teams.user_id THEN false ELSE true END AS can_be_leaved,
CASE WHEN teams.created_by_id = user_teams.user_id THEN false ELSE true END AS can_be_left,
user_teams.id AS user_team_id,
user_teams.user_id AS user_id
FROM teams INNER JOIN user_teams ON teams.id=user_teams.team_id

View file

@ -8,6 +8,7 @@ RSpec.describe Datatables::DatatablesTeam, type: :model do
it { should have_db_column :role }
it { should have_db_column :user_team_id }
it { should have_db_column :user_id }
it { should have_db_column :can_be_left }
end
describe 'is readonly' do

View file

@ -5,13 +5,13 @@
"teams": {
"type": "array",
"items":{
"required": ["id", "name", "members", "role", "can_be_leaved", "user_team_id"],
"required": ["id", "name", "members", "role", "can_be_left", "user_team_id"],
"properties": {
"id": { "type": "integer" },
"name": { "type": "string" },
"members": { "type": "integer" },
"role": { "type": "integer" },
"can_be_leaved": { "type": "boolean" },
"can_be_left": { "type": "boolean" },
"user_team_id": { "type": "integer" },
"user_id": { "type": "integer" }
}