add array nested schema
This commit is contained in:
parent
ed4d366057
commit
0526b7ac18
|
@ -68,10 +68,9 @@ export class AppController {
|
||||||
@Body('quote') quote: number,
|
@Body('quote') quote: number,
|
||||||
@Body('status') status: string,
|
@Body('status') status: string,
|
||||||
@Body('date_entry') date_entry: Date,
|
@Body('date_entry') date_entry: Date,
|
||||||
@Body('houses') houses: {},
|
@Body('houses') houses: [{}],
|
||||||
|
|
||||||
) {
|
) {
|
||||||
console.log(houses);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ export class AppService {
|
||||||
|
|
||||||
//POST parameter from API
|
//POST parameter from API
|
||||||
createCommunity(name: string, province: string, canton: string, district: string
|
createCommunity(name: string, province: string, canton: string, district: string
|
||||||
, num_houses: number, phone: number, quote: number, status: string, date_entry: Date, houses: {}) {
|
, num_houses: number, phone: number, quote: number, status: string, date_entry: Date, houses: [{}]) {
|
||||||
const pattern = { cmd: 'createCommunity' };
|
const pattern = { cmd: 'createCommunity' };
|
||||||
const payload = {
|
const payload = {
|
||||||
name: name, province: province, canton: canton, district: district, num_houses: num_houses,
|
name: name, province: province, canton: canton, district: district, num_houses: num_houses,
|
||||||
|
@ -81,6 +81,8 @@ export class AppService {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
allCommunities() {
|
allCommunities() {
|
||||||
const pattern = { cmd: 'findAllCommunities' };
|
const pattern = { cmd: 'findAllCommunities' };
|
||||||
const payload = {};
|
const payload = {};
|
||||||
|
|
|
@ -35,8 +35,8 @@ export class Community {
|
||||||
@Prop()
|
@Prop()
|
||||||
date_entry: Date;
|
date_entry: Date;
|
||||||
|
|
||||||
@Prop({ type: HouseSchema })
|
@Prop({ type: [HouseSchema] })
|
||||||
houses: House
|
houses: Array<House>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue