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('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);

View File

@ -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 = {};

View File

@ -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>;
} }