2022-06-29 09:23:07 +00:00
|
|
|
import { Controller, Get, Post, Body, Param } from '@nestjs/common';
|
2022-06-29 02:30:10 +00:00
|
|
|
import { AppService } from "./app.service";
|
|
|
|
|
|
|
|
@Controller()
|
|
|
|
export class AppController {
|
2022-06-29 09:23:07 +00:00
|
|
|
constructor(private readonly appService: AppService) { }
|
2022-06-29 02:30:10 +00:00
|
|
|
|
2022-07-01 01:42:50 +00:00
|
|
|
//#API userService - create user
|
|
|
|
@Post('user/createAdminSystem')
|
|
|
|
createAdminSystem(
|
|
|
|
@Body('dni') dni: string,
|
|
|
|
@Body('name') name: string,
|
|
|
|
@Body('last_name') last_name: string,
|
|
|
|
@Body('email') email: string,
|
|
|
|
@Body('phone') phone: number,
|
|
|
|
@Body('password') password: string,
|
|
|
|
@Body('user_type') user_type: string,
|
|
|
|
@Body('status') status: string,
|
|
|
|
@Body('date_entry') date_entry: Date,
|
|
|
|
) {
|
|
|
|
return this.appService.createAdminSystem(dni, name, last_name, email, phone, password,
|
|
|
|
user_type, status, date_entry);
|
|
|
|
}
|
|
|
|
|
2022-06-29 09:23:07 +00:00
|
|
|
@Post('user/create')
|
|
|
|
createUser(
|
|
|
|
@Body('dni') dni: string,
|
|
|
|
@Body('name') name: string,
|
|
|
|
@Body('last_name') last_name: string,
|
|
|
|
@Body('email') email: string,
|
|
|
|
@Body('phone') phone: number,
|
|
|
|
@Body('password') password: string,
|
|
|
|
@Body('user_type') user_type: string,
|
2022-06-29 10:12:27 +00:00
|
|
|
@Body('status') status: string,
|
|
|
|
@Body('date_entry') date_entry: Date,
|
2022-07-01 01:42:50 +00:00
|
|
|
@Body('community_id') community_id: string,
|
2022-06-29 09:23:07 +00:00
|
|
|
) {
|
|
|
|
return this.appService.createUser(dni, name, last_name, email, phone, password,
|
2022-07-01 01:42:50 +00:00
|
|
|
user_type, status, date_entry, community_id);
|
2022-06-29 02:30:10 +00:00
|
|
|
}
|
2022-06-29 09:23:07 +00:00
|
|
|
|
|
|
|
|
2022-07-01 01:42:50 +00:00
|
|
|
|
2022-06-29 09:23:07 +00:00
|
|
|
@Get('user/all')
|
|
|
|
allUsers() {
|
|
|
|
return this.appService.allUsers();
|
|
|
|
}
|
|
|
|
|
2022-06-29 10:12:27 +00:00
|
|
|
|
|
|
|
@Get('user/find/:dni')
|
|
|
|
findUser(
|
|
|
|
@Param('dni') paramUserDNI: string
|
|
|
|
){
|
|
|
|
return this.appService.findUser(paramUserDNI);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// #==== API Communities
|
|
|
|
//#API orderService - create order
|
|
|
|
@Post('community/createCommunity')
|
|
|
|
createCommunity(
|
|
|
|
@Body('name') name: string,
|
|
|
|
@Body('province') province: string,
|
|
|
|
@Body('canton') canton: string,
|
|
|
|
@Body('district') district: string,
|
|
|
|
@Body('num_houses') num_houses: number,
|
|
|
|
@Body('phone') phone: number,
|
|
|
|
@Body('quote') quote: number,
|
|
|
|
@Body('status') status: string,
|
|
|
|
@Body('date_entry') date_entry: Date,
|
2022-07-01 01:42:50 +00:00
|
|
|
@Body('houses') houses: {},
|
|
|
|
|
2022-06-29 10:12:27 +00:00
|
|
|
) {
|
2022-07-01 01:42:50 +00:00
|
|
|
console.log(houses);
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-29 10:12:27 +00:00
|
|
|
return this.appService.createCommunity(name, province, canton,
|
|
|
|
district, num_houses, phone,
|
2022-07-01 01:42:50 +00:00
|
|
|
quote, status, date_entry, houses);
|
2022-06-29 10:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Get('community/allCommunities')
|
|
|
|
allcommunities() {
|
|
|
|
return this.appService.allCommunities();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Get('community/findCommunity/:id')
|
|
|
|
findCommunity(
|
|
|
|
@Param('dni') paramCommunityId: string
|
|
|
|
){
|
|
|
|
return this.appService.findCommunity(paramCommunityId);
|
|
|
|
}
|
2022-06-29 02:30:10 +00:00
|
|
|
}
|