GET mastertasks, GET mastertasks/{id} endpointy

This commit is contained in:
StudioTem committed 2023-01-24 23:19:12 +01:00
1 parent dfac41f30a
commit ba6b9e20a5
16 files changed
+210 -12

No files matched your search

+2 -2
View File
@@ -11,8 +11,8 @@ class Attachment extends Model
public $timestamps = true;
public function subtask()
public function mastertask()
{
return $this->belongsTo(SubTask::class);
return $this->belongsTo(MasterTask::class, 'master_task_id');
}
}
+10
View File
@@ -30,4 +30,14 @@ class MasterTask extends Model
{
return $this->belongsTo(Team::class);
}
// vracia userov, ktori su priradeni k subtasku ale nepatria do teamu
public function getUsersOutsideTeamAttribute()
{
$users = $this->subtasks->pluck('user')->unique();
return $users->filter(function ($user) {
return !in_array($this->team->id, $user->teams->pluck('id')->unique()->toArray());
});
}
}
+1 -1
View File
@@ -18,6 +18,6 @@ class Project extends Model
public function mastertasks()
{
return $this->hasMany(MasterTask::class);
return $this->hasMany(MasterTask::class, 'master_task_id');
}
}
+2 -2
View File
@@ -13,12 +13,12 @@ class SubTask extends Model
public function mastertask()
{
return $this->belongsTo(MasterTask::class);
return $this->belongsTo(MasterTask::class, 'master_task_id');
}
public function user()
{
return $this->belongsTo(MasterTask::class);
return $this->belongsTo(User::class);
}
public function timeblocks()
+1 -1
View File
@@ -13,6 +13,6 @@ class Timeblock extends Model
public function subtask()
{
return $this->belongsTo(SubTask::class);
return $this->belongsTo(SubTask::class, 'sub_task_id');
}
}
+1 -1
View File
@@ -13,7 +13,7 @@ class Timesheet extends Model
public function subtask()
{
return $this->belongsTo(SubTask::class);
return $this->belongsTo(SubTask::class, 'sub_task_id');
}
public function user()