add array nested schema

This commit is contained in:
Mariela 2022-06-30 21:22:54 -06:00
parent ed4d366057
commit 0526b7ac18
3 changed files with 6 additions and 5 deletions

View File

@ -68,10 +68,9 @@ export class AppController {
@Body('quote') quote: number,
@Body('status') status: string,
@Body('date_entry') date_entry: Date,
@Body('houses') houses: {},
@Body('houses') houses: [{}],
) {
console.log(houses);

View File

@ -68,7 +68,7 @@ export class AppService {
//POST parameter from API
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 payload = {
name: name, province: province, canton: canton, district: district, num_houses: num_houses,
@ -81,6 +81,8 @@ export class AppService {
);
}
allCommunities() {
const pattern = { cmd: 'findAllCommunities' };
const payload = {};

View File

@ -35,8 +35,8 @@ export class Community {
@Prop()
date_entry: Date;
@Prop({ type: HouseSchema })
houses: House
@Prop({ type: [HouseSchema] })
houses: Array<House>;
}