diff --git a/src/models/Address.ts b/src/models/Address.ts index 59e6570..ccc2c70 100644 --- a/src/models/Address.ts +++ b/src/models/Address.ts @@ -25,7 +25,7 @@ export class Address { /** * The address's description. */ - @Column() + @Column({nullable: true}) @IsString() @IsOptional() description?: string; @@ -43,7 +43,7 @@ export class Address { * The address's second line. * Containing optional information. */ - @Column() + @Column({nullable: true}) @IsString() @IsOptional() address2?: string; diff --git a/src/models/GroupContact.ts b/src/models/GroupContact.ts index 58a07a7..745174f 100644 --- a/src/models/GroupContact.ts +++ b/src/models/GroupContact.ts @@ -5,6 +5,7 @@ import { IsNotEmpty, IsOptional, IsPhoneNumber, + IsPositive, IsString, } from "class-validator"; import { Address } from "./Address"; @@ -36,7 +37,7 @@ export class GroupContact { * The contact's middle name. * Optional */ - @Column() + @Column({nullable: true}) @IsOptional() @IsString() middlename?: string; @@ -45,7 +46,7 @@ export class GroupContact { * The contact's last name. */ @Column() - @IsOptional() + @IsNotEmpty() @IsString() lastname: string; @@ -61,7 +62,7 @@ export class GroupContact { * The contact's phone number. * Optional */ - @Column() + @Column({nullable: true}) @IsOptional() @IsPhoneNumber("DE") phone?: string; @@ -70,7 +71,7 @@ export class GroupContact { * The contact's email address. * Optional */ - @Column() + @Column({nullable: true}) @IsOptional() @IsEmail() email?: string; diff --git a/src/models/Participant.ts b/src/models/Participant.ts index 2f4327b..bcbf5ca 100644 --- a/src/models/Participant.ts +++ b/src/models/Participant.ts @@ -5,6 +5,7 @@ import { IsNotEmpty, IsOptional, IsPhoneNumber, + IsPositive, IsString, } from "class-validator"; import { Address } from "./Address"; @@ -35,7 +36,7 @@ export abstract class Participant { * The participant's middle name. * Optional */ - @Column() + @Column({nullable: true}) @IsOptional() @IsString() middlename?: string; @@ -44,7 +45,7 @@ export abstract class Participant { * The participant's last name. */ @Column() - @IsOptional() + @IsNotEmpty() @IsString() lastname: string; @@ -52,7 +53,6 @@ export abstract class Participant { * The participant's address. * Optional */ - @IsOptional() @ManyToOne(() => Address, address => address.participants) address?: Address; @@ -60,7 +60,7 @@ export abstract class Participant { * The participant's phone number. * Optional */ - @Column() + @Column({nullable: true}) @IsOptional() @IsPhoneNumber("DE") phone?: string; @@ -69,7 +69,7 @@ export abstract class Participant { * The participant's email address. * Optional */ - @Column() + @Column({nullable: true}) @IsOptional() @IsEmail() email?: string; diff --git a/src/models/ScanStation.ts b/src/models/ScanStation.ts index 4415ebc..fd30a34 100644 --- a/src/models/ScanStation.ts +++ b/src/models/ScanStation.ts @@ -25,10 +25,10 @@ export class ScanStation { /** * The station's description. */ - @Column() - @IsNotEmpty() + @Column({nullable: true}) + @IsOptional() @IsString() - description: string; + description?: string; /** * The track this station is associated with. diff --git a/src/models/Track.ts b/src/models/Track.ts index eda6def..ce4693c 100644 --- a/src/models/Track.ts +++ b/src/models/Track.ts @@ -20,7 +20,7 @@ export class Track { @PrimaryGeneratedColumn() @IsOptional() @IsInt() - id: number; + id: number;; /** * The track's name. diff --git a/src/models/User.ts b/src/models/User.ts index d946500..fce74e8 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -11,10 +11,10 @@ export class User { /** * autogenerated unique id (primary key). */ - @PrimaryGeneratedColumn() - @IsOptional() - @IsInt() - id: number; + @PrimaryGeneratedColumn() + @IsOptional() + @IsInt() + id: number; /** * autogenerated uuid diff --git a/src/models/UserAction.ts b/src/models/UserAction.ts index 7f6dc43..ea794a5 100644 --- a/src/models/UserAction.ts +++ b/src/models/UserAction.ts @@ -41,7 +41,7 @@ export class UserAction { /** * The description of change (before-> after; e.g. distance:15->17) */ - @Column() + @Column({nullable: true}) @IsOptional() @IsString() changed: string; diff --git a/src/models/UserGroup.ts b/src/models/UserGroup.ts index 5a19713..ae014e2 100644 --- a/src/models/UserGroup.ts +++ b/src/models/UserGroup.ts @@ -37,8 +37,8 @@ export abstract class UserGroup { /** * The group's description */ - @Column() + @Column({nullable: true}) @IsOptional() @IsString() - description: string; + description?: string; } \ No newline at end of file