fix
Deskripsi: - Upload ke stroage untuk job ## Np Issuee
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { MODEL_COLLABORATION } from "../../model/interface";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
|
||||
import _ from "lodash";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { MODEL_COLLABORATION } from "../../model/interface";
|
||||
|
||||
export default async function colab_funCreateProyek(
|
||||
value: MODEL_COLLABORATION
|
||||
) {
|
||||
const AuthorId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const data = await prisma.projectCollaboration.create({
|
||||
data: {
|
||||
@@ -20,7 +19,7 @@ export default async function colab_funCreateProyek(
|
||||
benefit: value.benefit,
|
||||
projectCollaborationMaster_IndustriId:
|
||||
value.projectCollaborationMaster_IndustriId,
|
||||
userId: AuthorId,
|
||||
userId: userLoginId,
|
||||
// jumlah_partisipan: + value.jumlah_partisipan,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,25 +1,19 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { redirect } from "next/navigation";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
|
||||
export default async function colab_funCreateRoomChat(
|
||||
nameRoom: string,
|
||||
value: any[],
|
||||
colabId: string
|
||||
) {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
if (!authorId) {
|
||||
redirect(RouterAuth.login);
|
||||
// return { status: 400, message: "Gagal mendapatkan authorId" };
|
||||
}
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const createRoom = await prisma.projectCollaboration_RoomChat.create({
|
||||
data: {
|
||||
name: nameRoom,
|
||||
userId: authorId,
|
||||
userId: userLoginId,
|
||||
projectCollaborationId: colabId,
|
||||
},
|
||||
});
|
||||
@@ -57,7 +51,7 @@ export default async function colab_funCreateRoomChat(
|
||||
const createForAuthor =
|
||||
await prisma.projectCollaboration_AnggotaRoomChat.create({
|
||||
data: {
|
||||
userId: authorId,
|
||||
userId: userLoginId,
|
||||
projectCollaboration_RoomChatId: createRoom.id,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export default async function colab_funCreateMessageByUserId(
|
||||
message: string,
|
||||
roomId: string
|
||||
) {
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const msg = await prisma.projectCollaboration_Message.create({
|
||||
data: {
|
||||
userId: userLoginId,
|
||||
|
||||
@@ -1,20 +1,14 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { redirect } from "next/navigation";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
|
||||
export default async function colab_CekNotifikasi() {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
if (!authorId) {
|
||||
redirect(RouterAuth.login);
|
||||
// return { status: 400, message: "Gagal mendapatkan authorId" };
|
||||
}
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const cekNotif = await prisma.projectCollaboration_Notifikasi.findMany({
|
||||
where: {
|
||||
userId: authorId,
|
||||
userId: userLoginId,
|
||||
isRead: false,
|
||||
},
|
||||
select: {
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
"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 colab_funCekPartisipasiById(colabId: string) {
|
||||
const UserLoginId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const cek = await prisma.projectCollaboration_Partisipasi.findFirst({
|
||||
where: {
|
||||
projectCollaborationId: colabId,
|
||||
userId: UserLoginId,
|
||||
userId: userLoginId,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
if (cek === null) {
|
||||
return (false);
|
||||
return false;
|
||||
} else {
|
||||
return (true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
"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 colab_getListByStatusId(statusId: number) {
|
||||
const AuthorId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const data = await prisma.projectCollaboration.findMany({
|
||||
where: {
|
||||
userId: AuthorId,
|
||||
userId: userLoginId,
|
||||
projectCollaborationMaster_StatusId: statusId,
|
||||
},
|
||||
select: {
|
||||
|
||||
@@ -1,26 +1,20 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { redirect } from "next/navigation";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
|
||||
export default async function colab_getListNotifikasiByUserId() {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
if (!authorId) {
|
||||
redirect(RouterAuth.login);
|
||||
// return { status: 400, message: "Gagal mendapatkan authorId" };
|
||||
}
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const get = await prisma.projectCollaboration_Notifikasi.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
userId: authorId,
|
||||
userId: userLoginId,
|
||||
},
|
||||
select: {
|
||||
id:true,
|
||||
id: true,
|
||||
createdAt: true,
|
||||
isRead: true,
|
||||
note: true,
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"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 colab_getListPartisipasiProyekByAuthorId({
|
||||
page,
|
||||
}: {
|
||||
page: number;
|
||||
}) {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const takeData = 5;
|
||||
const skipData = page * takeData - takeData;
|
||||
@@ -20,7 +20,7 @@ export default async function colab_getListPartisipasiProyekByAuthorId({
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
userId: authorId,
|
||||
userId: userLoginId,
|
||||
isActive: true,
|
||||
AND: {
|
||||
ProjectCollaboration: {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"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 colab_getListAllProyekSayaByAuthorId({
|
||||
page,
|
||||
}: {
|
||||
page: number;
|
||||
}) {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const takeData = 5;
|
||||
const skipData = page * takeData - takeData;
|
||||
@@ -17,7 +17,7 @@ export default async function colab_getListAllProyekSayaByAuthorId({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: { createdAt: "desc" },
|
||||
where: { userId: authorId, isActive: true },
|
||||
where: { userId: userLoginId, isActive: true },
|
||||
select: {
|
||||
id: true,
|
||||
isActive: true,
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { redirect } from "next/navigation";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
|
||||
export default async function colab_getListRoomChatByAuthorId({
|
||||
page,
|
||||
}: {
|
||||
page: number;
|
||||
}) {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
if (!authorId) {
|
||||
redirect(RouterAuth.login);
|
||||
// return { status: 400, message: "Gagal mendapatkan authorId" };
|
||||
}
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
@@ -25,7 +20,7 @@ export default async function colab_getListRoomChatByAuthorId({
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
userId: authorId,
|
||||
userId: userLoginId,
|
||||
},
|
||||
select: {
|
||||
ProjectCollaboration_RoomChat: {
|
||||
|
||||
Reference in New Issue
Block a user