Renamed the update>Entity Name>() functiuons to update()

ref #76
This commit is contained in:
Nicolai Ort 2021-01-10 16:35:52 +01:00
parent e6b9d4f273
commit 3f7b0f6563
19 changed files with 20 additions and 20 deletions

View File

@ -78,7 +78,7 @@ export class DonorController {
throw new DonorIdsNotMatchingError();
}
await this.donorRepository.save(await donor.updateDonor(oldDonor));
await this.donorRepository.save(await donor.update(oldDonor));
return new ResponseDonor(await this.donorRepository.findOne({ id: id }));
}

View File

@ -96,7 +96,7 @@ export class PermissionController {
return new ResponsePermission(existingPermission);
}
await this.permissionRepository.save(await permission.updatePermission(oldPermission));
await this.permissionRepository.save(await permission.update(oldPermission));
return new ResponsePermission(await this.permissionRepository.findOne({ id: permission.id }, { relations: ['principal'] }));
}

View File

@ -83,7 +83,7 @@ export class RunnerController {
throw new RunnerIdsNotMatchingError();
}
await this.runnerRepository.save(await runner.updateRunner(oldRunner));
await this.runnerRepository.save(await runner.update(oldRunner));
return new ResponseRunner(await this.runnerRepository.findOne({ id: id }, { relations: ['scans', 'group', 'scans.track', 'cards'] }));
}

View File

@ -82,7 +82,7 @@ export class RunnerOrganisationController {
throw new RunnerOrganisationIdsNotMatchingError();
}
await this.runnerOrganisationRepository.save(await updateOrganisation.updateRunnerOrganisation(oldRunnerOrganisation));
await this.runnerOrganisationRepository.save(await updateOrganisation.update(oldRunnerOrganisation));
return new ResponseRunnerOrganisation(await this.runnerOrganisationRepository.findOne(id, { relations: ['address', 'contact', 'teams'] }));
}

View File

@ -82,7 +82,7 @@ export class RunnerTeamController {
throw new RunnerTeamIdsNotMatchingError();
}
await this.runnerTeamRepository.save(await runnerTeam.updateRunnerTeam(oldRunnerTeam));
await this.runnerTeamRepository.save(await runnerTeam.update(oldRunnerTeam));
return new ResponseRunnerTeam(await this.runnerTeamRepository.findOne({ id: runnerTeam.id }, { relations: ['parentGroup', 'contact'] }));
}

View File

@ -96,7 +96,7 @@ export class ScanController {
throw new ScanIdsNotMatchingError();
}
await this.scanRepository.save(await scan.updateScan(oldScan));
await this.scanRepository.save(await scan.update(oldScan));
return (await this.scanRepository.findOne({ id: id }, { relations: ['runner', 'track', 'runner.scans', 'runner.scans.track', 'card', 'station'] })).toResponse();
}
@ -119,7 +119,7 @@ export class ScanController {
throw new ScanIdsNotMatchingError();
}
await this.trackScanRepository.save(await scan.updateScan(oldScan));
await this.trackScanRepository.save(await scan.update(oldScan));
return (await this.scanRepository.findOne({ id: id }, { relations: ['runner', 'track', 'runner.scans', 'runner.scans.track', 'card', 'station'] })).toResponse();
}

View File

@ -77,7 +77,7 @@ export class ScanStationController {
throw new ScanStationIdsNotMatchingError();
}
await this.stationRepository.save(await station.updateStation(oldStation));
await this.stationRepository.save(await station.update(oldStation));
return (await this.stationRepository.findOne({ id: id }, { relations: ['track'] })).toResponse();
}

View File

@ -75,7 +75,7 @@ export class TrackController {
if (oldTrack.id != updateTrack.id) {
throw new TrackIdsNotMatchingError();
}
await this.trackRepository.save(await updateTrack.updateTrack(oldTrack));
await this.trackRepository.save(await updateTrack.update(oldTrack));
return new ResponseTrack(await this.trackRepository.findOne({ id: id }));
}

View File

@ -81,7 +81,7 @@ export class UserController {
if (oldUser.id != updateUser.id) {
throw new UserIdsNotMatchingError();
}
await this.userRepository.save(await updateUser.updateUser(oldUser));
await this.userRepository.save(await updateUser.update(oldUser));
return new ResponseUser(await this.userRepository.findOne({ id: id }, { relations: ['permissions', 'groups'] }));
}

View File

@ -26,7 +26,7 @@ export class UpdateDonor extends CreateParticipant {
/**
* Updates a provided Donor entity based on this.
*/
public async updateDonor(donor: Donor): Promise<Donor> {
public async update(donor: Donor): Promise<Donor> {
donor.firstname = this.firstname;
donor.middlename = this.middlename;
donor.lastname = this.lastname;

View File

@ -42,7 +42,7 @@ export class UpdatePermission {
/**
* Updates a provided Permission entity based on this.
*/
public async updatePermission(permission: Permission): Promise<Permission> {
public async update(permission: Permission): Promise<Permission> {
permission.principal = await this.getPrincipal();
permission.target = this.target;
permission.action = this.action;

View File

@ -29,7 +29,7 @@ export class UpdateRunner extends CreateParticipant {
/**
* Updates a provided Runner entity based on this.
*/
public async updateRunner(runner: Runner): Promise<Runner> {
public async update(runner: Runner): Promise<Runner> {
runner.firstname = this.firstname;
runner.middlename = this.middlename;
runner.lastname = this.lastname;

View File

@ -41,7 +41,7 @@ export class UpdateRunnerOrganisation extends CreateRunnerGroup {
/**
* Updates a provided RunnerOrganisation entity based on this.
*/
public async updateRunnerOrganisation(organisation: RunnerOrganisation): Promise<RunnerOrganisation> {
public async update(organisation: RunnerOrganisation): Promise<RunnerOrganisation> {
organisation.name = this.name;
organisation.contact = await this.getContact();

View File

@ -45,7 +45,7 @@ export class UpdateRunnerTeam extends CreateRunnerGroup {
/**
* Updates a provided RunnerTeam entity based on this.
*/
public async updateRunnerTeam(team: RunnerTeam): Promise<RunnerTeam> {
public async update(team: RunnerTeam): Promise<RunnerTeam> {
team.name = this.name;
team.parentGroup = await this.getParent();

View File

@ -41,7 +41,7 @@ export abstract class UpdateScan {
* Update a Scan entity based on this.
* @param scan The scan that shall be updated.
*/
public async updateScan(scan: Scan): Promise<Scan> {
public async update(scan: Scan): Promise<Scan> {
scan.distance = this.distance;
scan.valid = this.valid;
scan.runner = await this.getRunner();

View File

@ -30,7 +30,7 @@ export class UpdateScanStation {
* Update a ScanStation entity based on this.
* @param station The station that shall be updated.
*/
public async updateStation(station: ScanStation): Promise<ScanStation> {
public async update(station: ScanStation): Promise<ScanStation> {
station.description = this.description;
station.enabled = this.enabled;

View File

@ -37,7 +37,7 @@ export class UpdateTrack {
* Update a Track entity based on this.
* @param track The track that shall be updated.
*/
public updateTrack(track: Track): Track {
public update(track: Track): Track {
track.name = this.name;
track.distance = this.distance;
track.minimumLapTime = this.minimumLapTime;

View File

@ -44,7 +44,7 @@ export abstract class UpdateTrackScan {
* Update a TrackScan entity based on this.
* @param scan The scan that shall be updated.
*/
public async updateScan(scan: TrackScan): Promise<TrackScan> {
public async update(scan: TrackScan): Promise<TrackScan> {
scan.valid = this.valid;
if (this.runner) {
scan.runner = await this.getRunner();

View File

@ -98,7 +98,7 @@ export class UpdateUser {
* Updates a user entity based on this.
* @param user The user that shall be updated.
*/
public async updateUser(user: User): Promise<User> {
public async update(user: User): Promise<User> {
user.email = this.email;
user.username = this.username;
if ((user.email === undefined || user.email === null) && (user.username === undefined || user.username === null)) {