diff --git a/src/models/Donation.ts b/src/models/Donation.ts new file mode 100644 index 0000000..82897c8 --- /dev/null +++ b/src/models/Donation.ts @@ -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; +} \ No newline at end of file