fix(dev): We did it funky bun dev workarounds are no more

This commit is contained in:
2026-02-20 21:45:15 +01:00
parent d1c4744231
commit 3bb8b202b0
29 changed files with 797 additions and 125 deletions

View File

@@ -7,8 +7,28 @@ import authchecker from "./middlewares/authchecker";
import { ErrorHandler } from './middlewares/ErrorHandler';
import UserChecker from './middlewares/UserChecker';
// Always use .js when running from dist/ (Bun workflow: always build first)
const CONTROLLERS_FILE_EXTENSION = 'js';
// Import all controllers directly to avoid Bun + routing-controllers glob/require issues
import { AuthController } from './controllers/AuthController';
import { DonationController } from './controllers/DonationController';
import { DonorController } from './controllers/DonorController';
import { GroupContactController } from './controllers/GroupContactController';
import { ImportController } from './controllers/ImportController';
import { MeController } from './controllers/MeController';
import { PermissionController } from './controllers/PermissionController';
import { RunnerCardController } from './controllers/RunnerCardController';
import { RunnerController } from './controllers/RunnerController';
import { RunnerOrganizationController } from './controllers/RunnerOrganizationController';
import { RunnerSelfServiceController } from './controllers/RunnerSelfServiceController';
import { RunnerTeamController } from './controllers/RunnerTeamController';
import { ScanController } from './controllers/ScanController';
import { ScanStationController } from './controllers/ScanStationController';
import { StatsClientController } from './controllers/StatsClientController';
import { StatsController } from './controllers/StatsController';
import { StatusController } from './controllers/StatusController';
import { TrackController } from './controllers/TrackController';
import { UserController } from './controllers/UserController';
import { UserGroupController } from './controllers/UserGroupController';
const app = createExpressServer({
authorizationChecker: authchecker,
currentUserChecker: UserChecker,
@@ -16,7 +36,28 @@ const app = createExpressServer({
development: config.development,
cors: true,
routePrefix: "/api",
controllers: [`${__dirname}/controllers/*.${CONTROLLERS_FILE_EXTENSION}`],
controllers: [
AuthController,
DonationController,
DonorController,
GroupContactController,
ImportController,
MeController,
PermissionController,
RunnerCardController,
RunnerController,
RunnerOrganizationController,
RunnerSelfServiceController,
RunnerTeamController,
ScanController,
ScanStationController,
StatsClientController,
StatsController,
StatusController,
TrackController,
UserController,
UserGroupController,
],
});
async function main() {

View File

@@ -1,4 +1,4 @@
import { Request } from "express";
import type { Request } from "express";
import * as jwt from "jsonwebtoken";
import { BadRequestError, Body, Delete, Get, JsonController, OnUndefined, Param, Post, QueryParam, Req, UseBefore } from 'routing-controllers';
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';

View File

@@ -1,4 +1,4 @@
import { Request } from "express";
import type { Request } from "express";
import { Authorized, Body, Delete, Get, HttpError, JsonController, OnUndefined, Param, Post, Put, QueryParam, Req, UseBefore } from 'routing-controllers';
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
import { Repository, getConnection, getConnectionManager } from 'typeorm';

View File

@@ -1,5 +1,6 @@
import { createConnection } from "typeorm";
import { runSeeder } from 'typeorm-seeding';
import consola from 'consola';
import { config } from '../config';
import { ConfigFlag } from '../models/entities/ConfigFlags';
import SeedPublicOrg from '../seeds/SeedPublicOrg';
@@ -11,6 +12,11 @@ import SeedUsers from '../seeds/SeedUsers';
*/
export default async () => {
const connection = await createConnection();
// Log discovered entities for debugging
consola.info(`TypeORM discovered ${connection.entityMetadatas.length} entities:`);
consola.info(connection.entityMetadatas.map(m => m.name).sort().join(', '));
await connection.synchronize();
//The data seeding part

View File

@@ -2,7 +2,7 @@ import { IsInt, IsNotEmpty, IsPositive } from "class-validator";
import { ChildEntity, Column, Index, ManyToOne } from "typeorm";
import { ResponseDistanceDonation } from '../responses/ResponseDistanceDonation';
import { Donation } from "./Donation";
import { Runner } from "./Runner";
import type { Runner } from "./Runner";
/**
* Defines the DistanceDonation entity.
@@ -16,8 +16,8 @@ export class DistanceDonation extends Donation {
* Used as the source of the donation's distance.
*/
@IsNotEmpty()
@ManyToOne(() => Runner, runner => runner.distanceDonations)
runner: Runner;
@ManyToOne(() => require("./Runner").Runner, (runner: Runner) => runner.distanceDonations)
runner!: Runner;
/**
* The donation's amount donated per distance.

View File

@@ -4,7 +4,7 @@ import {
} from "class-validator";
import { BeforeInsert, BeforeUpdate, Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, TableInheritance } from "typeorm";
import { ResponseDonation } from '../responses/ResponseDonation';
import { Donor } from './Donor';
import type { Donor } from './Donor';
/**
* Defines the Donation entity.
@@ -25,8 +25,8 @@ export abstract class Donation {
/**
* The donations's donor.
*/
@ManyToOne(() => Donor, donor => donor.donations)
donor: Donor;
@ManyToOne(() => require("./Donor").Donor, (donor: Donor) => donor.donations)
donor!: Donor;
/**
* The donation's amount in cents (or whatever your currency's smallest unit is.).

View File

@@ -1,7 +1,7 @@
import { IsBoolean, IsInt } from "class-validator";
import { ChildEntity, Column, OneToMany } from "typeorm";
import { ResponseDonor } from '../responses/ResponseDonor';
import { Donation } from './Donation';
import type { Donation } from './Donation';
import { Participant } from "./Participant";
/**
@@ -21,8 +21,8 @@ export class Donor extends Participant {
* Used to link the participant as the donor of a donation.
* Attention: Only runner's can be associated as a distanceDonations distance source.
*/
@OneToMany(() => Donation, donation => donation.donor, { nullable: true })
donations: Donation[];
@OneToMany(() => require("./Donation").Donation, (donation: Donation) => donation.donor, { nullable: true })
donations!: Donation[];
/**
* Returns the total donations of a donor based on his linked donations.

View File

@@ -1,19 +1,19 @@
import {
IsEmail,
IsInt,
IsNotEmpty,
IsOptional,
IsPhoneNumber,
IsPositive,
IsString
} from "class-validator";
import { BeforeInsert, BeforeUpdate, Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { config } from '../../config';
import { ResponseGroupContact } from '../responses/ResponseGroupContact';
import { Address } from "./Address";
import { RunnerGroup } from "./RunnerGroup";
import {
IsEmail,
IsInt,
IsNotEmpty,
IsOptional,
IsPhoneNumber,
IsPositive,
IsString
} from "class-validator";
import { BeforeInsert, BeforeUpdate, Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { config } from '../../config';
import { ResponseGroupContact } from '../responses/ResponseGroupContact';
import { Address } from "./Address";
import type { RunnerGroup } from "./RunnerGroup";
/**
* Defines the GroupContact entity.
@@ -77,11 +77,11 @@ export class GroupContact {
@IsEmail()
email?: string;
/**
* Used to link contacts to groups.
*/
@OneToMany(() => RunnerGroup, group => group.contact, { nullable: true })
groups: RunnerGroup[];
/**
* Used to link contacts to groups.
*/
@OneToMany(() => require("./RunnerGroup").RunnerGroup, (group: RunnerGroup) => group.contact, { nullable: true })
groups!: RunnerGroup[];
@Column({ type: 'bigint', nullable: true, readonly: true })
@IsInt()

View File

@@ -8,7 +8,7 @@ import { BeforeInsert, BeforeUpdate, Column, Entity, ManyToOne, PrimaryGenerated
import { PermissionAction } from '../enums/PermissionAction';
import { PermissionTarget } from '../enums/PermissionTargets';
import { ResponsePermission } from '../responses/ResponsePermission';
import { Principal } from './Principal';
import type { Principal } from './Principal';
/**
* Defines the Permission entity.
* Permissions can be granted to principals.
@@ -26,8 +26,8 @@ export class Permission {
/**
* The permission's principal.
*/
@ManyToOne(() => Principal, principal => principal.permissions)
principal: Principal;
@ManyToOne(() => require("./Principal").Principal, (principal: Principal) => principal.permissions)
principal!: Principal;
/**
* The permission's target.

View File

@@ -1,7 +1,7 @@
import { IsInt, IsPositive } from 'class-validator';
import { BeforeInsert, BeforeUpdate, Column, Entity, OneToMany, PrimaryGeneratedColumn, TableInheritance } from 'typeorm';
import { ResponsePrincipal } from '../responses/ResponsePrincipal';
import { Permission } from './Permission';
import type { Permission } from './Permission';
/**
* Defines the principal entity.
@@ -20,8 +20,8 @@ export abstract class Principal {
/**
* The participant's permissions.
*/
@OneToMany(() => Permission, permission => permission.principal, { nullable: true })
permissions: Permission[];
@OneToMany(() => require("./Permission").Permission, (permission: Permission) => permission.principal, { nullable: true })
permissions!: Permission[];
@Column({ type: 'bigint', nullable: true, readonly: true })
@IsInt()

View File

@@ -1,11 +1,11 @@
import { IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator";
import { ChildEntity, Column, Index, ManyToOne, OneToMany } from "typeorm";
import { ResponseRunner } from '../responses/ResponseRunner';
import { DistanceDonation } from "./DistanceDonation";
import type { DistanceDonation } from "./DistanceDonation";
import { Participant } from "./Participant";
import { RunnerCard } from "./RunnerCard";
import type { RunnerCard } from "./RunnerCard";
import { RunnerGroup } from "./RunnerGroup";
import { Scan } from "./Scan";
import type { Scan } from "./Scan";
/**
* Defines the runner entity.
@@ -27,22 +27,22 @@ export class Runner extends Participant {
* The runner's associated distanceDonations.
* Used to link runners to distanceDonations in order to calculate the donation's amount based on the distance the runner ran.
*/
@OneToMany(() => DistanceDonation, distanceDonation => distanceDonation.runner, { nullable: true })
distanceDonations: DistanceDonation[];
@OneToMany(() => require("./DistanceDonation").DistanceDonation, (distanceDonation: DistanceDonation) => distanceDonation.runner, { nullable: true })
distanceDonations!: DistanceDonation[];
/**
* The runner's associated cards.
* Used to link runners to cards - yes a runner be associated with multiple cards this came in handy in the past.
*/
@OneToMany(() => RunnerCard, card => card.runner, { nullable: true })
cards: RunnerCard[];
@OneToMany(() => require("./RunnerCard").RunnerCard, (card: RunnerCard) => card.runner, { nullable: true })
cards!: RunnerCard[];
/**
* The runner's associated scans.
* Used to link runners to scans (valid and fraudulant).
*/
@OneToMany(() => Scan, scan => scan.runner, { nullable: true })
scans: Scan[];
@OneToMany(() => require("./Scan").Scan, (scan: Scan) => scan.runner, { nullable: true })
scans!: Scan[];
/**
* The last time the runner requested a selfservice link.

View File

@@ -9,8 +9,8 @@ import {
import { BeforeInsert, BeforeUpdate, Column, Entity, Index, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { RunnerCardIdOutOfRangeError } from '../../errors/RunnerCardErrors';
import { ResponseRunnerCard } from '../responses/ResponseRunnerCard';
import { Runner } from "./Runner";
import { TrackScan } from "./TrackScan";
import type { Runner } from "./Runner";
import type { TrackScan } from "./TrackScan";
/**
* Defines the RunnerCard entity.
@@ -33,8 +33,8 @@ export class RunnerCard {
* To increase reusability a card can be reassigned.
*/
@IsOptional()
@ManyToOne(() => Runner, runner => runner.cards, { nullable: true })
runner: Runner;
@ManyToOne(() => require("./Runner").Runner, (runner: Runner) => runner.cards, { nullable: true })
runner!: Runner;
/**
* Is the card enabled (for fraud reasons)?
@@ -48,8 +48,8 @@ export class RunnerCard {
* The card's associated scans.
* Used to link cards to track scans.
*/
@OneToMany(() => TrackScan, scan => scan.track, { nullable: true })
scans: TrackScan[];
@OneToMany(() => require("./TrackScan").TrackScan, (scan: TrackScan) => scan.card, { nullable: true })
scans!: TrackScan[];
@Column({ type: 'bigint', nullable: true, readonly: true })
@IsInt()

View File

@@ -8,7 +8,7 @@ import {
import { BeforeInsert, BeforeUpdate, Column, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn, TableInheritance } from "typeorm";
import { ResponseRunnerGroup } from '../responses/ResponseRunnerGroup';
import { GroupContact } from "./GroupContact";
import { Runner } from "./Runner";
import type { Runner } from "./Runner";
/**
* Defines the RunnerGroup entity.
@@ -44,8 +44,8 @@ export abstract class RunnerGroup {
* The group's associated runners.
* Used to link runners to a runner group.
*/
@OneToMany(() => Runner, runner => runner.group, { nullable: true })
runners: Runner[];
@OneToMany(() => require("./Runner").Runner, (runner: Runner) => runner.group, { nullable: true })
runners!: Runner[];
@Column({ type: 'bigint', nullable: true, readonly: true })
@IsInt()

View File

@@ -4,7 +4,7 @@ import { ResponseRunnerOrganization } from '../responses/ResponseRunnerOrganizat
import { Address } from './Address';
import { Runner } from './Runner';
import { RunnerGroup } from "./RunnerGroup";
import { RunnerTeam } from "./RunnerTeam";
import type { RunnerTeam } from "./RunnerTeam";
/**
* Defines the RunnerOrganization entity.
@@ -24,8 +24,8 @@ export class RunnerOrganization extends RunnerGroup {
* The organization's teams.
* Used to link teams to a organization.
*/
@OneToMany(() => RunnerTeam, team => team.parentGroup, { nullable: true })
teams: RunnerTeam[];
@OneToMany(() => require("./RunnerTeam").RunnerTeam, (team: RunnerTeam) => team.parentGroup, { nullable: true })
teams!: RunnerTeam[];
/**
* The organization's api key for self-service registration.

View File

@@ -2,7 +2,7 @@ import { IsNotEmpty } from "class-validator";
import { ChildEntity, Index, ManyToOne } from "typeorm";
import { ResponseRunnerTeam } from '../responses/ResponseRunnerTeam';
import { RunnerGroup } from "./RunnerGroup";
import { RunnerOrganization } from "./RunnerOrganization";
import type { RunnerOrganization } from "./RunnerOrganization";
/**
* Defines the RunnerTeam entity.
@@ -17,7 +17,7 @@ export class RunnerTeam extends RunnerGroup {
* Every team has to be part of a runnerOrganization - this get's checked on creation and update.
*/
@IsNotEmpty()
@ManyToOne(() => RunnerOrganization, org => org.teams, { nullable: true })
@ManyToOne(() => require("./RunnerOrganization").RunnerOrganization, (org: RunnerOrganization) => org.teams, { nullable: true })
parentGroup?: RunnerOrganization;
/**

View File

@@ -7,7 +7,7 @@ import {
} from "class-validator";
import { BeforeInsert, BeforeUpdate, Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, TableInheritance } from "typeorm";
import { ResponseScan } from '../responses/ResponseScan';
import { Runner } from "./Runner";
import type { Runner } from "./Runner";
/**
* Defines the Scan entity.
@@ -31,8 +31,8 @@ export class Scan {
* This is important to link ran distances to runners.
*/
@IsNotEmpty()
@ManyToOne(() => Runner, runner => runner.scans, { nullable: false })
runner: Runner;
@ManyToOne(() => require("./Runner").Runner, (runner: Runner) => runner.scans, { nullable: false })
runner!: Runner;
/**
* Is the scan valid (for fraud reasons).

View File

@@ -8,8 +8,8 @@ import {
} from "class-validator";
import { BeforeInsert, BeforeUpdate, Column, Entity, Index, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { ResponseScanStation } from '../responses/ResponseScanStation';
import { Track } from "./Track";
import { TrackScan } from "./TrackScan";
import type { Track } from "./Track";
import type { TrackScan } from "./TrackScan";
/**
* Defines the ScanStation entity.
@@ -41,8 +41,8 @@ export class ScanStation {
* All scans created by this station will also be associated with this track.
*/
@IsNotEmpty()
@ManyToOne(() => Track, track => track.stations, { nullable: false })
track: Track;
@ManyToOne(() => require("./Track").Track, (track: Track) => track.stations, { nullable: false })
track!: Track;
/**
* The client's api key prefix.
@@ -72,8 +72,8 @@ export class ScanStation {
/**
* Used to link track scans to a scan station.
*/
@OneToMany(() => TrackScan, scan => scan.track, { nullable: true })
scans: TrackScan[];
@OneToMany(() => require("./TrackScan").TrackScan, (scan: TrackScan) => scan.station, { nullable: true })
scans!: TrackScan[];
/**
* Is this station enabled?

View File

@@ -7,8 +7,8 @@ import {
} from "class-validator";
import { BeforeInsert, BeforeUpdate, Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { ResponseTrack } from '../responses/ResponseTrack';
import { ScanStation } from "./ScanStation";
import { TrackScan } from "./TrackScan";
import type { ScanStation } from "./ScanStation";
import type { TrackScan } from "./TrackScan";
/**
* Defines the Track entity.
@@ -53,15 +53,15 @@ export class Track {
* Used to link scan stations to a certain track.
* This makes the configuration of the scan stations easier.
*/
@OneToMany(() => ScanStation, station => station.track, { nullable: true })
stations: ScanStation[];
@OneToMany(() => require("./ScanStation").ScanStation, (station: ScanStation) => station.track, { nullable: true })
stations!: ScanStation[];
/**
* Used to link track scans to a track.
* The scan will derive it's distance from the track's distance.
*/
@OneToMany(() => TrackScan, scan => scan.track, { nullable: true })
scans: TrackScan[];
@OneToMany(() => require("./TrackScan").TrackScan, (scan: TrackScan) => scan.track, { nullable: true })
scans!: TrackScan[];
@Column({ type: 'bigint', nullable: true, readonly: true })
@IsInt()

View File

@@ -8,10 +8,10 @@ import {
} from "class-validator";
import { ChildEntity, Column, Index, ManyToOne } from "typeorm";
import { ResponseTrackScan } from '../responses/ResponseTrackScan';
import { RunnerCard } from "./RunnerCard";
import type { RunnerCard } from "./RunnerCard";
import { Scan } from "./Scan";
import { ScanStation } from "./ScanStation";
import { Track } from "./Track";
import type { ScanStation } from "./ScanStation";
import type { Track } from "./Track";
/**
* Defines the TrackScan entity.
@@ -29,24 +29,24 @@ export class TrackScan extends Scan {
* This is used to determine the scan's distance.
*/
@IsNotEmpty()
@ManyToOne(() => Track, track => track.scans, { nullable: true })
track: Track;
@ManyToOne(() => require("./Track").Track, (track: Track) => track.scans, { nullable: true })
track!: Track;
/**
* The runnerCard associated with the scan.
* This get's saved for documentation and management purposes.
*/
@IsNotEmpty()
@ManyToOne(() => RunnerCard, card => card.scans, { nullable: true })
card: RunnerCard;
@ManyToOne(() => require("./RunnerCard").RunnerCard, (card: RunnerCard) => card.scans, { nullable: true })
card!: RunnerCard;
/**
* The scanning station that created the scan.
* Mainly used for logging and traceing back scans (or errors)
*/
@IsNotEmpty()
@ManyToOne(() => ScanStation, station => station.scans, { nullable: true })
station: ScanStation;
@ManyToOne(() => require("./ScanStation").ScanStation, (station: ScanStation) => station.scans, { nullable: true })
station!: ScanStation;
/**
* The scan's distance in meters.

View File

@@ -1,12 +1,12 @@
import { IsBoolean, IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsString, IsUrl, IsUUID } from "class-validator";
import { ChildEntity, Column, Index, JoinTable, ManyToMany, OneToMany } from "typeorm";
import { config } from '../../config';
import { ResponsePrincipal } from '../responses/ResponsePrincipal';
import { ResponseUser } from '../responses/ResponseUser';
import { Permission } from './Permission';
import { Principal } from './Principal';
import { UserAction } from './UserAction';
import { UserGroup } from './UserGroup';
import { IsBoolean, IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsString, IsUrl, IsUUID } from "class-validator";
import { ChildEntity, Column, Index, JoinTable, ManyToMany, OneToMany } from "typeorm";
import { config } from '../../config';
import { ResponsePrincipal } from '../responses/ResponsePrincipal';
import { ResponseUser } from '../responses/ResponseUser';
import { Permission } from './Permission';
import { Principal } from './Principal';
import type { UserAction } from './UserAction';
import { UserGroup } from './UserGroup';
/**
* Defines the User entity.
@@ -125,11 +125,11 @@ export class User extends Principal {
/**
* The actions performed by this user.
* For documentation purposes only, will be implemented later.
*/
@IsOptional()
@OneToMany(() => UserAction, action => action.user, { nullable: true })
actions: UserAction[]
* For documentation purposes only, will be implemented later.
*/
@IsOptional()
@OneToMany(() => require("./UserAction").UserAction, (action: UserAction) => action.user, { nullable: true })
actions!: UserAction[]
/**
* Resolves all permissions granted to this user through groups.

View File

@@ -8,7 +8,7 @@ import {
} from "class-validator";
import { BeforeInsert, BeforeUpdate, Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
import { PermissionAction } from '../enums/PermissionAction';
import { User } from './User';
import type { User } from './User';
/**
* Defines the UserAction entity.
@@ -26,8 +26,8 @@ export class UserAction {
/**
* The user that performed the action.
*/
@ManyToOne(() => User, user => user.actions)
user: User
@ManyToOne(() => require("./User").User, (user: User) => user.actions)
user!: User
/**
* The actions's target (e.g. Track#2)

View File

@@ -3,7 +3,7 @@ import { Donation } from '../entities/Donation';
import { DonationStatus } from '../enums/DonationStatus';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseDonor } from './ResponseDonor';
import type { ResponseDonor } from './ResponseDonor';
/**
* Defines the donation response.
@@ -33,7 +33,7 @@ export class ResponseDonation implements IResponse {
* The donation's donor.
*/
@IsNotEmpty()
donor: ResponseDonor;
donor?: ResponseDonor;
/**
* The donation's amount in the smalles unit of your currency (default: euro cent).

View File

@@ -4,7 +4,7 @@ import {
import { Donor } from '../entities/Donor';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseDonation } from './ResponseDonation';
import type { ResponseDonation } from './ResponseDonation';
import { ResponseParticipant } from './ResponseParticipant';
/**
@@ -35,7 +35,7 @@ export class ResponseDonor extends ResponseParticipant implements IResponse {
@IsInt()
paidDonationAmount: number;
donations: Array<ResponseDonation>;
donations?: Array<ResponseDonation>;
/**
* Creates a ResponseRunner object from a runner.
@@ -46,6 +46,7 @@ export class ResponseDonor extends ResponseParticipant implements IResponse {
this.receiptNeeded = donor.receiptNeeded;
this.donationAmount = donor.donationAmount;
this.paidDonationAmount = donor.paidDonationAmount;
const ResponseDonation = require('./ResponseDonation').ResponseDonation;
this.donations = new Array<ResponseDonation>();
if (donor.donations?.length > 0) {
for (const donation of donor.donations) {

View File

@@ -14,7 +14,7 @@ import { RunnerOrganization } from '../entities/RunnerOrganization';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseRunnerGroup } from './ResponseRunnerGroup';
import { ResponseRunnerTeam } from './ResponseRunnerTeam';
import type { ResponseRunnerTeam } from './ResponseRunnerTeam';
/**
* Defines the runnerOrganization response.
@@ -37,7 +37,7 @@ export class ResponseRunnerOrganization extends ResponseRunnerGroup implements I
* The runnerOrganization associated teams.
*/
@IsArray()
teams: ResponseRunnerTeam[];
teams?: ResponseRunnerTeam[];
/**
* The organization's registration key.
@@ -62,6 +62,7 @@ export class ResponseRunnerOrganization extends ResponseRunnerGroup implements I
public constructor(org: RunnerOrganization) {
super(org);
this.address = org.address;
const ResponseRunnerTeam = require('./ResponseRunnerTeam').ResponseRunnerTeam;
this.teams = new Array<ResponseRunnerTeam>();
if (org.teams) {
for (let team of org.teams) {

View File

@@ -3,7 +3,7 @@ import { RunnerTeam } from '../entities/RunnerTeam';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseRunnerGroup } from './ResponseRunnerGroup';
import { ResponseRunnerOrganization } from './ResponseRunnerOrganization';
import type { ResponseRunnerOrganization } from './ResponseRunnerOrganization';
/**
* Defines the runnerTeam response.
@@ -20,7 +20,7 @@ export class ResponseRunnerTeam extends ResponseRunnerGroup implements IResponse
*/
@IsObject()
@IsNotEmpty()
parentGroup: ResponseRunnerOrganization;
parentGroup?: ResponseRunnerOrganization;
/**
* Creates a ResponseRunnerTeam object from a runnerTeam.