error taos
This commit is contained in:
parent
318839c1e9
commit
181f351860
12 changed files with 2553 additions and 3182 deletions
|
|
@ -1,47 +1,32 @@
|
|||
import {
|
||||
Controller,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Get,
|
||||
Post,
|
||||
Body,
|
||||
} from "tsoa";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatusCode from "../interfaces/http-status";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { findEndDate } from "../interfaces/utils";
|
||||
import { Controller, Route, Security, Tags, Request, SuccessResponse, Response, Get, Post, Body } from "tsoa"
|
||||
import HttpSuccess from "../interfaces/http-success"
|
||||
import HttpStatusCode from "../interfaces/http-status"
|
||||
import { RequestWithUser } from "../middlewares/user"
|
||||
import { findEndDate } from "../interfaces/utils"
|
||||
|
||||
@Route("api/v1/probation/calculate")
|
||||
@Tags("ฟอร์มมอบหมายงาน")
|
||||
@Security("bearerAuth")
|
||||
@Response(
|
||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
@Response(HttpStatusCode.INTERNAL_SERVER_ERROR, "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง")
|
||||
export class CalculateController extends Controller {
|
||||
/**
|
||||
* API คำนวนวันสิ้นสุดตามวันที่เริ่มและระยะเวลาเดือนตามที่ส่งค่ามา
|
||||
*
|
||||
* @summary คำนวนวันสิ้นสุดตามวันที่เริ่มและระยะเวลาเดือนตามที่ส่งค่ามา
|
||||
*
|
||||
*/
|
||||
@Post("assign-finish")
|
||||
async AssignFinish(
|
||||
@Body()
|
||||
requestBody: {
|
||||
month: number;
|
||||
start_date: Date;
|
||||
},
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const { month, start_date } = requestBody;
|
||||
const finish_date = findEndDate(month, start_date);
|
||||
/**
|
||||
* API คำนวนวันสิ้นสุดตามวันที่เริ่มและระยะเวลาเดือนตามที่ส่งค่ามา
|
||||
*
|
||||
* @summary คำนวนวันสิ้นสุดตามวันที่เริ่มและระยะเวลาเดือนตามที่ส่งค่ามา
|
||||
*
|
||||
*/
|
||||
@Post("assign-finish")
|
||||
async AssignFinish(
|
||||
@Body()
|
||||
requestBody: {
|
||||
month: number
|
||||
start_date: Date
|
||||
},
|
||||
@Request() request: RequestWithUser
|
||||
) {
|
||||
const { month, start_date } = requestBody
|
||||
const finish_date = findEndDate(month, start_date)
|
||||
|
||||
return new HttpSuccess({ finish_date });
|
||||
}
|
||||
return new HttpSuccess({ finish_date })
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue