apps/nestjs-backend/src/features/pin/pin.controller.ts
import { Body, Controller, Delete, Get, Post, Put, Query } from '@nestjs/common';
import type { GetPinListVo } from '@teable/openapi';
import {
AddPinRo,
DeletePinRo,
addPinRoSchema,
deletePinRoSchema,
UpdatePinOrderRo,
updatePinOrderRoSchema,
} from '@teable/openapi';
import { ZodValidationPipe } from '../../zod.validation.pipe';
import { PinService } from './pin.service';
@Controller('api/pin')
export class PinController {
constructor(private readonly pinService: PinService) {}
@Post()
async add(@Body(new ZodValidationPipe(addPinRoSchema)) query: AddPinRo) {
return this.pinService.addPin(query);
}
@Delete()
async delete(@Query(new ZodValidationPipe(deletePinRoSchema)) query: DeletePinRo) {
return this.pinService.deletePin(query);
}
@Get('list')
async getList(): Promise<GetPinListVo> {
return this.pinService.getList();
}
@Put('order')
async updateOrder(@Body(new ZodValidationPipe(updatePinOrderRoSchema)) body: UpdatePinOrderRo) {
return this.pinService.updateOrder(body);
}
}