add function to update user
This commit is contained in:
parent
d3b170424f
commit
69085b02d7
|
@ -1,4 +1,4 @@
|
||||||
import { Controller, Get, Post, Body, Param, Delete } from '@nestjs/common';
|
import { Controller, Get, Post, Put, Body, Param, Delete } from '@nestjs/common';
|
||||||
import { AppService } from './app.service';
|
import { AppService } from './app.service';
|
||||||
@Controller()
|
@Controller()
|
||||||
export class AppController {
|
export class AppController {
|
||||||
|
@ -80,6 +80,33 @@ export class AppController {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Put('user/updateUser/:dni')
|
||||||
|
updateUser(@Param('dni') dni: string) {
|
||||||
|
@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,
|
||||||
|
@Body('community_id') community_id: string,
|
||||||
|
) {
|
||||||
|
return this.appService.createUser(
|
||||||
|
dni,
|
||||||
|
name,
|
||||||
|
last_name,
|
||||||
|
email,
|
||||||
|
phone,
|
||||||
|
password,
|
||||||
|
user_type,
|
||||||
|
status,
|
||||||
|
date_entry,
|
||||||
|
community_id,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Get('user/allUsers')
|
@Get('user/allUsers')
|
||||||
allUsers() {
|
allUsers() {
|
||||||
return this.appService.allUsers();
|
return this.appService.allUsers();
|
||||||
|
|
|
@ -53,6 +53,36 @@ export class AppService {
|
||||||
.pipe(map((message: string) => ({ message })));
|
.pipe(map((message: string) => ({ message })));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateUser(
|
||||||
|
dni: string,
|
||||||
|
name: string,
|
||||||
|
last_name: string,
|
||||||
|
email: string,
|
||||||
|
phone: number,
|
||||||
|
password: string,
|
||||||
|
user_type: string,
|
||||||
|
status: string,
|
||||||
|
date_entry: Date,
|
||||||
|
community_id: string,
|
||||||
|
) {
|
||||||
|
const pattern = { cmd: 'updateUser' };
|
||||||
|
const payload = {
|
||||||
|
dni: dni,
|
||||||
|
name: name,
|
||||||
|
last_name: last_name,
|
||||||
|
email: email,
|
||||||
|
phone: phone,
|
||||||
|
password: password,
|
||||||
|
user_type: user_type,
|
||||||
|
status: status,
|
||||||
|
date_entry: date_entry,
|
||||||
|
community_id: community_id,
|
||||||
|
};
|
||||||
|
return this.clientUserApp
|
||||||
|
.send<string>(pattern, payload)
|
||||||
|
.pipe(map((message: string) => ({ message })));
|
||||||
|
}
|
||||||
|
|
||||||
//POST parameter from API
|
//POST parameter from API
|
||||||
createAdminSystem(dni: string, name: string, last_name: string, email: string, phone: number
|
createAdminSystem(dni: string, name: string, last_name: string, email: string, phone: number
|
||||||
, user_type: string, status: string, date_entry: Date) {
|
, user_type: string, status: string, date_entry: Date) {
|
||||||
|
|
Loading…
Reference in New Issue