Skip to content

Commit 5dc20fd

Browse files
committed
Rename user module per student to reflect business logic
1 parent bab691a commit 5dc20fd

74 files changed

Lines changed: 665 additions & 664 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

applications/mooc_backend/config/controllers/_controllers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ imports:
22

33
- { resource: course.yml }
44
- { resource: status.yml }
5-
- { resource: user.yml }
5+
- { resource: student.yml }
66
- { resource: video.yml }
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
services:
2+
3+
codely.mooc_backend.controller.student.put:
4+
class: CodelyTv\MoocBackend\Controller\Student\StudentPutController
5+
parent: codely.mooc_backend.controller
6+
public: true
7+
8+
codely.mooc_backend.controller.student.get:
9+
class: CodelyTv\MoocBackend\Controller\Student\StudentGetController
10+
parent: codely.mooc_backend.controller
11+
public: true

applications/mooc_backend/config/controllers/user.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
status:
22
resource: status.yml
33

4-
user:
5-
resource: user.yml
4+
student:
5+
resource: student.yml
66

77
video:
88
resource: video.yml
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
student_put:
2+
path: /students/{id}
3+
defaults: { _controller: codely.mooc_backend.controller.student.put }
4+
methods: [PUT]
5+
6+
student_get:
7+
path: /students/{id}
8+
defaults: { _controller: codely.mooc_backend.controller.student.get }
9+
methods: [GET]

applications/mooc_backend/config/routing/user.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace CodelyTv\MoocBackend\Controller\Student;
6+
7+
use CodelyTv\Mooc\Student\Application\Find\FindStudentQuery;
8+
use CodelyTv\Mooc\Student\Domain\StudentNotExist;
9+
use CodelyTv\Shared\Infrastructure\Api\Controller\ApiController;
10+
use Symfony\Component\HttpFoundation\Response;
11+
12+
final class StudentGetController extends ApiController
13+
{
14+
protected function exceptions(): array
15+
{
16+
return [
17+
StudentNotExist::class => Response::HTTP_NOT_FOUND,
18+
];
19+
}
20+
21+
public function __invoke(string $id)
22+
{
23+
return $this->ask(new FindStudentQuery($id));
24+
}
25+
}

applications/mooc_backend/src/Controller/User/UserPutController.php renamed to applications/mooc_backend/src/Controller/Student/StudentPutController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
declare(strict_types = 1);
44

5-
namespace CodelyTv\MoocBackend\Controller\User;
5+
namespace CodelyTv\MoocBackend\Controller\Student;
66

77
use CodelyTv\Shared\Infrastructure\Api\Controller\ApiController;
88
use CodelyTv\Shared\Infrastructure\Api\Response\ApiHttpCreatedResponse;
99

10-
final class UserPutController extends ApiController
10+
final class StudentPutController extends ApiController
1111
{
1212
protected function exceptions(): array
1313
{

applications/mooc_backend/src/Controller/User/UserGetController.php

Lines changed: 0 additions & 25 deletions
This file was deleted.

databases/mooc.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CREATE TABLE `video` (
77
PRIMARY KEY (`id`)
88
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
99

10-
CREATE TABLE `user` (
10+
CREATE TABLE `student` (
1111
`id` CHAR(36) NOT NULL,
1212
`name` VARCHAR(155) NOT NULL,
1313
`total_videos_created` INTEGER(5) NOT NULL,

0 commit comments

Comments
 (0)