Implemented the interface in all responses

refr #132
This commit is contained in:
Nicolai Ort 2021-01-29 17:06:43 +01:00
parent e44cc4c4cb
commit 9d5e486c6d
29 changed files with 260 additions and 32 deletions

View File

@ -1,9 +1,18 @@
import { IsInt, IsString } from 'class-validator'; import { IsInt, IsString } from 'class-validator';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
/** /**
* Defines the repsonse auth. * Defines the repsonse auth.
*/ */
export class ResponseAuth { export class ResponseAuth implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.AUTH;
/** /**
* The access_token - JWT shortterm access token. * The access_token - JWT shortterm access token.
*/ */

View File

@ -1,12 +1,19 @@
import { IsInt, IsObject, IsPositive } from 'class-validator'; import { IsInt, IsObject, IsPositive } from 'class-validator';
import { DistanceDonation } from '../entities/DistanceDonation'; import { DistanceDonation } from '../entities/DistanceDonation';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseDonation } from './ResponseDonation'; import { ResponseDonation } from './ResponseDonation';
import { ResponseRunner } from './ResponseRunner'; import { ResponseRunner } from './ResponseRunner';
/** /**
* Defines the distance donation response. * Defines the distance donation response.
*/ */
export class ResponseDistanceDonation extends ResponseDonation { export class ResponseDistanceDonation extends ResponseDonation implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.DISTANCEDONATION;
/** /**
* The donation's associated runner. * The donation's associated runner.

View File

@ -1,11 +1,20 @@
import { IsInt, IsNotEmpty, IsPositive } from "class-validator"; import { IsInt, IsNotEmpty, IsPositive } from "class-validator";
import { Donation } from '../entities/Donation'; import { Donation } from '../entities/Donation';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseDonor } from './ResponseDonor'; import { ResponseDonor } from './ResponseDonor';
/** /**
* Defines the donation response. * Defines the donation response.
*/ */
export class ResponseDonation { export class ResponseDonation implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.DONATION;
/** /**
* The donation's id. * The donation's id.
*/ */

View File

@ -2,12 +2,19 @@ import {
IsBoolean, IsInt IsBoolean, IsInt
} from "class-validator"; } from "class-validator";
import { Donor } from '../entities/Donor'; import { Donor } from '../entities/Donor';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseParticipant } from './ResponseParticipant'; import { ResponseParticipant } from './ResponseParticipant';
/** /**
* Defines the donor response. * Defines the donor response.
*/ */
export class ResponseDonor extends ResponseParticipant { export class ResponseDonor extends ResponseParticipant implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.DONOR;
/** /**
* Does this donor need a receipt? * Does this donor need a receipt?

View File

@ -1,9 +1,17 @@
import { IsString } from 'class-validator'; import { IsString } from 'class-validator';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
/** /**
* Defines a empty response object. * Defines a empty response object.
*/ */
export class ResponseEmpty { export class ResponseEmpty implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.EMPTY;
@IsString() @IsString()
response: string = "nothing here" response: string = "nothing here"
} }

View File

@ -1,12 +1,20 @@
import { IsInt, IsObject, IsString } from "class-validator"; import { IsInt, IsObject, IsString } from "class-validator";
import { Address } from '../entities/Address'; import { Address } from '../entities/Address';
import { GroupContact } from '../entities/GroupContact'; import { GroupContact } from '../entities/GroupContact';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseRunnerGroup } from './ResponseRunnerGroup'; import { ResponseRunnerGroup } from './ResponseRunnerGroup';
/** /**
* Defines the group contact response. * Defines the group contact response.
*/ */
export class ResponseGroupContact { export class ResponseGroupContact implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.GROUPCONTACT;
/** /**
* The contact's id. * The contact's id.
*/ */

View File

@ -1,9 +1,17 @@
import { IsString } from 'class-validator'; import { IsString } from 'class-validator';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
/** /**
* Defines the logout response. * Defines the logout response.
*/ */
export class Logout { export class Logout implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.LOGOUT;
/** /**
* The logout's timestamp. * The logout's timestamp.
*/ */

View File

@ -1,11 +1,19 @@
import { IsInt, IsObject, IsOptional, IsString } from "class-validator"; import { IsInt, IsObject, IsOptional, IsString } from "class-validator";
import { Address } from '../entities/Address'; import { Address } from '../entities/Address';
import { Participant } from '../entities/Participant'; import { Participant } from '../entities/Participant';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
/** /**
* Defines the participant response. * Defines the participant response.
*/ */
export abstract class ResponseParticipant { export abstract class ResponseParticipant implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.PARTICIPANT;
/** /**
* The participant's id. * The participant's id.
*/ */

View File

@ -7,12 +7,20 @@ import {
import { Permission } from '../entities/Permission'; import { Permission } from '../entities/Permission';
import { PermissionAction } from '../enums/PermissionAction'; import { PermissionAction } from '../enums/PermissionAction';
import { PermissionTarget } from '../enums/PermissionTargets'; import { PermissionTarget } from '../enums/PermissionTargets';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponsePrincipal } from './ResponsePrincipal'; import { ResponsePrincipal } from './ResponsePrincipal';
/** /**
* Defines the permission response. * Defines the permission response.
*/ */
export class ResponsePermission { export class ResponsePermission implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.PERMISSION;
/** /**
* The permission's id. * The permission's id.
*/ */

View File

@ -2,11 +2,19 @@ import {
IsInt IsInt
} from "class-validator"; } from "class-validator";
import { Principal } from '../entities/Principal'; import { Principal } from '../entities/Principal';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
/** /**
* Defines the principal response. * Defines the principal response.
*/ */
export abstract class ResponsePrincipal { export abstract class ResponsePrincipal implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.PRINCIPAL;
/** /**
* The principal's id. * The principal's id.

View File

@ -4,12 +4,19 @@ import {
} from "class-validator"; } from "class-validator";
import { Runner } from '../entities/Runner'; import { Runner } from '../entities/Runner';
import { RunnerGroup } from '../entities/RunnerGroup'; import { RunnerGroup } from '../entities/RunnerGroup';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseParticipant } from './ResponseParticipant'; import { ResponseParticipant } from './ResponseParticipant';
/** /**
* Defines the runner response. * Defines the runner response.
*/ */
export class ResponseRunner extends ResponseParticipant { export class ResponseRunner extends ResponseParticipant implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.RUNNER;
/** /**
* The runner's currently ran distance in meters. * The runner's currently ran distance in meters.

View File

@ -1,11 +1,19 @@
import { IsBoolean, IsEAN, IsInt, IsNotEmpty, IsObject, IsString } from "class-validator"; import { IsBoolean, IsEAN, IsInt, IsNotEmpty, IsObject, IsString } from "class-validator";
import { RunnerCard } from '../entities/RunnerCard'; import { RunnerCard } from '../entities/RunnerCard';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseRunner } from './ResponseRunner'; import { ResponseRunner } from './ResponseRunner';
/** /**
* Defines the runner card response. * Defines the runner card response.
*/ */
export class ResponseRunnerCard { export class ResponseRunnerCard implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.RUNNERCARD;
/** /**
* The card's id. * The card's id.
*/ */

View File

@ -1,11 +1,19 @@
import { IsInt, IsNotEmpty, IsObject, IsOptional, IsString } from "class-validator"; import { IsInt, IsNotEmpty, IsObject, IsOptional, IsString } from "class-validator";
import { GroupContact } from '../entities/GroupContact'; import { GroupContact } from '../entities/GroupContact';
import { RunnerGroup } from '../entities/RunnerGroup'; import { RunnerGroup } from '../entities/RunnerGroup';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
/** /**
* Defines the runnerGroup response. * Defines the runnerGroup response.
*/ */
export abstract class ResponseRunnerGroup { export abstract class ResponseRunnerGroup implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.RUNNERGROUP;
/** /**
* The runnerGroup's id. * The runnerGroup's id.
*/ */

View File

@ -12,12 +12,19 @@ import {
import { Address } from '../entities/Address'; import { Address } from '../entities/Address';
import { RunnerOrganization } from '../entities/RunnerOrganization'; import { RunnerOrganization } from '../entities/RunnerOrganization';
import { RunnerTeam } from '../entities/RunnerTeam'; import { RunnerTeam } from '../entities/RunnerTeam';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseRunnerGroup } from './ResponseRunnerGroup'; import { ResponseRunnerGroup } from './ResponseRunnerGroup';
/** /**
* Defines the runnerOrganization response. * Defines the runnerOrganization response.
*/ */
export class ResponseRunnerOrganization extends ResponseRunnerGroup { export class ResponseRunnerOrganization extends ResponseRunnerGroup implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.RUNNERORGANIZATION;
/** /**
* The runnerOrganization's address. * The runnerOrganization's address.

View File

@ -1,12 +1,19 @@
import { IsNotEmpty, IsObject } from "class-validator"; import { IsNotEmpty, IsObject } from "class-validator";
import { RunnerTeam } from '../entities/RunnerTeam'; import { RunnerTeam } from '../entities/RunnerTeam';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseRunnerGroup } from './ResponseRunnerGroup'; import { ResponseRunnerGroup } from './ResponseRunnerGroup';
import { ResponseRunnerOrganization } from './ResponseRunnerOrganization'; import { ResponseRunnerOrganization } from './ResponseRunnerOrganization';
/** /**
* Defines the runnerTeam response. * Defines the runnerTeam response.
*/ */
export class ResponseRunnerTeam extends ResponseRunnerGroup { export class ResponseRunnerTeam extends ResponseRunnerGroup implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.RUNNERTEAM;
/** /**
* The runnerTeam's parent group (organization). * The runnerTeam's parent group (organization).

View File

@ -1,11 +1,19 @@
import { IsBoolean, IsInt, IsNotEmpty, IsPositive } from "class-validator"; import { IsBoolean, IsInt, IsNotEmpty, IsPositive } from "class-validator";
import { Scan } from '../entities/Scan'; import { Scan } from '../entities/Scan';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseRunner } from './ResponseRunner'; import { ResponseRunner } from './ResponseRunner';
/** /**
* Defines the scan response. * Defines the scan response.
*/ */
export class ResponseScan { export class ResponseScan implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.SCAN;
/** /**
* The scans's id. * The scans's id.
*/ */

View File

@ -11,12 +11,20 @@ import {
IsString IsString
} from "class-validator"; } from "class-validator";
import { ScanStation } from '../entities/ScanStation'; import { ScanStation } from '../entities/ScanStation';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseTrack } from './ResponseTrack'; import { ResponseTrack } from './ResponseTrack';
/** /**
* Defines the statsClient response. * Defines the statsClient response.
*/ */
export class ResponseScanStation { export class ResponseScanStation implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.SCANSTATION;
/** /**
* The client's id. * The client's id.
*/ */
@ -64,7 +72,7 @@ export class ResponseScanStation {
this.description = station.description; this.description = station.description;
this.prefix = station.prefix; this.prefix = station.prefix;
this.key = "Only visible on creation."; this.key = "Only visible on creation.";
this.track = station.track; this.track = station.track.toResponse();
this.enabled = station.enabled; this.enabled = station.enabled;
} }
} }

View File

@ -1,11 +1,19 @@
import { IsInt, IsNotEmpty, IsPositive } from 'class-validator'; import { IsInt, IsNotEmpty, IsPositive } from 'class-validator';
import { DistanceDonation } from '../entities/DistanceDonation'; import { DistanceDonation } from '../entities/DistanceDonation';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
/** /**
* Defines the runner selfservice donation response. * Defines the runner selfservice donation response.
* Why? B/C runner's are not allowed to view all information available to admin users. * Why? B/C runner's are not allowed to view all information available to admin users.
*/ */
export class ResponseSelfServiceDonation { export class ResponseSelfServiceDonation implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.SELFSERVICEDONATION;
/** /**
* The donation's donor. * The donation's donor.
*/ */

View File

@ -3,6 +3,8 @@ import { DistanceDonation } from '../entities/DistanceDonation';
import { Runner } from '../entities/Runner'; import { Runner } from '../entities/Runner';
import { RunnerGroup } from '../entities/RunnerGroup'; import { RunnerGroup } from '../entities/RunnerGroup';
import { RunnerTeam } from '../entities/RunnerTeam'; import { RunnerTeam } from '../entities/RunnerTeam';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseParticipant } from './ResponseParticipant'; import { ResponseParticipant } from './ResponseParticipant';
import { ResponseSelfServiceDonation } from './ResponseSelfServiceDonation'; import { ResponseSelfServiceDonation } from './ResponseSelfServiceDonation';
@ -10,7 +12,12 @@ import { ResponseSelfServiceDonation } from './ResponseSelfServiceDonation';
* Defines the runner selfservice response. * Defines the runner selfservice response.
* Why? B/C runner's are not allowed to view all information available to admin users. * Why? B/C runner's are not allowed to view all information available to admin users.
*/ */
export class ResponseSelfServiceRunner extends ResponseParticipant { export class ResponseSelfServiceRunner extends ResponseParticipant implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.SELFSERVICERUNNER;
/** /**
* The runner's currently ran distance in meters. * The runner's currently ran distance in meters.

View File

@ -7,12 +7,20 @@ import { RunnerOrganization } from '../entities/RunnerOrganization';
import { RunnerTeam } from '../entities/RunnerTeam'; import { RunnerTeam } from '../entities/RunnerTeam';
import { Scan } from '../entities/Scan'; import { Scan } from '../entities/Scan';
import { User } from '../entities/User'; import { User } from '../entities/User';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
/** /**
* Defines the stats response. * Defines the stats response.
* The stats response calculates some basic stats for a dashboard or public display. * The stats response calculates some basic stats for a dashboard or public display.
*/ */
export class ResponseStats { export class ResponseStats implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.STATS;
/** /**
* The amount of runners registered in the system. * The amount of runners registered in the system.
*/ */

View File

@ -8,11 +8,19 @@ import {
IsString IsString
} from "class-validator"; } from "class-validator";
import { StatsClient } from '../entities/StatsClient'; import { StatsClient } from '../entities/StatsClient';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
/** /**
* Defines the statsClient response. * Defines the statsClient response.
*/ */
export class ResponseStatsClient { export class ResponseStatsClient implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.STATSCLIENT;
/** /**
* The client's id. * The client's id.
*/ */

View File

@ -4,12 +4,20 @@ import {
IsString IsString
} from "class-validator"; } from "class-validator";
import { RunnerOrganization } from '../entities/RunnerOrganization'; import { RunnerOrganization } from '../entities/RunnerOrganization';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
/** /**
* Defines the org stats response. * Defines the org stats response.
* This differs from the normal org responce. * This differs from the normal org responce.
*/ */
export class ResponseStatsOrgnisation { export class ResponseStatsOrgnisation implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.STATSORGANIZATION;
/** /**
* The orgs's id. * The orgs's id.
*/ */

View File

@ -5,12 +5,20 @@ import {
} from "class-validator"; } from "class-validator";
import { Runner } from '../entities/Runner'; import { Runner } from '../entities/Runner';
import { RunnerGroup } from '../entities/RunnerGroup'; import { RunnerGroup } from '../entities/RunnerGroup';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
/** /**
* Defines the runner stats response. * Defines the runner stats response.
* This differs from the normal runner responce. * This differs from the normal runner responce.
*/ */
export class ResponseStatsRunner { export class ResponseStatsRunner implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.STATSRUNNER;
/** /**
* The runner's id. * The runner's id.
*/ */

View File

@ -5,12 +5,20 @@ import {
} from "class-validator"; } from "class-validator";
import { RunnerGroup } from '../entities/RunnerGroup'; import { RunnerGroup } from '../entities/RunnerGroup';
import { RunnerTeam } from '../entities/RunnerTeam'; import { RunnerTeam } from '../entities/RunnerTeam';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
/** /**
* Defines the team stats response. * Defines the team stats response.
* This differs from the normal team responce. * This differs from the normal team responce.
*/ */
export class ResponseStatsTeam { export class ResponseStatsTeam implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.STATSTEAM;
/** /**
* The team's id. * The team's id.
*/ */

View File

@ -1,11 +1,19 @@
import { IsInt, IsOptional, IsString } from "class-validator"; import { IsInt, IsOptional, IsString } from "class-validator";
import { TrackLapTimeCantBeNegativeError } from '../../errors/TrackErrors'; import { TrackLapTimeCantBeNegativeError } from '../../errors/TrackErrors';
import { Track } from '../entities/Track'; import { Track } from '../entities/Track';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
/** /**
* Defines the track response. * Defines the track response.
*/ */
export class ResponseTrack { export class ResponseTrack implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.TRACK;
/** /**
* The track's id. * The track's id.
*/ */

View File

@ -1,5 +1,7 @@
import { IsDateString, IsNotEmpty } from "class-validator"; import { IsDateString, IsNotEmpty } from "class-validator";
import { TrackScan } from '../entities/TrackScan'; import { TrackScan } from '../entities/TrackScan';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseRunnerCard } from './ResponseRunnerCard'; import { ResponseRunnerCard } from './ResponseRunnerCard';
import { ResponseScan } from './ResponseScan'; import { ResponseScan } from './ResponseScan';
import { ResponseScanStation } from './ResponseScanStation'; import { ResponseScanStation } from './ResponseScanStation';
@ -8,7 +10,13 @@ import { ResponseTrack } from './ResponseTrack';
/** /**
* Defines the trackScan response. * Defines the trackScan response.
*/ */
export class ResponseTrackScan extends ResponseScan { export class ResponseTrackScan extends ResponseScan implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.TRACKSCAN;
/** /**
* The scan's associated track. * The scan's associated track.
*/ */

View File

@ -7,12 +7,20 @@ import {
} from "class-validator"; } from "class-validator";
import { User } from '../entities/User'; import { User } from '../entities/User';
import { UserGroup } from '../entities/UserGroup'; import { UserGroup } from '../entities/UserGroup';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponsePrincipal } from './ResponsePrincipal'; import { ResponsePrincipal } from './ResponsePrincipal';
/** /**
* Defines the user response. * Defines the user response.
*/ */
export class ResponseUser extends ResponsePrincipal { export class ResponseUser extends ResponsePrincipal implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.USER;
/** /**
* The user's first name. * The user's first name.
*/ */

View File

@ -1,12 +1,20 @@
import { IsArray, IsNotEmpty, IsOptional, IsString } from "class-validator"; import { IsArray, IsNotEmpty, IsOptional, IsString } from "class-validator";
import { Permission } from '../entities/Permission'; import { Permission } from '../entities/Permission';
import { UserGroup } from '../entities/UserGroup'; import { UserGroup } from '../entities/UserGroup';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponsePrincipal } from './ResponsePrincipal'; import { ResponsePrincipal } from './ResponsePrincipal';
/** /**
* Defines the userGroup response. * Defines the userGroup response.
*/ */
export class ResponseUserGroup extends ResponsePrincipal { export class ResponseUserGroup extends ResponsePrincipal implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.USERGROUP;
/** /**
* The userGroup's name. * The userGroup's name.
*/ */

View File

@ -5,12 +5,20 @@ import {
IsOptional IsOptional
} from "class-validator"; } from "class-validator";
import { User } from '../entities/User'; import { User } from '../entities/User';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponsePermission } from './ResponsePermission'; import { ResponsePermission } from './ResponsePermission';
/** /**
* Defines the user permission response (get /api/users/:id/permissions). * Defines the user permission response (get /api/users/:id/permissions).
*/ */
export class ResponseUserPermissions { export class ResponseUserPermissions implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.USERPERMISSIONS;
/** /**
* The permissions directly granted to the user. * The permissions directly granted to the user.
*/ */