更新接口

main
rustdreamer 2 years ago
parent cfcb025cac
commit 09b2e522eb

@ -1,4 +1,4 @@
import { BadRequestException, Body, Controller, Get, Post, Query, Req } from '@nestjs/common';
import { BadRequestException, Body, Controller, Get, Post, Put, Query, Req } from '@nestjs/common';
import { AppService } from './app.service';
import * as fs from 'fs';
import { ApiBearerAuth, ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
@ -48,6 +48,18 @@ export class VisitorList {
public nationality: string;
}
export class UpdateVisitorNumber {
@ApiProperty({ description: "id" })
@IsString()
@IsNotEmpty()
public id: string;
@ApiProperty({ description: "card_number" })
@IsString()
@IsNotEmpty()
public card_number: string;
}
export class CreateVisitor {
@ApiProperty({ description: "申请人" })
@IsString()
@ -347,6 +359,17 @@ export class AppController {
});
}
@Put("/visitor/number")
async updateVisitor(@Body() data: UpdateVisitorNumber) {
const node_other_visitor = await this.nodeOtherVisitorRepository.findOne({ where: { id: data.id } })
if (!node_other_visitor) {
throw new BadRequestException("数据不存在")
}
node_other_visitor.card_number = data.card_number;
const result = await this.nodeOtherVisitorRepository.save(node_other_visitor);
return result;
}
@Post('upload/base64')
async louploadBase64Filegin(
@Body() input: any,

@ -26,6 +26,10 @@ export class NodeOtherVisitorEntity extends Base {
@Column({ length: 150, nullable: true, type: 'char' })
public nationality: string;
@ApiProperty({ description: "访客卡编号" })
@Column({ length: 150, nullable: true, type: 'char' })
public card_number: string;
@ApiProperty({ description: "" })
@Column({ length: 36, nullable: true, type: 'char' })
public node_visitor_id: string;

Loading…
Cancel
Save