| | 1 | | using Syki.Back.Features.Academic.CreateStudent; |
| | 2 | | using Syki.Back.Features.Academic.CreateTeacher; |
| | 3 | |
|
| | 4 | | namespace Syki.Back.Features.Cross.SeedInstitutionData; |
| | 5 | |
|
| | 6 | | [CommandDescription("Realizar seed de usuários da instituição")] |
| | 7 | | public record SeedInstitutionUsersCommand(Guid InstitutionId, Guid DireitoCourseOfferingId, Guid AdsCourseOfferingId) : |
| | 8 | |
|
| 0 | 9 | | public class SeedInstitutionUsersCommandHandler( |
| 0 | 10 | | SykiDbContext ctx, |
| 0 | 11 | | CreateTeacherService createTeacherService, |
| 0 | 12 | | CreateStudentService createStudentService) : ICommandHandler<SeedInstitutionUsersCommand> |
| | 13 | | { |
| | 14 | | public async Task Handle(CommandId commandId, SeedInstitutionUsersCommand command) |
| | 15 | | { |
| 0 | 16 | | var id = command.InstitutionId; |
| | 17 | |
|
| 0 | 18 | | var teachers = new List<string>() |
| 0 | 19 | | { |
| 0 | 20 | | "Davi Pessoa Ferraz", |
| 0 | 21 | | "Luciete Bezerra Alves", |
| 0 | 22 | | "Manuela Abath Valença", |
| 0 | 23 | | "Paulo Marcelo Pedrosa de Almeida", |
| 0 | 24 | | }; |
| 0 | 25 | | foreach (var name in teachers) |
| | 26 | | { |
| 0 | 27 | | await createTeacherService.CreateWithThrowOnError(id, CreateTeacherIn.Seed(name)); |
| | 28 | | } |
| | 29 | |
|
| 0 | 30 | | var direitoStudents = new List<string>() |
| 0 | 31 | | { |
| 0 | 32 | | "Alisson Aranda de Aguiar", |
| 0 | 33 | | "Maria Júlia de Oliveira Melo", |
| 0 | 34 | | "Everton Ian de Galhardo Filho", |
| 0 | 35 | | "Alma Celeste Maldonado Mendonça", |
| 0 | 36 | | }; |
| 0 | 37 | | foreach (var name in direitoStudents) |
| | 38 | | { |
| 0 | 39 | | await createStudentService.CreateWithThrowOnError(id, CreateStudentIn.Seed(name, command.DireitoCourseOfferi |
| | 40 | | } |
| | 41 | |
|
| 0 | 42 | | var adsStudents = new List<string>() |
| 0 | 43 | | { |
| 0 | 44 | | "Simone Bezerra", |
| 0 | 45 | | "Marcelo Lima Filho", |
| 0 | 46 | | "Josilda Aragão Paz", |
| 0 | 47 | | "Marlene de Oliveira", |
| 0 | 48 | | "Miguel Gomes da Silva", |
| 0 | 49 | | "Zaqueu do Vale Cavalcante", |
| 0 | 50 | | }; |
| 0 | 51 | | foreach (var name in adsStudents) |
| | 52 | | { |
| 0 | 53 | | await createStudentService.CreateWithThrowOnError(id, CreateStudentIn.Seed(name, command.AdsCourseOfferingId |
| | 54 | | } |
| | 55 | |
|
| 0 | 56 | | ctx.AddCommand(id, new SeedInstitutionClassesCommand(id), parentId: commandId); |
| 0 | 57 | | } |
| | 58 | | } |