Added the donation abstract/interface

This commit is contained in:
Nicolai Ort 2020-12-01 17:31:05 +01:00
parent 72f80859a9
commit 57ba0c3051
1 changed files with 37 additions and 0 deletions

37
src/models/Donation.ts Normal file
View File

@ -0,0 +1,37 @@
import { PrimaryGeneratedColumn, Column } from "typeorm";
import {
IsInt,
IsNotEmpty,
IsOptional,
IsPositive,
} from "class-validator";
import { Participant } from "./Participant";
/**
* Defines the donation interface.
*/
export abstract class Donation {
/**
* Autogenerated unique id (primary key).
*/
@PrimaryGeneratedColumn()
@IsOptional()
@IsInt()
id: number;
/**
* The donations's donor.
*/
@Column()
@IsNotEmpty()
//TODO: Relationship
donor: Participant;
/**
* The donation's amount in cents (or whatever your currency's smallest unit is.).
*/
@Column()
@IsInt()
@IsPositive()
amount: number;
}