Skip to content

Commit

Permalink
fixed put function before moving the uc
Browse files Browse the repository at this point in the history
  • Loading branch information
Nael-Alshowaikh committed Jul 1, 2024
1 parent 5b6a9e0 commit 42d4a6a
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions src/modules/organisation/api/organisation.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,19 @@ export class OrganisationController {
throw new NotFoundException(`Organisation with ID ${params.organisationId} not found`);
}

const updatedOrganisation: Organisation<true> = Organisation.construct(
params.organisationId,
existingOrganisation.createdAt,
new Date(),
body.administriertVon,
body.zugehoerigZu,
body.kennung,
body.name,
body.namensergaenzung,
body.kuerzel,
body.typ,
body.traegerschaft,
);
///!!! Note to self the find by id will be called twice here but no other way? unless created at is optional
existingOrganisation.id = params.organisationId;
existingOrganisation.administriertVon = body.administriertVon;
existingOrganisation.zugehoerigZu = body.zugehoerigZu;
existingOrganisation.kennung = body.kennung;
existingOrganisation.name = body.name;
existingOrganisation.namensergaenzung = body.namensergaenzung;
existingOrganisation.kuerzel = body.kuerzel;
existingOrganisation.typ = body.typ;
existingOrganisation.traegerschaft = body.traegerschaft;
existingOrganisation.updatedAt = new Date();

const response: Organisation<true> | SchulConnexError | OrganisationSpecificationError =
await this.uc.updateOrganisation(updatedOrganisation);
await this.uc.updateOrganisation(existingOrganisation);

if (response instanceof Organisation) {
return new OrganisationResponse(response);
Expand Down

0 comments on commit 42d4a6a

Please sign in to comment.