Added the donation abstract/interface
This commit is contained in:
parent
72f80859a9
commit
57ba0c3051
37
src/models/Donation.ts
Normal file
37
src/models/Donation.ts
Normal 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;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user