fix
Deskripsi: - Upload ke stroage untuk job ## Np Issuee
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
"use server";
|
||||
|
||||
import { prisma } from "@/app/lib";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { MODEL_JOB } from "../../model/interface";
|
||||
|
||||
export async function job_funCreateNoFile({ data }: { data: MODEL_JOB }) {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const authorId = await funGetUserIdByToken();
|
||||
|
||||
const createNoImage = await prisma.job.create({
|
||||
data: {
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import _ from "lodash";
|
||||
import { v4 } from "uuid";
|
||||
import fs from "fs";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { MODEL_JOB } from "../../model/interface";
|
||||
import path from "path";
|
||||
import { funGlobal_UploadToStorage } from "@/app_modules/_global/fun";
|
||||
import { DIRECTORY_ID } from "@/app/lib";
|
||||
|
||||
export async function job_funCreateWithFile({
|
||||
data,
|
||||
@@ -18,15 +12,14 @@ export async function job_funCreateWithFile({
|
||||
data: MODEL_JOB;
|
||||
fileId: string;
|
||||
}) {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
console.log(authorId);
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const createDataWithoutImg = await prisma.job.create({
|
||||
data: {
|
||||
title: data.title,
|
||||
content: data.content,
|
||||
deskripsi: data.deskripsi,
|
||||
authorId: authorId,
|
||||
authorId: userLoginId,
|
||||
imageId: fileId,
|
||||
},
|
||||
select: {
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import _ from "lodash";
|
||||
import { v4 } from "uuid";
|
||||
import fs from "fs";
|
||||
import { MODEL_JOB } from "../../model/interface";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { MODEL_JOB } from "../../model/interface";
|
||||
|
||||
export async function job_EditById({
|
||||
data,
|
||||
imageId,
|
||||
fileId,
|
||||
}: {
|
||||
data: MODEL_JOB;
|
||||
imageId?: string;
|
||||
fileId?: string;
|
||||
}) {
|
||||
if (imageId == undefined) {
|
||||
if (fileId == undefined) {
|
||||
const updt = await prisma.job.update({
|
||||
where: {
|
||||
id: data.id,
|
||||
@@ -28,7 +25,7 @@ export async function job_EditById({
|
||||
});
|
||||
if (!updt) return { status: 400, message: "Gagal Update" };
|
||||
revalidatePath(RouterJob.status);
|
||||
|
||||
|
||||
return {
|
||||
status: 200,
|
||||
message: "Berhasil Update",
|
||||
@@ -42,7 +39,7 @@ export async function job_EditById({
|
||||
title: data.title,
|
||||
content: data.content,
|
||||
deskripsi: data.deskripsi,
|
||||
imageId: imageId,
|
||||
imageId: fileId,
|
||||
},
|
||||
});
|
||||
if (!updtWithFile) return { status: 400, message: "Gagal Update" };
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
|
||||
export async function job_getAllArsipById({page}: {page: number}) {
|
||||
|
||||
const authorId = await user_funGetOneUserId();
|
||||
export async function job_getAllArsipById({ page }: { page: number }) {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
@@ -17,7 +16,7 @@ export async function job_getAllArsipById({page}: {page: number}) {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
authorId: authorId,
|
||||
authorId: userLoginId,
|
||||
isArsip: true,
|
||||
isActive: true,
|
||||
},
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function job_getAllListPublish({
|
||||
page,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
|
||||
export default async function job_getAllStatusDraft({
|
||||
page,
|
||||
@@ -11,7 +11,8 @@ export default async function job_getAllStatusDraft({
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const data = await prisma.job.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
@@ -20,7 +21,7 @@ export default async function job_getAllStatusDraft({
|
||||
},
|
||||
where: {
|
||||
masterStatusId: "3",
|
||||
authorId: authorId,
|
||||
authorId: userLoginId,
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
|
||||
export default async function job_getAllStatusPublish({
|
||||
page,
|
||||
@@ -11,7 +11,8 @@ export default async function job_getAllStatusPublish({
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const data = await prisma.job.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
@@ -20,7 +21,7 @@ export default async function job_getAllStatusPublish({
|
||||
},
|
||||
where: {
|
||||
masterStatusId: "1",
|
||||
authorId: authorId,
|
||||
authorId: userLoginId,
|
||||
isActive: true,
|
||||
isArsip: false,
|
||||
},
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
|
||||
export default async function job_getAllStatusReject({
|
||||
page,
|
||||
}: {
|
||||
page: number;
|
||||
}) {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const data = await prisma.job.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
@@ -20,7 +20,7 @@ export default async function job_getAllStatusReject({
|
||||
},
|
||||
where: {
|
||||
masterStatusId: "4",
|
||||
authorId: authorId,
|
||||
authorId: userLoginId,
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
|
||||
export default async function job_getAllStatusReview({
|
||||
page,
|
||||
}: {
|
||||
page: number;
|
||||
}) {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const data = await prisma.job.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
@@ -20,7 +20,7 @@ export default async function job_getAllStatusReview({
|
||||
},
|
||||
where: {
|
||||
masterStatusId: "2",
|
||||
authorId: authorId,
|
||||
authorId: userLoginId,
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user