Fixed spelling
All checks were successful
continuous-integration/drone/pr Build is passing

ref #193
This commit is contained in:
Nicolai Ort 2021-04-14 18:54:02 +02:00
parent 8ae4b85827
commit da266a8dd6
13 changed files with 38 additions and 37 deletions

View File

@ -33,7 +33,7 @@ export class CreateDistanceDonation extends CreateDonation {
let newDonation = new DistanceDonation;
newDonation.amountPerDistance = this.amountPerDistance;
newDonation.payedAmount = this.payedAmount;
newDonation.paidAmount = this.paidAmount;
newDonation.donor = await this.getDonor();
newDonation.runner = await this.getRunner();

View File

@ -17,11 +17,11 @@ export abstract class CreateDonation {
donor: number;
/**
* The donation's payed amount in the smalles unit of your currency (default: euro cent).
* The donation's paid amount in the smalles unit of your currency (default: euro cent).
*/
@IsInt()
@IsOptional()
payedAmount?: number;
paidAmount?: number;
/**
* Creates a new Donation entity from this.

View File

@ -21,7 +21,7 @@ export class CreateFixedDonation extends CreateDonation {
let newDonation = new FixedDonation;
newDonation.amount = this.amount;
newDonation.payedAmount = this.payedAmount;
newDonation.paidAmount = this.paidAmount;
newDonation.donor = await this.getDonor();
return newDonation;

View File

@ -32,7 +32,7 @@ export class UpdateDistanceDonation extends UpdateDonation {
*/
public async update(donation: DistanceDonation): Promise<DistanceDonation> {
donation.amountPerDistance = this.amountPerDistance;
donation.payedAmount = this.payedAmount;
donation.paidAmount = this.paidAmount;
donation.donor = await this.getDonor();
donation.runner = await this.getRunner();

View File

@ -24,11 +24,11 @@ export abstract class UpdateDonation {
donor: number;
/**
* The donation's payed amount in the smalles unit of your currency (default: euro cent).
* The donation's paid amount in the smalles unit of your currency (default: euro cent).
*/
@IsInt()
@IsOptional()
payedAmount?: number;
paidAmount?: number;
/**
* Creates a new Donation entity from this.

View File

@ -20,7 +20,7 @@ export class UpdateFixedDonation extends UpdateDonation {
*/
public async update(donation: FixedDonation): Promise<FixedDonation> {
donation.amount = this.amount;
donation.payedAmount = this.payedAmount;
donation.paidAmount = this.paidAmount;
donation.donor = await this.getDonor();
return donation;

View File

@ -35,12 +35,12 @@ export abstract class Donation {
public abstract get amount(): number;
/**
* The donation's payed amount in cents (or whatever your currency's smallest unit is.).
* Used to mark donations as payed.
* The donation's paid amount in cents (or whatever your currency's smallest unit is.).
* Used to mark donations as paid.
*/
@Column({ nullable: true })
@IsInt()
payedAmount: number;
paidAmount: number;
/**
* Turns this entity into it's response class.

View File

@ -34,12 +34,12 @@ export class Donor extends Participant {
}
/**
* Returns the total payed donations of a donor based on his linked donations.
* Returns the total paid donations of a donor based on his linked donations.
*/
@IsInt()
public get payedDonationAmount(): number {
public get paidDonationAmount(): number {
if (!this.donations) { return 0; }
return this.donations.reduce((sum, current) => sum + current.payedAmount, 0);
return this.donations.reduce((sum, current) => sum + current.paidAmount, 0);
}
/**

View File

@ -3,5 +3,5 @@
*/
export enum DonationStatus {
OPEN = 'OPEN',
PAYED = 'PAYED'
PAID = 'PAID'
}

View File

@ -42,10 +42,10 @@ export class ResponseDonation implements IResponse {
amount: number;
/**
* The donation's payed amount in the smalles unit of your currency (default: euro cent).
* The donation's paid amount in the smalles unit of your currency (default: euro cent).
*/
@IsInt()
payedAmount: number;
paidAmount: number;
/**
* Creates a ResponseDonation object from a scan.
@ -55,12 +55,12 @@ export class ResponseDonation implements IResponse {
this.id = donation.id;
this.donor = donation.donor.toResponse();
this.amount = donation.amount;
this.payedAmount = donation.payedAmount || 0;
if (this.payedAmount < this.amount) {
this.paidAmount = donation.paidAmount || 0;
if (this.paidAmount < this.amount) {
this.status = DonationStatus.OPEN;
}
else {
this.status = DonationStatus.PAYED;
this.status = DonationStatus.PAID;
}
}
}

View File

@ -29,10 +29,10 @@ export class ResponseDonor extends ResponseParticipant implements IResponse {
donationAmount: number;
/**
* Returns the total payed donations of a donor based on his linked donations.
* Returns the total paid donations of a donor based on his linked donations.
*/
@IsInt()
payedDonationAmount: number;
paidDonationAmount: number;
/**
* Creates a ResponseRunner object from a runner.
@ -42,5 +42,6 @@ export class ResponseDonor extends ResponseParticipant implements IResponse {
super(donor);
this.receiptNeeded = donor.receiptNeeded;
this.donationAmount = donor.donationAmount;
this.paidDonationAmount = donor.paidDonationAmount;
}
}

View File

@ -181,7 +181,7 @@ describe('POST /api/donations/fixed successfully', () => {
expect(res.data).toEqual({
"donor": added_donor,
"amount": 1000,
"payedAmount": 0,
"paidAmount": 0,
"status": "OPEN",
"responseType": "DONATION"
});
@ -190,7 +190,7 @@ describe('POST /api/donations/fixed successfully', () => {
const res = await axios.post(base + '/api/donations/fixed', {
"donor": added_donor.id,
"amount": 1000,
"payedAmount": 1000
"paidAmount": 1000
}, axios_config);
delete res.data.id;
expect(res.status).toEqual(200);
@ -198,8 +198,8 @@ describe('POST /api/donations/fixed successfully', () => {
expect(res.data).toEqual({
"donor": added_donor,
"amount": 1000,
"payedAmount": 1000,
"status": "PAYED",
"paidAmount": 1000,
"status": "PAID",
"responseType": "DONATION"
});
});
@ -252,8 +252,8 @@ describe('POST /api/donations/distance successfully', () => {
"amountPerDistance": 100,
"runner": added_runner,
"amount": 0,
"payedAmount": 0,
"status": "PAYED",
"paidAmount": 0,
"status": "PAID",
"responseType": "DISTANCEDONATION"
})
});
@ -262,7 +262,7 @@ describe('POST /api/donations/distance successfully', () => {
"runner": added_runner.id,
"amountPerDistance": 100,
"donor": added_donor.id,
"payedAmount": 1000
"paidAmount": 1000
}, axios_config);
delete res.data.id;
expect(res.status).toEqual(200);
@ -272,8 +272,8 @@ describe('POST /api/donations/distance successfully', () => {
"amountPerDistance": 100,
"runner": added_runner,
"amount": 0,
"payedAmount": 1000,
"status": "PAYED",
"paidAmount": 1000,
"status": "PAID",
"responseType": "DISTANCEDONATION"
})
});

View File

@ -213,16 +213,16 @@ describe('adding + updating fixed donation valid', () => {
expect(res.headers['content-type']).toContain("application/json");
expect(res.data.amount).toEqual(42);
});
it('updating payedAmount should return 200', async () => {
it('updating paidAmount should return 200', async () => {
const res = await axios.put(base + '/api/donations/fixed/' + added_donation.id, {
"id": added_donation.id,
"donor": added_donor.id,
"amount": 42,
"payedAmount": 10
"paidAmount": 10
}, axios_config);
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json");
expect(res.data.payedAmount).toEqual(10);
expect(res.data.paidAmount).toEqual(10);
});
it('updating donor should return 200', async () => {
const res = await axios.put(base + '/api/donations/fixed/' + added_donation.id, {
@ -328,18 +328,18 @@ describe('adding + updating distance donation valid', () => {
expect(res.headers['content-type']).toContain("application/json");
expect(res.data.amountPerDistance).toEqual(69);
});
it('updating payedAmount should return 200', async () => {
it('updating paidAmount should return 200', async () => {
const res = await axios.put(base + '/api/donations/distance/' + added_donation.id, {
"id": added_donation.id,
"runner": added_runner.id,
"amountPerDistance": 69,
"donor": added_donor.id,
"payedAmount": 10
"paidAmount": 10
}, axios_config);
delete res.data.donor.donationAmount;
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json");
expect(res.data.payedAmount).toEqual(10);
expect(res.data.paidAmount).toEqual(10);
});
it('updating runner should return 200', async () => {
const res = await axios.put(base + '/api/donations/distance/' + added_donation.id, {