feat: add head method
This commit is contained in:
parent
127db88056
commit
60a151a075
1 changed files with 34 additions and 2 deletions
|
|
@ -1,11 +1,31 @@
|
||||||
import { Body, Controller, Delete, Get, Path, Post, Put, Query, Request, Route, Tags } from "tsoa";
|
import {
|
||||||
|
Body,
|
||||||
|
Controller,
|
||||||
|
Delete,
|
||||||
|
Get,
|
||||||
|
Head,
|
||||||
|
Path,
|
||||||
|
Post,
|
||||||
|
Put,
|
||||||
|
Query,
|
||||||
|
Request,
|
||||||
|
Route,
|
||||||
|
Tags,
|
||||||
|
} from "tsoa";
|
||||||
import express from "express";
|
import express from "express";
|
||||||
import { PaymentStatus } from "@prisma/client";
|
import { PaymentStatus } from "@prisma/client";
|
||||||
import prisma from "../db";
|
import prisma from "../db";
|
||||||
import { notFoundError } from "../utils/error";
|
import { notFoundError } from "../utils/error";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
import HttpStatus from "../interfaces/http-status";
|
import HttpStatus from "../interfaces/http-status";
|
||||||
import { deleteFile, fileLocation, getFile, listFile, setFile } from "../utils/minio";
|
import {
|
||||||
|
deleteFile,
|
||||||
|
fileLocation,
|
||||||
|
getFile,
|
||||||
|
getFilePresigned,
|
||||||
|
listFile,
|
||||||
|
setFile,
|
||||||
|
} from "../utils/minio";
|
||||||
import { RequestWithUser } from "../interfaces/user";
|
import { RequestWithUser } from "../interfaces/user";
|
||||||
|
|
||||||
@Tags("Quotation")
|
@Tags("Quotation")
|
||||||
|
|
@ -83,6 +103,18 @@ export class QuotationPayment extends Controller {
|
||||||
return await listFile(fileLocation.quotation.payment(quotationId, paymentId));
|
return await listFile(fileLocation.quotation.payment(quotationId, paymentId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Head("{paymentId}/attachment/{name}")
|
||||||
|
async headPaymentFile(
|
||||||
|
@Request() req: express.Request,
|
||||||
|
@Path() quotationId: string,
|
||||||
|
@Path() paymentId: string,
|
||||||
|
@Path() name: string,
|
||||||
|
) {
|
||||||
|
return req.res?.redirect(
|
||||||
|
await getFilePresigned("head", fileLocation.quotation.payment(quotationId, paymentId, name)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Get("{paymentId}/attachment/{name}")
|
@Get("{paymentId}/attachment/{name}")
|
||||||
async getPaymentFile(
|
async getPaymentFile(
|
||||||
@Request() req: express.Request,
|
@Request() req: express.Request,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue