Skip to content

Commit 931a16f

Browse files
committed
Reduce data sent for donation and projects on creation
1 parent 718c51c commit 931a16f

File tree

7 files changed

+18
-24
lines changed

7 files changed

+18
-24
lines changed

angular.json

+3
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@
163163
"configurations": {
164164
"dev": {
165165
"browserTarget": "valyou:build:dev"
166+
},
167+
"heroku-fr": {
168+
"browserTarget": "valyou:build:heroku-fr"
166169
}
167170
}
168171
},

src/app/_models/budget.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class Budget {
1212
endDate: Date;
1313
organization: Organization;
1414
sponsor: User;
15-
donations: Donation[];
15+
donations: Donation[] = [];
1616
rules: Content;
1717

1818
// Only in Valyou-Web

src/app/_models/donation.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
import { User } from './user';
2-
import { Project } from './project';
3-
import { Budget } from './budget';
4-
51
export class Donation {
62
id: number;
73
amount: number;
8-
contributor: User;
9-
project: Project;
10-
budget: Budget;
4+
contributor: any;
5+
project: any;
6+
budget: any;
117
}

src/app/_models/organization.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export class Organization {
66
id: number;
77
name: string = '';
88
slackTeamId: string = '';
9-
members: User[];
10-
budgets: Budget[];
11-
contents: Content[];
9+
members: User[] = [];
10+
budgets: Budget[] = [];
11+
contents: Content[] = [];
1212
}

src/app/_models/project.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import { User } from './user';
2-
import { Donation } from './donation';
3-
import { Organization } from './organization';
4-
import { Budget } from './budget';
5-
62

73
export class Project {
84
id: number;
@@ -15,11 +11,11 @@ export class Project {
1511
peopleRequired: number = 2;
1612
leader: User = new User();
1713
fundingDeadline: Date;
18-
donations: Donation[] = [];
14+
donations: any[] = [];
1915
totalDonations: number = 0;
20-
peopleGivingTime: User[] = [];
21-
organizations: Organization[] = [];
22-
budgets: Budget[] = [];
16+
peopleGivingTime: any[] = [];
17+
organizations: any[] = [];
18+
budgets: any[] = [];
2319

2420
// Only in Valyou-Web
2521
remainingDays: number;

src/app/valyou/projects/new-project/new-project.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ export class NewProjectComponent implements OnInit {
127127
this.submitting = true;
128128

129129
// Get data from form
130-
var selectedOrganization = new Organization();
130+
var selectedOrganization: any = {};
131131
selectedOrganization.id = this.organizations[this.f.organization.value].id;
132132
this.project.organizations = [selectedOrganization];
133133

134-
var selectedBudget = new Budget();
134+
var selectedBudget: any = {};
135135
selectedBudget.id = this.budgets[this.f.budget.value].id;
136136
this.project.budgets = [selectedBudget];
137137

src/app/valyou/projects/view-project/view-project.component.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,9 @@ export class ViewProjectComponent implements OnInit {
149149

150150
var donation = new Donation();
151151
donation.amount = this.f.amount.value;
152-
donation.project = new Project();
152+
donation.project = {};
153153
donation.project.id = this.project.id;
154-
donation.project.title = this.project.title;
155-
donation.budget = new Budget()
154+
donation.budget = {};
156155
donation.budget.id = this.budgets[this.f.budget.value].id;
157156

158157
this.donationService.create(donation)

0 commit comments

Comments
 (0)