Implemented the donation response

ref #66
This commit is contained in:
2021-01-12 18:16:09 +01:00
parent 02bb634257
commit 6c53701a59
4 changed files with 31 additions and 11 deletions

View File

@@ -3,6 +3,7 @@ import {
IsNotEmpty
} from "class-validator";
import { Entity, ManyToOne, PrimaryGeneratedColumn, TableInheritance } from "typeorm";
import { ResponseDonation } from '../responses/ResponseDonation';
import { Donor } from './Donor';
/**
@@ -31,12 +32,13 @@ export abstract class Donation {
* The donation's amount in cents (or whatever your currency's smallest unit is.).
* The exact implementation may differ for each type of donation.
*/
abstract amount: number;
public abstract get amount(): number;
/**
* Turns this entity into it's response class.
*/
public toResponse() {
return new Error("NotImplemented");
public toResponse(): ResponseDonation {
return new ResponseDonation(this);
}
}