Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity: Task #299

Open
21 of 33 tasks
SzymCode opened this issue Feb 4, 2025 · 0 comments
Open
21 of 33 tasks

Entity: Task #299

SzymCode opened this issue Feb 4, 2025 · 0 comments

Comments

@SzymCode
Copy link
Member

SzymCode commented Feb 4, 2025


Fields:

  • id: number (given by default)
  • user_id: number
  • assignee_id: number
  • collaborator_ids: number[]
  • title: string
  • description: string
  • start_date: string
  • end_date: string

Keep fields order in all files and methods like migrations, models fields, instance methods etc.




Migration

  • create model with php artisan make:migration create_tasks_table
  • add all fields given above (id is added by default)
  • create public function user(): BelongsTo in Task.php model and public function task(): HasMany in User.php model - example on bottom of the file
  • run php artisan migrate:fresh and check if the migrations ran successful
  • create file TaskMigrationsTest.php in tests/Database/Migrations folder and write tests like other entities - example
  • run tests with ./vendor/bin/pest --group=migrations



Model

  • create model with php artisan make:model Task
  • create array protected $fillable with all fields, except id because Laravel handles it automatically
  • create instance methods getId etc. with full typings as other entities in the project - example
  • create scope methods scopeGetById etc.
  • add PHPDocs for this model
  • create file ``TaskTest.phpintests/Database/Models``` folder and write tests for instance and scope methods like other entities - example
  • run tests with ./vendor/bin/pest --group=models



Factory

  • create factory with php artisan make:factory TaskFactory
  • faker all fields except id, based on other entities - example
  • you can also add validator with reasonable rules
  • create file TaskFactoryTest.php in tests/Database/Factories folder and write tests for instance and scope methods like other entities - example
  • run tests with ./vendor/bin/pest --group=factories



Seeder

  • create seeder with php artisan make:seeder TaskSeeder and call factories - example
  • call TaskSeeder in DatabaseSeeder.php
  • run php artisan migrate:fresh --seed and check if TaskSeeder ran successful



Contract

  • create TaskContract.php in app/Contracts



Transformer

  • create TaskTransformer.php in app/Transformers



Controller

  • create TaskController.php in app/Http/Controllers/Entities
  • create file TaskControllerTest.php in tests/Feature/Controllers folder and write tests for all methods like other entities - example



Service

  • create TaskService.php in app/Services



Routes

  • create API routes for task entity like for others entities in routes/api.php



Tests

  • create API tests for HTTP 200, 302, 401, 405, 422, 500 - example



FRONTEND

  • new page Task.vue in atomic/pages/Entity folder - same as others entities
  • useTaskFields in new file atomic/bosons/constants/support/Fields/Entities/task.ts - same as others entities
  • taskRequests function in new folder atomic/bosons/utils/support/Api/Task in requests.ts file
  • types in atomic/bosons/types/support/Api/Task, atomic/bosons/types/support/Entities/Task, atomic/bosons/types/support/Fields/Entities/Task - same as others entities
  • tests for api methods in vitests/utils/support/Api/Task same as other entities


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants