Class TeacherServiceImpl
java.lang.Object
it.astromark.user.teacher.service.TeacherServiceImpl
- All Implemented Interfaces:
CrudService<Teacher,
,TeacherRequest, SchoolUserDetailed, UUID> TeacherService
-
Constructor Summary
ConstructorsConstructorDescriptionTeacherServiceImpl
(TeacherClassRepository teacherClassRepository, SchoolUserMapper schoolUserMapper, AuthenticationService authenticationService, TeacherRepository teacherRepository, SendGridMailService sendGridMailService, ClassManagementMapper classManagementMapper, TeachingRepository teachingRepository, SchoolRepository schoolRepository) -
Method Summary
Modifier and TypeMethodDescriptioncreate
(TeacherRequest teacherRequest) Creates a new resource.boolean
Deletes a resource by its ID.Retrieves a resource by its ID.Retrieves a list of school classes associated with the logged-in teacher.Retrieves a list of all teachers in the system.getTeacherTeaching
(@NotEmpty String teacheruuid) Retrieves detailed teaching information for a specific teacher.Retrieves a list of teaching subjects associated with the logged-in teacher.update
(UUID uuid, TeacherRequest teacherRequest) Updates an existing resource by its ID.
-
Constructor Details
-
TeacherServiceImpl
public TeacherServiceImpl(TeacherClassRepository teacherClassRepository, SchoolUserMapper schoolUserMapper, AuthenticationService authenticationService, TeacherRepository teacherRepository, SendGridMailService sendGridMailService, ClassManagementMapper classManagementMapper, TeachingRepository teachingRepository, SchoolRepository schoolRepository)
-
-
Method Details
-
create
@PreAuthorize("hasRole(\'SECRETARY\')") public SchoolUserDetailed create(TeacherRequest teacherRequest) Description copied from interface:CrudService
Creates a new resource.- Specified by:
create
in interfaceCrudService<Teacher,
TeacherRequest, SchoolUserDetailed, UUID> - Parameters:
teacherRequest
- the resource object to be created- Returns:
- an `RS` object representing the created resource Pre-condition: The `r` must not be null and must contain valid data for creation. Post-condition: A new resource is created and returned as an `RS` object.
-
getSchoolClasses
@PreAuthorize("hasRole(\'TEACHER\')") @Transactional public List<SchoolClassResponse> getSchoolClasses()Description copied from interface:TeacherService
Retrieves a list of school classes associated with the logged-in teacher.- Specified by:
getSchoolClasses
in interfaceTeacherService
- Returns:
- a list of `SchoolClassResponse` objects representing the school classes Pre-condition: The logged-in teacher must exist and be associated with school classes. Post-condition: Returns a list of school classes associated with the teacher.
-
getTeaching
Description copied from interface:TeacherService
Retrieves a list of teaching subjects associated with the logged-in teacher.- Specified by:
getTeaching
in interfaceTeacherService
- Returns:
- a list of strings representing the subjects taught by the teacher Pre-condition: The logged-in teacher must exist. Post-condition: Returns a list of subjects associated with the teacher.
-
getTeachers
Description copied from interface:TeacherService
Retrieves a list of all teachers in the system.- Specified by:
getTeachers
in interfaceTeacherService
- Returns:
- a list of `TeacherResponse` objects representing all teachers Pre-condition: None. Post-condition: Returns a list of all teachers in the system.
-
getTeacherTeaching
@Transactional public TeacherDetailsResponse getTeacherTeaching(@NotEmpty @NotEmpty String teacheruuid) Description copied from interface:TeacherService
Retrieves detailed teaching information for a specific teacher.- Specified by:
getTeacherTeaching
in interfaceTeacherService
- Parameters:
teacheruuid
- the UUID of the teacher as a string- Returns:
- a `TeacherDetailsResponse` object containing detailed information about the teacher's teachings Pre-condition: The `teacheruuid` must not be null and must correspond to an existing teacher. Post-condition: Returns detailed teaching information for the specified teacher.
-
update
Description copied from interface:CrudService
Updates an existing resource by its ID.- Specified by:
update
in interfaceCrudService<Teacher,
TeacherRequest, SchoolUserDetailed, UUID> - Parameters:
uuid
- the ID of the resource to be updatedteacherRequest
- the updated resource data- Returns:
- an `RS` object representing the updated resource Pre-condition: The `id` must not be null and must refer to an existing resource. The `r` must not be null and must contain valid data for updating. Post-condition: The resource is updated and returned as an `RS` object.
-
delete
Description copied from interface:CrudService
Deletes a resource by its ID.- Specified by:
delete
in interfaceCrudService<Teacher,
TeacherRequest, SchoolUserDetailed, UUID> - Parameters:
uuid
- the ID of the resource to be deleted- Returns:
- true if the resource was successfully deleted, false otherwise Pre-condition: The `id` must not be null and must refer to an existing resource. Post-condition: The resource is deleted if it exists, and the method returns true.
-
getById
Description copied from interface:CrudService
Retrieves a resource by its ID.- Specified by:
getById
in interfaceCrudService<Teacher,
TeacherRequest, SchoolUserDetailed, UUID> - Parameters:
uuid
- the ID of the resource- Returns:
- a `T` object representing the resource, or null if not found Pre-condition: The `id` must not be null and must refer to an existing resource. Post-condition: Returns the resource as a `T` object if it exists, otherwise null.
-