Updated a bunch of optional collumns to be nullable

ref #11 #13
This commit is contained in:
Nicolai Ort 2020-12-02 19:14:45 +01:00
parent a78bbb1de5
commit aa565c6b34
8 changed files with 23 additions and 22 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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.

View File

@ -20,7 +20,7 @@ export class Track {
@PrimaryGeneratedColumn()
@IsOptional()
@IsInt()
id: number;
id: number;;
/**
* The track's name.

View File

@ -11,10 +11,10 @@ export class User {
/**
* autogenerated unique id (primary key).
*/
@PrimaryGeneratedColumn()
@IsOptional()
@IsInt()
id: number;
@PrimaryGeneratedColumn()
@IsOptional()
@IsInt()
id: number;
/**
* autogenerated uuid

View File

@ -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;

View File

@ -37,8 +37,8 @@ export abstract class UserGroup {
/**
* The group's description
*/
@Column()
@Column({nullable: true})
@IsOptional()
@IsString()
description: string;
description?: string;
}