mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
Merge branch 'main' of https://bitbucket.org/studiotem/jandl-taskmanager-app
This commit is contained in:
commit
26792a85a6
44 files changed
+1039
-43
No files matched your search
@@ -63,14 +63,14 @@ const options: Options = {
|
||||
'POST v1/tasks/(id)': true,
|
||||
'DELETE v1/tasks/(id)': true,
|
||||
|
||||
'GET v1/teams/(id)': true,
|
||||
'GET v1/teams/(id)': false,
|
||||
'POST v1/teams/(id)': true,
|
||||
'DELETE v1/teams/(id)': true,
|
||||
// 'GET v1/teams': true,
|
||||
'GET v1/teamsx': true,
|
||||
'POST v1/teams': true,
|
||||
|
||||
'GET v1/employees': true,
|
||||
'GET v1/employees': false,
|
||||
'GET v1/search': true,
|
||||
'POST v1/tasks': true,
|
||||
|
||||
|
||||
@@ -32,27 +32,30 @@ export default {
|
||||
filteredEvents: []
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
try {
|
||||
const events = await this.$axios.get_auth_data('v1/overview/projects')
|
||||
this.events = events.map((item) => ({
|
||||
id: item.id,
|
||||
title: `${item.project_code} - ${item.name}`,
|
||||
title_html: `${item.project_code} - <b>${item.name}</b>`,
|
||||
start: item.starts_at,
|
||||
end: item.deadline,
|
||||
is_finished: item.is_finished,
|
||||
project_code: item.project_code,
|
||||
backgroundColor: item.color,
|
||||
borderColor: item.color
|
||||
}))
|
||||
this.filteredEvents = this.events.filter((item) => !item.is_finished)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
created() {
|
||||
this._getData()
|
||||
},
|
||||
methods: {
|
||||
// Kravarik: TODO prepojit filtrovanie na BE
|
||||
async _getData() {
|
||||
try {
|
||||
const events = await this.$axios.get_auth_data('v1/overview/projects')
|
||||
this.events = events.map((item) => ({
|
||||
id: item.id,
|
||||
title: `${item.project_code} - ${item.name}`,
|
||||
title_html: `${item.project_code} - <b>${item.name}</b>`,
|
||||
start: item.starts_at,
|
||||
end: item.deadline,
|
||||
is_finished: item.is_finished,
|
||||
project_code: item.project_code,
|
||||
backgroundColor: item.color,
|
||||
borderColor: item.color
|
||||
}))
|
||||
this.filteredEvents = this.events.filter((item) => !item.is_finished)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
onFilterChanged(filterValues) {
|
||||
this.filter = filterValues
|
||||
this.filteredEvents = this.events.filter((item) => this.filter.showFinishedTasks || item.is_finished == false)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
v-model="selectedEmployee"
|
||||
class="subheader-input"
|
||||
:items="employees"
|
||||
item-title="name"
|
||||
item-title="fullName"
|
||||
item-value="id"
|
||||
label="Zamestnanec"
|
||||
variant="outlined"
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
<script>
|
||||
import { addDays, subDays } from 'date-fns'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@@ -47,13 +48,14 @@ export default {
|
||||
employees: [],
|
||||
selectedDate: "",
|
||||
|
||||
// Kaluza: Napojit funkcnost
|
||||
selectedEmployee: '',
|
||||
date: new Date()
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapGetters('auth', ['user']),
|
||||
|
||||
time() {
|
||||
return this.unscheduledTime
|
||||
}
|
||||
@@ -74,6 +76,10 @@ export default {
|
||||
|
||||
async _getEmployees() {
|
||||
this.employees = await this.$axios.get_auth_data('v1/employees')
|
||||
this.employees.forEach(employee => {
|
||||
employee.fullName = `${employee.name} ${employee.surname}`
|
||||
if (employee.id == this.user.id) this.selectedEmployee = employee
|
||||
})
|
||||
},
|
||||
|
||||
_getWeek(emitDataChanged = true) {
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
<script>
|
||||
import { addDays, subDays } from 'date-fns'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@@ -47,8 +46,7 @@ export default {
|
||||
return {
|
||||
teams: [],
|
||||
|
||||
// Kaluza: Napojit funkcionalitu
|
||||
selectedTeam: '',
|
||||
selectedTeam: null,
|
||||
|
||||
selectedDate: new Date(),
|
||||
day: new Date(),
|
||||
@@ -57,8 +55,6 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapGetters('auth', ['user']),
|
||||
|
||||
time() {
|
||||
return this.unscheduledTime
|
||||
},
|
||||
@@ -79,7 +75,7 @@ export default {
|
||||
|
||||
async _getTeams() {
|
||||
this.teams = await this.$axios.get_auth_data('v1/teamsx')
|
||||
// this.selectedTeam()
|
||||
this.selectedTeam = this.teams[0]
|
||||
},
|
||||
|
||||
_getDay(emitDataChanged = true) {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ClientResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
||||
*/
|
||||
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'code' => $this->code,
|
||||
'client' => ClientResource::collection($this->users),
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class ProjectCollection extends ResourceCollection
|
||||
{
|
||||
/**
|
||||
* Transform the resource collection into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
||||
*/
|
||||
|
||||
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'data' => $this->collection,
|
||||
'status' => 200,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ProjectResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
||||
*/
|
||||
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'code' => $this->code,
|
||||
'client' => $this->client,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ class UserCollection extends ResourceCollection
|
||||
{
|
||||
return [
|
||||
'data' => $this->collection,
|
||||
'status' => 200
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ class UserResource extends JsonResource
|
||||
'id' => $this->id,
|
||||
'name' => $this->firstname,
|
||||
'surname' => $this->lastname,
|
||||
'email' => $this->email,
|
||||
'code' => $this->code,
|
||||
'work_start' => $this->work_start,
|
||||
'work_end' => $this->work_end,
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Attachment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
public function subtask()
|
||||
{
|
||||
return $this->belongsTo(SubTask::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Client extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
public function projects()
|
||||
{
|
||||
return $this->hasMany(Project::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MasterTask extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
public function subtasks()
|
||||
{
|
||||
return $this->hasMany(SubTask::class);
|
||||
}
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo(Project::class);
|
||||
}
|
||||
|
||||
public function attachments()
|
||||
{
|
||||
return $this->hasMany(Attachment::class);
|
||||
}
|
||||
|
||||
public function team()
|
||||
{
|
||||
return $this->belongsTo(Team::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Project extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
public function client()
|
||||
{
|
||||
return $this->belongsTo(Client::class);
|
||||
}
|
||||
|
||||
public function mastertasks()
|
||||
{
|
||||
return $this->hasMany(MasterTask::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SubTask extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
public function mastertask()
|
||||
{
|
||||
return $this->belongsTo(MasterTask::class);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(MasterTask::class);
|
||||
}
|
||||
|
||||
public function timeblocks()
|
||||
{
|
||||
return $this->hasMany(Timeblock::class);
|
||||
}
|
||||
|
||||
public function timesheets()
|
||||
{
|
||||
return $this->hasMany(Timesheet::class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,8 @@ class Team extends Model
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = true;
|
||||
protected $guarded = ['id', 'name'];
|
||||
|
||||
protected $table = 'teams';
|
||||
protected $guarded = ['id', 'name'];
|
||||
|
||||
public function users()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Timeblock extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
public function subtask()
|
||||
{
|
||||
return $this->belongsTo(SubTask::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Timesheet extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
public function subtask()
|
||||
{
|
||||
return $this->belongsTo(SubTask::class);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
@@ -37,4 +37,14 @@ class User extends Authenticatable
|
||||
return $this->belongsToMany(Team::class);
|
||||
}
|
||||
|
||||
public function timesheets()
|
||||
{
|
||||
return $this->hasMany(Timesheet::class);
|
||||
}
|
||||
|
||||
public function subtasks()
|
||||
{
|
||||
return $this->hasMany(SubTask::class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Attachment>
|
||||
*/
|
||||
class AttachmentFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$extension = fake()->randomElement(['jpg', 'png', 'jpeg', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'csv']);
|
||||
|
||||
return [
|
||||
'original_name' => fake()->words(2, true) . '.' . $extension,
|
||||
'disk_name' => Str::random(15) . '.' . $extension,
|
||||
'path' => fake()->imageUrl(),
|
||||
'extension' => $extension,
|
||||
'content_type' => fake()->mimeType(),
|
||||
'file_size' => fake()->numberBetween(1323,992385),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Client>
|
||||
*/
|
||||
class ClientFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$company = fake()->company();
|
||||
|
||||
return [
|
||||
'name' => $company,
|
||||
'code' => strtoupper(substr($company, 0, 5)),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Client;
|
||||
use App\Models\Project;
|
||||
use App\Models\Team;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\MasterTask>
|
||||
*/
|
||||
class MasterTaskFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
// if (Project::all()->count() === 0) {
|
||||
// $project = Project::factory()->create();
|
||||
// } else {
|
||||
// $project = Project::all()->random();
|
||||
// }
|
||||
|
||||
$project = Project::all()->random();
|
||||
|
||||
$team = Team::all()->random();
|
||||
|
||||
return [
|
||||
'project_id' => $project->id,
|
||||
'team_id' => $team->id,
|
||||
'title' => 'Master task ' . fake()->words(2, true),
|
||||
'estimated_time' => fake()->numberBetween(20,100),
|
||||
'tracked_time' => fake()->numberBetween(4,20),
|
||||
'deadline' => fake()->date(),
|
||||
'is_finished' => 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Client;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Project>
|
||||
*/
|
||||
class ProjectFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
|
||||
public function definition()
|
||||
{
|
||||
$name = fake()->country();
|
||||
|
||||
$client = Client::all()->random();
|
||||
|
||||
return [
|
||||
'client_id' => $client->id,
|
||||
'name' => 'Project ' . $name,
|
||||
'code' => strtoupper(substr($name, 0, 3)) . '-2023-' . rand(1, 50),
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Client;
|
||||
use App\Models\MasterTask;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\SubTask>
|
||||
*/
|
||||
class SubTaskFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$client = \App\Models\Client::all()->random();
|
||||
|
||||
return [
|
||||
'user_id' => $client->id,
|
||||
'estimated_time' => fake()->numberBetween(1,16),
|
||||
'tracked_time' => fake()->numberBetween(4,20),
|
||||
'is_finished' => 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ class TeamFactory extends Factory
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => fake()->company(),
|
||||
'name' => 'Team ' . fake()->colorName(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Timeblock>
|
||||
*/
|
||||
class TimeblockFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$start = fake()->dateTimeBetween('now', '+3 weeks');
|
||||
$end = Carbon::instance($start)->addHours(fake()->numberBetween(3, 5));
|
||||
|
||||
// get random subtask
|
||||
$subtask = \App\Models\SubTask::all()->random();
|
||||
|
||||
return [
|
||||
'sub_task_id' => $subtask->id,
|
||||
'start' => $start,
|
||||
'end' => fake()->dateTimeBetween($start, $end),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\SubTask;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Timesheet>
|
||||
*/
|
||||
class TimesheetFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$subtask = SubTask::all()->random();
|
||||
|
||||
return [
|
||||
'user_id' => $subtask->user->id,
|
||||
'sub_task_id' => $subtask->id,
|
||||
'time' => fake()->numberBetween(1,8),
|
||||
'synced_to_karat' => null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -17,15 +17,18 @@ class UserFactory extends Factory
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$firstname = fake()->firstname();
|
||||
$lastname = fake()->lastname();
|
||||
|
||||
return [
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email' => strtolower($firstname . '.' . $lastname . '@jandl.sk'),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'remember_token' => Str::random(10),
|
||||
'firstname' => fake()->firstname(),
|
||||
'lastname' => fake()->lastname(),
|
||||
'code' => strtoupper(Str::random(3)),
|
||||
'work_start' => '9.0',
|
||||
'work_end' => '17.0',
|
||||
'firstname' => $firstname,
|
||||
'lastname' => $lastname,
|
||||
'code' => strtoupper(substr($firstname, 0, 1) . substr($lastname, 0, 2)),
|
||||
'work_start' => rand(7, 10) . '.0',
|
||||
'work_end' => rand(15, 18) . '.0',
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('clients', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('code');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('clients');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('projects', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(\App\Models\Client::class);
|
||||
$table->string('name');
|
||||
$table->string('code');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('projects');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('clients', function (Blueprint $table) {
|
||||
$table->unique('code');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('projects', function (Blueprint $table) {
|
||||
$table->unique('code');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Project;
|
||||
use App\Models\Team;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('master_tasks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor( Project::class);
|
||||
$table->foreignIdFor( Team::class)->nullable();
|
||||
$table->string('title');
|
||||
$table->float('estimated_time')->comment('tento field sa updatuje automaticky na zaklade subtaskov');
|
||||
$table->float('tracked_time')->default(0)->comment('tento field sa updatuje automaticky na zaklade vykazov subtaskov');
|
||||
$table->timestamp('deadline');
|
||||
$table->boolean('is_finished')->default(false);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('master_task');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use App\Models\MasterTask;
|
||||
use App\Models\Project;
|
||||
use App\Models\Team;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('sub_tasks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor( MasterTask::class);
|
||||
$table->foreignIdFor( User::class);
|
||||
$table->float('estimated_time');
|
||||
$table->float('tracked_time')->default(0)->comment('tento field sa updatuje automaticky na zaklade vykazov');
|
||||
$table->boolean('is_finished')->default(false);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('sub_tasks');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use App\Models\MasterTask;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('attachments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor( MasterTask::class);
|
||||
$table->string('original_name');
|
||||
$table->string('disk_name');
|
||||
$table->string('path');
|
||||
$table->string('extension');
|
||||
$table->string('content_type');
|
||||
$table->bigInteger('file_size');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('attachments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use App\Models\SubTask;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('timesheets', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor( SubTask::class);
|
||||
$table->foreignIdFor( User::class);
|
||||
$table->float('time', 4);
|
||||
$table->timestamp( 'synced_to_karat')->nullable()->default(null);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('timesheets');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use App\Models\SubTask;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('timeblocks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor( SubTask::class);
|
||||
$table->timestamp( 'start');
|
||||
$table->timestamp( 'end');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('timeblocks');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Client;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ClientSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Client::factory()
|
||||
->count(10)
|
||||
->hasProjects(3)
|
||||
->create();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,13 @@
|
||||
namespace Database\Seeders;
|
||||
|
||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use App\Models\Client;
|
||||
use App\Models\MasterTask;
|
||||
use App\Models\Project;
|
||||
use App\Models\Team;
|
||||
use App\Models\Timeblock;
|
||||
use App\Models\Timesheet;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
@@ -14,11 +21,38 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// \App\Models\User::factory(10)->create();
|
||||
Client::factory()
|
||||
->count(20)
|
||||
->create();
|
||||
|
||||
// \App\Models\User::factory()->create([
|
||||
// 'name' => 'Test User',
|
||||
// 'email' => 'test@example.com',
|
||||
// ]);
|
||||
Project::factory()
|
||||
->hasClient()
|
||||
->count(20)
|
||||
->create();
|
||||
|
||||
for ($i=0; $i < 5; $i++) {
|
||||
Team::factory()
|
||||
->hasUsers(random_int(2, 5))
|
||||
->create();
|
||||
}
|
||||
|
||||
for ($i=0; $i < 30; $i++) {
|
||||
MasterTask::factory()
|
||||
->hasAttachments(random_int(0, 3))
|
||||
->hasSubTasks(random_int(3, 5))
|
||||
->create();
|
||||
}
|
||||
|
||||
for ($i=0; $i < 30; $i++) {
|
||||
Timeblock::factory()
|
||||
->count(random_int(1, 2))
|
||||
->create();
|
||||
}
|
||||
|
||||
for ($i=0; $i < 30; $i++) {
|
||||
Timesheet::factory()
|
||||
->count(random_int(1, 2))
|
||||
->create();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\MasterTask;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class MasterTaskSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
MasterTask::factory()
|
||||
->hasAttachments(2)
|
||||
->hasSubTasks(2)
|
||||
->create();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\MasterTask;
|
||||
use App\Models\Project;
|
||||
use App\Models\Team;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ProjectSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
for ($i=0; $i < 20; $i++) {
|
||||
Project::factory()
|
||||
->hasMastertasks(2)
|
||||
->create();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\SubTask;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SubTaskSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
SubTask::factory()
|
||||
->count(10)
|
||||
->hasTimeblocks(2)
|
||||
->hasTimesheets(2)
|
||||
->create();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Timeblock;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class TimeblockSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Timeblock::factory()
|
||||
->count(1)
|
||||
->create();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,13 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Resources\ProjectCollection;
|
||||
use App\Http\Resources\TeamCollection;
|
||||
use App\Http\Resources\TeamResource;
|
||||
use App\Http\Resources\UserCollection;
|
||||
use App\Http\Resources\UserResource;
|
||||
use App\Models\Project;
|
||||
use App\Models\Team;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
@@ -22,3 +28,22 @@ use Illuminate\Support\Facades\Route;
|
||||
Route::get('/v1/teams', function () {
|
||||
return new TeamCollection(Team::all());
|
||||
});
|
||||
|
||||
Route::get('/v1/teams/{id}', function ($id) {
|
||||
return new TeamResource(Team::find($id));
|
||||
});
|
||||
|
||||
Route::get('/v1/employees', function () {
|
||||
return new UserCollection(User::all());
|
||||
});
|
||||
|
||||
|
||||
Route::get('/v1/employees/{id}', function ($id) {
|
||||
return new UserResource(User::find($id));
|
||||
});
|
||||
|
||||
Route::get('/public/v1/projects', function () {
|
||||
return new ProjectCollection(Project::all());
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Resources\TeamCollection;
|
||||
use App\Models\Team;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
@@ -16,3 +18,12 @@ use Illuminate\Support\Facades\Route;
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
|
||||
Route::prefix('be')->group(function () {
|
||||
Route::get('/test', function () {
|
||||
dd('here');
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user