Test server

This commit is contained in:
2024-08-20 14:58:23 +08:00
parent 5fcf46122d
commit cae318c5e3
8 changed files with 19 additions and 9 deletions

View File

@@ -8,8 +8,9 @@ export async function adminMap_funGetOneById({ mapId }: { mapId: string }) {
id: mapId,
},
include: {
ImageMap: true,
ImagePin: true,
Author: true,
Images: true,
Portofolio: {
include: {
MasterBidangBisnis: {

View File

@@ -7,6 +7,8 @@ import { v4 } from "uuid";
import fs from "fs";
import { revalidatePath } from "next/cache";
import { MODEL_JOB } from "../../model/interface";
import path from "path";
const root = process.cwd();
export async function Job_funCreate(req: MODEL_JOB, file: FormData) {
const authorId = await user_getOneUserId();
@@ -30,7 +32,10 @@ export async function Job_funCreate(req: MODEL_JOB, file: FormData) {
if (!upload) return { status: 400, message: "Gagal upload gambar" };
const uploadFolder = Buffer.from(await dataImage.arrayBuffer());
fs.writeFileSync(`./public/job/${upload.url}`, uploadFolder);
fs.writeFileSync(
path.join(root, `public/job/${upload.url}`),
uploadFolder
);
const createDataWithImg = await prisma.job.create({
data: {
title: req.title,

View File

@@ -38,7 +38,7 @@ export async function map_funCreatePin({ data }: { data: any }) {
namePin: data.namePin,
portofolioId: data?.portofolioId,
authorId: authorId,
imagesId: uploadImage.id,
imagesMapId: uploadImage.id,
},
});

View File

@@ -47,7 +47,7 @@ export async function map_funEditMap({
latitude: data.latitude,
longitude: data.longitude,
namePin: data.namePin,
imagesId: uploadImage.id,
imagesMapId: uploadImage.id,
},
});

View File

@@ -28,7 +28,7 @@ export async function map_funGetOneById({ mapId }: { mapId: string }) {
latitude: true,
longitude: true,
authorId: true,
imagesId: true,
imagesMapId: true,
Portofolio: {
select: {
id: true,

View File

@@ -16,7 +16,7 @@ export async function map_funGetOneByPortofolioId({
namePin: true,
latitude: true,
longitude: true,
imagesId: true,
imagesMapId: true,
},
});