feat: return null if no image exist
This commit is contained in:
parent
43b97be4f1
commit
5492f9533a
1 changed files with 2 additions and 2 deletions
|
|
@ -15,7 +15,7 @@ import {
|
||||||
import { Prisma, Status, UserType } from "@prisma/client";
|
import { Prisma, Status, UserType } from "@prisma/client";
|
||||||
|
|
||||||
import prisma from "../db";
|
import prisma from "../db";
|
||||||
import minio from "../services/minio";
|
import minio, { presignedGetObjectIfExist } from "../services/minio";
|
||||||
import { RequestWithUser } from "../interfaces/user";
|
import { RequestWithUser } from "../interfaces/user";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
import HttpStatus from "../interfaces/http-status";
|
import HttpStatus from "../interfaces/http-status";
|
||||||
|
|
@ -185,7 +185,7 @@ export class UserController extends Controller {
|
||||||
result.map(async (v) => ({
|
result.map(async (v) => ({
|
||||||
...v,
|
...v,
|
||||||
branch: includeBranch ? v.branch.map((a) => a.branch) : undefined,
|
branch: includeBranch ? v.branch.map((a) => a.branch) : undefined,
|
||||||
profileImageUrl: await minio.presignedGetObject(
|
profileImageUrl: await presignedGetObjectIfExist(
|
||||||
MINIO_BUCKET,
|
MINIO_BUCKET,
|
||||||
imageLocation(v.id),
|
imageLocation(v.id),
|
||||||
12 * 60 * 60,
|
12 * 60 * 60,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue