Merge pull request #98 from bipproduction/upload/profile
Upload/profile
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
"eslint": "8.45.0",
|
||||
"eslint-config-next": "13.4.12",
|
||||
"iron-session": "^6.3.1",
|
||||
"jose": "^5.9.2",
|
||||
"jotai": "^2.4.3",
|
||||
"lodash": "^4.17.21",
|
||||
"mapbox-gl": "^3.5.2",
|
||||
|
||||
@@ -60,14 +60,14 @@ model MasterUserRole {
|
||||
}
|
||||
|
||||
model UserSession {
|
||||
id String @id @default(cuid())
|
||||
id String @id @default(cuid())
|
||||
token String
|
||||
expires DateTime
|
||||
active Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
User User @relation(fields: [userId], references: [id])
|
||||
userId String @unique
|
||||
expires DateTime?
|
||||
active Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
User User @relation(fields: [userId], references: [id])
|
||||
userId String @unique
|
||||
}
|
||||
|
||||
model KodeOtp {
|
||||
@@ -147,6 +147,7 @@ model Portofolio {
|
||||
logoId String?
|
||||
Portofolio_MediaSosial Portofolio_MediaSosial?
|
||||
BusinessMaps BusinessMaps?
|
||||
imageId String?
|
||||
}
|
||||
|
||||
model Portofolio_MediaSosial {
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { myConsole } from "@/app/fun/my_console";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
|
||||
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { myConsole } from "@/app/fun/my_console";
|
||||
import { PwdCookies } from "@/app/lib";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ServerEnv } from "@/app/lib/server_env";
|
||||
import { sealData } from "iron-session";
|
||||
import { cookies } from "next/headers";
|
||||
import { NextResponse } from "next/server";
|
||||
@@ -16,8 +15,6 @@ export async function POST(req: Request) {
|
||||
},
|
||||
});
|
||||
|
||||
myConsole(cekUsername);
|
||||
|
||||
if (cekUsername)
|
||||
return NextResponse.json({ status: 400, message: "Username sudah ada" });
|
||||
|
||||
@@ -35,7 +32,7 @@ export async function POST(req: Request) {
|
||||
username: data.username,
|
||||
}),
|
||||
{
|
||||
password: PwdCookies,
|
||||
password: ServerEnv.value?.WIBU_PWD as string,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { myConsole } from "@/app/fun/my_console";
|
||||
import { PwdCookies } from "@/app/lib";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ServerEnv } from "@/app/lib/server_env";
|
||||
import { sealData } from "iron-session";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { cookies } from "next/headers";
|
||||
@@ -22,8 +21,6 @@ export async function POST(req: Request) {
|
||||
},
|
||||
});
|
||||
|
||||
myConsole(data);
|
||||
|
||||
if (!data) return NextResponse.json({ status: 404 });
|
||||
|
||||
if (data) {
|
||||
@@ -33,7 +30,7 @@ export async function POST(req: Request) {
|
||||
username: data.username,
|
||||
}),
|
||||
{
|
||||
password: await PwdCookies,
|
||||
password: ServerEnv.value?.WIBU_PWD as string,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -41,6 +38,7 @@ export async function POST(req: Request) {
|
||||
name: "ssn",
|
||||
value: res,
|
||||
maxAge: 60 * 60 * 24 * 7,
|
||||
|
||||
});
|
||||
|
||||
revalidatePath("/dev/home");
|
||||
|
||||
14
src/app/api/check-cookies/route.ts
Normal file
14
src/app/api/check-cookies/route.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import _ from "lodash";
|
||||
import { cookies } from "next/headers";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(req: Request) {
|
||||
const cekCookies = cookies();
|
||||
const c = cekCookies.get("ssn");
|
||||
|
||||
if (!c || !c?.value || _.isEmpty(c?.value) || _.isUndefined(c?.value)) {
|
||||
return NextResponse.json({ success: false });
|
||||
// return new Response(JSON.stringify({ success: false }));
|
||||
}
|
||||
return NextResponse.json({ success: true });
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import { AdminDonasi_TableReview } from "@/app_modules/admin/donasi";
|
||||
import adminDonasi_getListReview from "@/app_modules/admin/donasi/fun/get/get_list_review";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page() {
|
||||
const listReview = await adminDonasi_getListReview({page: 1});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { AdminLayout } from "@/app_modules/admin/main_dashboard";
|
||||
import adminNotifikasi_countNotifikasi from "@/app_modules/admin/notifikasi/fun/count/count_is_read";
|
||||
import adminNotifikasi_getByUserId from "@/app_modules/admin/notifikasi/fun/get/get_notifikasi_by_user_id";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import React from "react";
|
||||
|
||||
@@ -10,8 +10,9 @@ export default async function Layout({
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const userId = await user_funGetOneUserId();
|
||||
const dataUser = await user_getOneByUserId(userId);
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const dataUser = await user_getOneByUserId(userLoginId);
|
||||
const listNotif = await adminNotifikasi_getByUserId();
|
||||
const countNotifikasi = await adminNotifikasi_countNotifikasi();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Login } from "@/app_modules/auth";
|
||||
|
||||
export default function Page() {
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<Login />
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Register } from "@/app_modules/auth";
|
||||
import { auth_getKodeOtpById } from "@/app_modules/auth/fun/get_kode_otp_by_id";
|
||||
import { auth_getCodeOtpByNumber } from "@/app_modules/auth/fun/get_kode_otp_by_id";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let otpId = params.id
|
||||
const dataOtp = await auth_getKodeOtpById(otpId)
|
||||
let otpId = params.id;
|
||||
const dataOtp = await auth_getCodeOtpByNumber({ kodeId: otpId });
|
||||
return <Register dataOtp={dataOtp} />;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { SplashScreen } from "@/app_modules/auth";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global";
|
||||
|
||||
export default async function PageSplash() {
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { Validasi } from "@/app_modules/auth";
|
||||
import { auth_getKodeOtpById } from "@/app_modules/auth/fun/get_kode_otp_by_id";
|
||||
import { auth_getCodeOtpByNumber } from "@/app_modules/auth/fun/get_kode_otp_by_id";
|
||||
import { redirect } from "next/navigation";
|
||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let kodeOtpId = params.id;
|
||||
const dataOtp = await auth_getKodeOtpById(kodeOtpId);
|
||||
let kodeId = params.id;
|
||||
const dataOtp = await auth_getCodeOtpByNumber({ kodeId: kodeId });
|
||||
if (dataOtp === null) return redirect(RouterAuth.login);
|
||||
|
||||
return <Validasi dataOtp={dataOtp} />;
|
||||
}
|
||||
|
||||
5
src/app/dev/check-cookies/page.tsx
Normal file
5
src/app/dev/check-cookies/page.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { CheckCookies_UiView } from "@/app_modules/check_cookies";
|
||||
|
||||
export default function Page() {
|
||||
return <CheckCookies_UiView />;
|
||||
}
|
||||
@@ -1,16 +1,14 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import adminColab_getOneRoomChatById from "@/app_modules/admin/colab/fun/get/get_one_room_chat_by_id";
|
||||
import {
|
||||
Colab_DetailGrupDiskusi,
|
||||
Colab_GroupChatView,
|
||||
} from "@/app_modules/colab";
|
||||
import { Colab_GroupChatView } from "@/app_modules/colab";
|
||||
import colab_getMessageByRoomId from "@/app_modules/colab/fun/get/room_chat/get_message_by_room_id";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import _ from "lodash";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const roomId = params.id;
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const getData = (await adminColab_getOneRoomChatById({ roomId: roomId }))
|
||||
.data;
|
||||
const dataRoom = _.omit(getData, [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { LayoutColab_MainDetail } from "@/app_modules/colab";
|
||||
import colab_getOneCollaborationById from "@/app_modules/colab/fun/get/get_one_by_id";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import React from "react";
|
||||
|
||||
export default async function Layout({
|
||||
@@ -11,9 +11,10 @@ export default async function Layout({
|
||||
params: { id: string };
|
||||
}) {
|
||||
const colabId = params.id;
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const dataColab = await colab_getOneCollaborationById(colabId);
|
||||
const authorId = dataColab?.Author?.id;
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Colab_MainDetail } from "@/app_modules/colab";
|
||||
import colab_funCekPartisipasiById from "@/app_modules/colab/fun/get/cek_partisipasi_by_user_id";
|
||||
import colab_getListPartisipanByColabId from "@/app_modules/colab/fun/get/get_list_partisipan_by_id";
|
||||
import colab_getOneCollaborationById from "@/app_modules/colab/fun/get/get_one_by_id";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let colabId = params.id;
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const dataColab = await colab_getOneCollaborationById(colabId);
|
||||
const listPartisipan = await colab_getListPartisipanByColabId(colabId);
|
||||
const cekPartisipan = await colab_funCekPartisipasiById(colabId);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Colab_Beranda } from "@/app_modules/colab";
|
||||
import colab_getListAllProyek from "@/app_modules/colab/fun/get/get_list_all_proyek";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page() {
|
||||
const listData = await colab_getListAllProyek({page: 1});
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const listData = await colab_getListAllProyek({ page: 1 });
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { CreateCeritaPenggalangDonasi } from "@/app_modules/donasi";
|
||||
import { Donasi_getTemporaryCreate } from "@/app_modules/donasi/fun/get/get_temporary_create";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const getTemporaryCreate = await Donasi_getTemporaryCreate(params.id);
|
||||
const userId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
<CreateCeritaPenggalangDonasi
|
||||
dataTemporary={getTemporaryCreate as any}
|
||||
userId={userId}
|
||||
userId={userLoginId}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -3,7 +3,6 @@ import {
|
||||
Donasi_getMasterDurasi,
|
||||
Donasi_getMasterKategori,
|
||||
} from "@/app_modules/donasi/fun";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page() {
|
||||
const masterKategori = await Donasi_getMasterKategori();
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { DetailMainDonasi } from "@/app_modules/donasi";
|
||||
import { Donasi_getCountDonatur } from "@/app_modules/donasi/fun/count/get_count_donatur";
|
||||
import { Donasi_getOneById } from "@/app_modules/donasi/fun/get/get_one_donasi_by_id";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let donasiId = params.id;
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const dataDonasi = await Donasi_getOneById(donasiId);
|
||||
const countDonatur = await Donasi_getCountDonatur(donasiId)
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const countDonatur = await Donasi_getCountDonatur(donasiId);
|
||||
|
||||
return (
|
||||
<>
|
||||
<DetailMainDonasi dataDonasi={dataDonasi as any} countDonatur={countDonatur} userLoginId={userLoginId}/>
|
||||
<DetailMainDonasi
|
||||
dataDonasi={dataDonasi as any}
|
||||
countDonatur={countDonatur}
|
||||
userLoginId={userLoginId}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { DetailPublishDonasi } from "@/app_modules/donasi";
|
||||
import { Donasi_getCountDonatur } from "@/app_modules/donasi/fun/count/get_count_donatur";
|
||||
import { Donasi_getOneById } from "@/app_modules/donasi/fun/get/get_one_donasi_by_id";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const dataPublish = await Donasi_getOneById(params.id);
|
||||
const countDonatur= await Donasi_getCountDonatur(params.id)
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
|
||||
// console.log(userLoginId)
|
||||
const countDonatur = await Donasi_getCountDonatur(params.id);
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
<DetailPublishDonasi dataPublish={dataPublish as any} countDonatur={countDonatur} userLoginId={userLoginId}/>
|
||||
<DetailPublishDonasi
|
||||
dataPublish={dataPublish as any}
|
||||
countDonatur={countDonatur}
|
||||
userLoginId={userLoginId}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import { PostingDonasi } from "@/app_modules/donasi";
|
||||
import Donasi_getByStatus from "@/app_modules/donasi/fun/get/get_donasi_by_status";
|
||||
import { donasi_funGetAllStatusDraft } from "@/app_modules/donasi/fun/get/status/get_all_status_draft";
|
||||
import { donasi_funGetAllStatusPublish } from "@/app_modules/donasi/fun/get/status/get_all_status_publish";
|
||||
import { donasi_funGetAllStatusReject } from "@/app_modules/donasi/fun/get/status/get_all_status_reject";
|
||||
import { donasi_funGetAllStatusReview } from "@/app_modules/donasi/fun/get/status/get_all_status_review";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page() {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const listPublish = await donasi_funGetAllStatusPublish({page: 1});
|
||||
const listReview = await donasi_funGetAllStatusReview({page: 1});
|
||||
const listDraft = await donasi_funGetAllStatusDraft({page: 1});
|
||||
const listReject = await donasi_funGetAllStatusReject({page: 1});
|
||||
|
||||
|
||||
const listPublish = await donasi_funGetAllStatusPublish({ page: 1 });
|
||||
const listReview = await donasi_funGetAllStatusReview({ page: 1 });
|
||||
const listDraft = await donasi_funGetAllStatusDraft({ page: 1 });
|
||||
const listReject = await donasi_funGetAllStatusReject({ page: 1 });
|
||||
|
||||
return (
|
||||
<>
|
||||
<PostingDonasi listPublish={listPublish} listReview={listReview} listDraft={listDraft} listReject={listReject} />
|
||||
<PostingDonasi
|
||||
listPublish={listPublish}
|
||||
listReview={listReview}
|
||||
listDraft={listDraft}
|
||||
listReject={listReject}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { LayoutDonasi } from "@/app_modules/donasi";
|
||||
import { Donasi_getNotifByUserId } from "@/app_modules/donasi/fun/get/get_notif_by_user_id";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import React from "react";
|
||||
|
||||
export default async function Layout({
|
||||
@@ -8,16 +8,15 @@ export default async function Layout({
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const userId = await user_funGetOneUserId();
|
||||
// console.log(userId)
|
||||
const isRead = await Donasi_getNotifByUserId(userId).then((res: any) =>
|
||||
res.map((val: any) => val.isRead)
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const isRead = await Donasi_getNotifByUserId(userLoginId).then((res: any) =>
|
||||
res.map((val: any) => val.isRead)
|
||||
);
|
||||
// console.log(isRead)
|
||||
|
||||
return (
|
||||
<>
|
||||
<LayoutDonasi userId={userId} isRead={isRead as any}>
|
||||
<LayoutDonasi userId={userLoginId} isRead={isRead as any}>
|
||||
{children}
|
||||
</LayoutDonasi>
|
||||
</>
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Donasi_MetodePembayaran } from "@/app_modules/donasi";
|
||||
import { Donasi_getMasterBank } from "@/app_modules/donasi/fun/master/get_bank";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page({params}: {params: {id: string}}) {
|
||||
let donasiId= params.id
|
||||
const listBank = await Donasi_getMasterBank()
|
||||
const authorId = await user_funGetOneUserId()
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let donasiId = params.id;
|
||||
const listBank = await Donasi_getMasterBank();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return<>
|
||||
<Donasi_MetodePembayaran listBank={listBank} donasiId={donasiId} authorId={authorId}/>
|
||||
return (
|
||||
<>
|
||||
<Donasi_MetodePembayaran
|
||||
listBank={listBank}
|
||||
donasiId={donasiId}
|
||||
authorId={userLoginId}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Event_Create } from "@/app_modules/event";
|
||||
import { Event_getMasterTipeAcara } from "@/app_modules/event/fun/master/get_tipe_acara";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import _ from "lodash";
|
||||
|
||||
export default async function Page() {
|
||||
const userId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
const listTipeAcara = await Event_getMasterTipeAcara();
|
||||
|
||||
return (
|
||||
<Event_Create listTipeAcara={listTipeAcara as any} authorId={userId} />
|
||||
<Event_Create listTipeAcara={listTipeAcara as any} authorId={userLoginId} />
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Event_DetailMain } from "@/app_modules/event";
|
||||
import { Event_countTotalPesertaById } from "@/app_modules/event/fun/count/count_total_peserta_by_id";
|
||||
import { Event_CekUserJoinById } from "@/app_modules/event/fun/get/cek_user_join_by_id";
|
||||
import { Event_getListPesertaById } from "@/app_modules/event/fun/get/get_list_peserta_by_id";
|
||||
import { Event_getOneById } from "@/app_modules/event/fun/get/get_one_by_id";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let eventId = params.id;
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const dataEvent = await Event_getOneById(eventId);
|
||||
const listPeserta = await Event_getListPesertaById(eventId);
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const isJoin = await Event_CekUserJoinById(eventId, userLoginId);
|
||||
const totalPeserta = await Event_countTotalPesertaById(eventId)
|
||||
const totalPeserta = await Event_countTotalPesertaById(eventId);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
|
||||
import { Event_DetailRiwayat } from "@/app_modules/event";
|
||||
import { Event_countTotalPesertaById } from "@/app_modules/event/fun/count/count_total_peserta_by_id";
|
||||
import { Event_CekUserJoinById } from "@/app_modules/event/fun/get/cek_user_join_by_id";
|
||||
import { Event_getListPesertaById } from "@/app_modules/event/fun/get/get_list_peserta_by_id";
|
||||
import { Event_getOneById } from "@/app_modules/event/fun/get/get_one_by_id";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let eventId = params.id;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Event_Kontribusi } from "@/app_modules/event";
|
||||
import { event_getListKontibusiByUserId } from "@/app_modules/event/fun/get/get_list_kontribusi_by_user_id";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page() {
|
||||
const listKontribusi = await event_getListKontibusiByUserId({page: 1})
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Event_Riwayat } from "@/app_modules/event";
|
||||
import { event_getListRiwayatSaya } from "@/app_modules/event/fun/get/get_list_riwayat_saya";
|
||||
import { event_getListSemuaRiwayat } from "@/app_modules/event/fun/get/riwayat/get_list_semua_riwayat";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let eventId = params.id;
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Event_StatusPage } from "@/app_modules/event";
|
||||
import { event_getAllDraft } from "@/app_modules/event/fun/get/status/get_all_draft";
|
||||
import { event_getAllReject } from "@/app_modules/event/fun/get/status/get_all_reject";
|
||||
import { event_getAllReview } from "@/app_modules/event/fun/get/status/get_all_review";
|
||||
import { event_funGetAllStatusPublish } from "@/app_modules/event/fun/get/status/get_all_status_publish";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page() {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const listPublish = await event_funGetAllStatusPublish({ page: 1 });
|
||||
const listReview = await event_getAllReview({ page: 1 });
|
||||
const listDraft = await event_getAllDraft({ page: 1 });
|
||||
@@ -14,7 +15,7 @@ export default async function Page() {
|
||||
|
||||
return (
|
||||
<Event_StatusPage
|
||||
authorId={authorId}
|
||||
authorId={userLoginId}
|
||||
listPublish={listPublish}
|
||||
listReview={listReview}
|
||||
listDraft={listDraft}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import Forum_MainDetail from "@/app_modules/forum/detail/main_detail";
|
||||
import { forum_countTotalKomenById } from "@/app_modules/forum/fun/count/count_total_komentar_by_id";
|
||||
import { forum_funGetAllKomentarById } from "@/app_modules/forum/fun/get/get_all_komentar_by_id";
|
||||
import { forum_getOnePostingById } from "@/app_modules/forum/fun/get/get_one_posting_by_id";
|
||||
import { forum_countOneTotalKomentarById } from "@/app_modules/forum/fun/count/count_one_total_komentar_by_id";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
|
||||
import { redirect } from "next/navigation";
|
||||
import { forum_countTotalKomenById } from "@/app_modules/forum/fun/count/count_total_komentar_by_id";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let postingId = params.id;
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const dataPosting = await forum_getOnePostingById(postingId);
|
||||
const listKomentar = await forum_funGetAllKomentarById({
|
||||
postingId: postingId,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { LayoutForum_Forumku } from "@/app_modules/forum";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import React from "react";
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Forum_Forumku } from "@/app_modules/forum";
|
||||
import { forum_countPostingByAuthorId } from "@/app_modules/forum/fun/count/count_posting_by_author_id";
|
||||
import { forum_getAllPostingByAuhtorId } from "@/app_modules/forum/fun/get/get_list_posting_by_author_id";
|
||||
import { forum_countOneTotalKomentarById } from "@/app_modules/forum/fun/count/count_one_total_komentar_by_id";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import _ from "lodash";
|
||||
import { forum_countPostingByAuthorId } from "@/app_modules/forum/fun/count/count_posting_by_author_id";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const authorId = params.id;
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const dataAuthor = await user_getOneByUserId(authorId);
|
||||
const auhtorSelectedData = _.omit(dataAuthor, [
|
||||
"Profile.email",
|
||||
@@ -25,7 +25,10 @@ export default async function Page({ params }: { params: { id: string } }) {
|
||||
// setTimeout(a, 1000);
|
||||
// });
|
||||
|
||||
const dataPosting = await forum_getAllPostingByAuhtorId({authorId: authorId, page: 1});
|
||||
const dataPosting = await forum_getAllPostingByAuhtorId({
|
||||
authorId: authorId,
|
||||
page: 1,
|
||||
});
|
||||
const totalPosting = await forum_countPostingByAuthorId(authorId);
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Forum_Komentar } from "@/app_modules/forum";
|
||||
import { forum_getOnePostingById } from "@/app_modules/forum/fun/get/get_one_posting_by_id";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let postingId = params.id;
|
||||
const dataPosting = await forum_getOnePostingById(postingId);
|
||||
const userLoginId = await user_funGetOneUserId()
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { LayoutForum_Main } from "@/app_modules/forum";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import React from "react";
|
||||
|
||||
@@ -8,12 +8,14 @@ export default async function Layout({
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const dataAuthor = await user_getOneByUserId(authorId);
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
const dataAuthor = await user_getOneByUserId(userLoginId);
|
||||
|
||||
return (
|
||||
<>
|
||||
<LayoutForum_Main dataAuthor={dataAuthor as any}>{children}</LayoutForum_Main>
|
||||
<LayoutForum_Main dataAuthor={dataAuthor as any}>
|
||||
{children}
|
||||
</LayoutForum_Main>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Forum_Beranda } from "@/app_modules/forum";
|
||||
import { forum_new_getAllPosting } from "@/app_modules/forum/fun/get/new_get_all_posting";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page() {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
const listForum = await forum_new_getAllPosting({ page: 1 });
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
|
||||
// console.log(JSON.stringify(listForum, null, 2));
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Forum_ReportKomentarLainnya } from "@/app_modules/forum";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let komentarId = params.id;
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Forum_ReportKomentar } from "@/app_modules/forum";
|
||||
import { forum_getMasterKategoriReport } from "@/app_modules/forum/fun/master/get_master_kategori_report";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let komentarId = params.id;
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const listReport = await forum_getMasterKategoriReport();
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
|
||||
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Forum_ReportPostingLainnya } from "@/app_modules/forum";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let postingId = params.id;
|
||||
const userLoginId = await user_funGetOneUserId()
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Forum_ReportPosting } from "@/app_modules/forum";
|
||||
import { forum_getMasterKategoriReport } from "@/app_modules/forum/fun/master/get_master_kategori_report";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let postingId = params.id;
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const listReport = await forum_getMasterKategoriReport();
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
|
||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { HomeView } from "@/app_modules/home";
|
||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import { job_getTwoForHomeView } from "@/app_modules/job/fun/get/get_two_for_home_view";
|
||||
@@ -8,8 +8,9 @@ import notifikasi_countUserNotifikasi from "@/app_modules/notifikasi/fun/count/f
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default async function Page() {
|
||||
const userId = await user_funGetOneUserId();
|
||||
const dataUser = await user_getOneByUserId(userId);
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const dataUser = await user_getOneByUserId(userLoginId);
|
||||
const dataJob = await job_getTwoForHomeView();
|
||||
|
||||
if (dataUser?.active === false) {
|
||||
@@ -19,12 +20,6 @@ export default async function Page() {
|
||||
if (dataUser?.masterUserRoleId === "2" || dataUser?.masterUserRoleId === "3")
|
||||
return redirect(RouterAdminDashboard.splash_admin);
|
||||
|
||||
// if (dataUser?.Profile === null) return <ComponentGlobal_V2_LoadingPage />;
|
||||
|
||||
// await new Promise((a, b) => {
|
||||
// setTimeout(a, 3000);
|
||||
// });
|
||||
|
||||
const countNotifikasi = await notifikasi_countUserNotifikasi();
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
import { funGetUserProfile } from "@/app_modules/fun_global/get_user_profile";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { DetailInvestasi } from "@/app_modules/investasi";
|
||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import funProgressBar from "@/app_modules/investasi/fun/fun_progress_bar";
|
||||
import funTotalInvestorByIdInvestasi from "@/app_modules/investasi/fun/fun_total_investor_by_id";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const investasiId = params.id
|
||||
const investasiId = params.id;
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const dataInvestasi = await getOneInvestasiById(investasiId);
|
||||
const loginUserId = await user_funGetOneUserId();
|
||||
|
||||
return (
|
||||
<>
|
||||
<DetailInvestasi
|
||||
dataInvestasi={dataInvestasi as any}
|
||||
loginUserId={loginUserId}
|
||||
loginUserId={userLoginId}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,25 +1,12 @@
|
||||
import { PortofolioInvestasi } from "@/app_modules/investasi";
|
||||
import { cookies } from "next/headers";
|
||||
import fs from "fs";
|
||||
import yaml from "yaml";
|
||||
import { unsealData } from "iron-session";
|
||||
import getInvestasiByStatusId from "@/app_modules/investasi/fun/get_investasi_by_id";
|
||||
import getStatusInvestasi from "@/app_modules/investasi/fun/master/get_status_investasi";
|
||||
import getPortoByStatusId from "@/app_modules/investasi/fun/get_porto_status_by_id";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { Investasi_UiPortofolio } from "@/app_modules/investasi/_ui";
|
||||
import {
|
||||
investasi_funGetAllInvestasiNonPublishByUserId,
|
||||
investasi_funGetAllPublishByUserId,
|
||||
} from "@/app_modules/investasi/_fun";
|
||||
import { Investasi_UiPortofolio } from "@/app_modules/investasi/_ui";
|
||||
import getStatusInvestasi from "@/app_modules/investasi/fun/master/get_status_investasi";
|
||||
|
||||
export default async function Page() {
|
||||
const userId = await user_funGetOneUserId();
|
||||
const listStatus = await getStatusInvestasi();
|
||||
const dataDraft = await getPortoByStatusId(userId, 1);
|
||||
const dataReview = await getPortoByStatusId(userId, 2);
|
||||
const dataPublish = await getPortoByStatusId(userId, 3);
|
||||
const dataReject = await getPortoByStatusId(userId, 4);
|
||||
|
||||
const listDataPublish = await investasi_funGetAllPublishByUserId({ page: 1 });
|
||||
const listDataReview = await investasi_funGetAllInvestasiNonPublishByUserId({
|
||||
@@ -30,22 +17,13 @@ export default async function Page() {
|
||||
page: 1,
|
||||
statusId: "3",
|
||||
});
|
||||
const listDataReject = await investasi_funGetAllInvestasiNonPublishByUserId({
|
||||
page: 1,
|
||||
statusId: "4",
|
||||
});
|
||||
|
||||
|
||||
const listDataReject = await investasi_funGetAllInvestasiNonPublishByUserId({
|
||||
page: 1,
|
||||
statusId: "4",
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <PortofolioInvestasi
|
||||
listStatusInvestasi={listStatusInvestasi as any}
|
||||
dataDraft={dataDraft}
|
||||
dataReview={dataReview}
|
||||
dataPublish={dataPublish}
|
||||
dataReject={dataReject}
|
||||
/> */}
|
||||
<Investasi_UiPortofolio
|
||||
listStatus={listStatus}
|
||||
listDataPublish={listDataPublish}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import getListAllTransaksiById_Investasi from "@/app_modules/investasi/fun/get_list_all_transaksi_by_id";
|
||||
import getMaster_StatusTransaksiInvestasi from "@/app_modules/investasi/fun/master/get_status_transaksi";
|
||||
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { investasi_funGetTransaksiByUserId } from "@/app_modules/investasi/_fun";
|
||||
import { Investasi_UiDaftarTransaksi } from "@/app_modules/investasi/_ui";
|
||||
|
||||
export default async function Page() {
|
||||
const userId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const statusTransaksi = await getMaster_StatusTransaksiInvestasi();
|
||||
const listTransaksi = await getListAllTransaksiById_Investasi(userId);
|
||||
const listTransaksi = await getListAllTransaksiById_Investasi(userLoginId);
|
||||
|
||||
// NEW
|
||||
const dataTransaksi = await investasi_funGetTransaksiByUserId({ page: 1 });
|
||||
|
||||
@@ -2,10 +2,11 @@ import { MetodeTransferInvestasi } from "@/app_modules/investasi";
|
||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||
import getMaster_NamaBank from "@/app_modules/investasi/fun/master/get_nama_bank";
|
||||
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const dataInvestasi = await getOneInvestasiById(params.id);
|
||||
const namaBank = await getMaster_NamaBank();
|
||||
// console.log(namaBank)
|
||||
@@ -14,7 +15,7 @@ export default async function Page({ params }: { params: { id: string } }) {
|
||||
<MetodeTransferInvestasi
|
||||
dataInvestasi={dataInvestasi as any}
|
||||
namaBank={namaBank as any}
|
||||
authorId={authorId}
|
||||
authorId={userLoginId}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { funGetUserProfile } from "@/app_modules/fun_global/get_user_profile";
|
||||
import { ProsesTransaksiInvestasi } from "@/app_modules/investasi";
|
||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const userLogin = await funGetUserProfile(authorId);
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const userLogin = await funGetUserProfile(userLoginId);
|
||||
const dataInvestasi = await getOneInvestasiById(params.id);
|
||||
|
||||
// console.log(dataInvestasi);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { KatalogLayout } from "@/app_modules/katalog/main";
|
||||
import { Profile_getOneProfileAndUserById } from "@/app_modules/katalog/profile/fun/get/get_one_user_profile";
|
||||
|
||||
@@ -10,10 +10,10 @@ export default async function Layout({
|
||||
params: { id: string };
|
||||
}) {
|
||||
const profileId = params.id;
|
||||
const dataProfile = await Profile_getOneProfileAndUserById(profileId)
|
||||
const dataProfile = await Profile_getOneProfileAndUserById(profileId);
|
||||
const authorId = dataProfile?.userId;
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Katalog_MainView } from "@/app_modules/katalog";
|
||||
import { funGetListPortofolio } from "@/app_modules/katalog/portofolio/fun/get/get_list_portofolio";
|
||||
import { Profile_getOneProfileAndUserById } from "@/app_modules/katalog/profile/fun/get/get_one_user_profile";
|
||||
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let profileId = params.id;
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const listPorto = await funGetListPortofolio(profileId);
|
||||
const dataProfile = await Profile_getOneProfileAndUserById(profileId);
|
||||
|
||||
@@ -15,7 +15,7 @@ export default async function Page({ params }: { params: { id: string } }) {
|
||||
<Katalog_MainView
|
||||
profile={dataProfile as any}
|
||||
listPorto={listPorto as any}
|
||||
userLoginId={userLoginId}
|
||||
userLoginId={userLoginId as any}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
16
src/app/dev/layout.tsx
Normal file
16
src/app/dev/layout.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { funCheckToken } from "@/app_modules/_global/fun/get";
|
||||
import { redirect } from "next/navigation";
|
||||
import { RouterAuth } from "../lib/router_hipmi/router_auth";
|
||||
import { CheckCookies_UiLayout } from "@/app_modules/check_cookies";
|
||||
|
||||
export default async function Layout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<CheckCookies_UiLayout>{children}</CheckCookies_UiLayout>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { PortofolioLayout } from "@/app_modules/katalog/portofolio";
|
||||
import { portofolio_getOneById } from "@/app_modules/katalog/portofolio/fun/get/get_one_portofolio";
|
||||
|
||||
@@ -11,9 +11,8 @@ export default async function Layout({
|
||||
}) {
|
||||
let portoId = params.id;
|
||||
const getPorto = await portofolio_getOneById(portoId);
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
// console.log(userLoginId);
|
||||
// console.log(getPorto?.Profile?.User?.id);
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
<PortofolioLayout
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { ViewPortofolio } from "@/app_modules/katalog/portofolio";
|
||||
import { portofolio_getOneById } from "@/app_modules/katalog/portofolio/fun/get/get_one_portofolio";
|
||||
|
||||
const mapboxToken = process.env.MAPBOX_TOKEN!;
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const getPorto = await portofolio_getOneById(params.id);
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { CreateProfile } from "@/app_modules/katalog/profile";
|
||||
|
||||
export default async function Page() {
|
||||
const userId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
<CreateProfile userId={userId} />
|
||||
<CreateProfile userLoginId={userLoginId} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
|
||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Home_UserNonActive } from "@/app_modules/home";
|
||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default async function Page() {
|
||||
const userId = await user_funGetOneUserId();
|
||||
const dataUser = await user_getOneByUserId(userId);
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const dataUser = await user_getOneByUserId(userLoginId);
|
||||
|
||||
if (dataUser?.active === true) {
|
||||
return redirect(RouterHome.main_home);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { LayoutVote_DetailKontribusi } from "@/app_modules/vote";
|
||||
import React from "react";
|
||||
|
||||
@@ -10,7 +10,7 @@ export default async function Layout({
|
||||
params: { id: string };
|
||||
}) {
|
||||
const votingId = params.id;
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { LayoutVote_MainDetail } from "@/app_modules/vote";
|
||||
import React from "react";
|
||||
|
||||
@@ -10,7 +10,7 @@ export default async function Layout({
|
||||
params: { id: string };
|
||||
}) {
|
||||
const votingId = params.id;
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Vote_MainDetail } from "@/app_modules/vote";
|
||||
import { Vote_cekKontributorById } from "@/app_modules/vote/fun/get/cek_kontributor_by_id";
|
||||
import { voting_funGetOneVotingbyId } from "@/app_modules/vote/fun/get/fun_get_one_by_id";
|
||||
import { Vote_getHasilVoteById } from "@/app_modules/vote/fun/get/get_list_hasil_by_id";
|
||||
import { Vote_getListKontributorById } from "@/app_modules/vote/fun/get/get_list_kontributor_by_id";
|
||||
import { voting_funGetOneVotingbyId } from "@/app_modules/vote/fun/get/fun_get_one_by_id";
|
||||
import { Vote_getOnePilihanVotingByUserId } from "@/app_modules/vote/fun/get/get_one_pilihan_voting_by_user_id";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const voteId = params.id;
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const dataVote = await voting_funGetOneVotingbyId(voteId);
|
||||
const hasilVoting = await Vote_getHasilVoteById(voteId as any);
|
||||
const isKontributor = await Vote_cekKontributorById(voteId);
|
||||
const pilihanKontributor = await Vote_getOnePilihanVotingByUserId(voteId);
|
||||
const listKontributor = await Vote_getListKontributorById(voteId);
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { LayoutVote_DetailPublish } from "@/app_modules/vote";
|
||||
import { Voting_funGetOneVotingbyId } from "@/app_modules/vote/fun/get";
|
||||
import React from "react";
|
||||
@@ -11,17 +11,13 @@ export default async function Layout({
|
||||
params: { id: string };
|
||||
}) {
|
||||
const votingId = params.id;
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const dataVoting = await Voting_funGetOneVotingbyId(votingId);
|
||||
const authorId = dataVoting?.authorId;
|
||||
|
||||
return (
|
||||
<>
|
||||
<LayoutVote_DetailPublish
|
||||
votingId={votingId}
|
||||
userLoginId={userLoginId}
|
||||
>
|
||||
<LayoutVote_DetailPublish votingId={votingId} userLoginId={userLoginId}>
|
||||
{children}
|
||||
</LayoutVote_DetailPublish>
|
||||
</>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { CheckCookies_UiView } from "@/app_modules/check_cookies";
|
||||
import { LayoutVote_DetailSemuaRiwayat } from "@/app_modules/vote";
|
||||
import React from "react";
|
||||
|
||||
@@ -9,9 +10,10 @@ export default async function Layout({
|
||||
children: React.ReactNode;
|
||||
params: { id: string };
|
||||
}) {
|
||||
const votingId = params.id;
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const votingId = params.id;
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
if (!userLoginId) return <CheckCookies_UiView />;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
export function myConsole(value: any) {
|
||||
const onData = false
|
||||
if (onData) {
|
||||
console.log(value);
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,37 @@ import MqttLoader from "@/util/mqtt_loader";
|
||||
import RootStyleRegistry from "./emotion";
|
||||
import "./globals.css";
|
||||
import { TokenProvider } from "./lib/token";
|
||||
import dotenv from "dotenv";
|
||||
import { ServerEnv } from "./lib/server_env";
|
||||
dotenv.config({
|
||||
path: ".env",
|
||||
});
|
||||
|
||||
const token = process.env.WS_APIKEY;
|
||||
const pwdCookies = process.env.PWD;
|
||||
|
||||
const DATABASE_URL = process.env.DATABASE_URL!;
|
||||
const WIBU_PWD = process.env.WIBU_PWD!;
|
||||
const Client_KEY = process.env.Client_KEY!;
|
||||
const Server_KEY = process.env.Server_KEY!;
|
||||
const MAPBOX_TOKEN = process.env.MAPBOX_TOKEN!;
|
||||
const WS_APIKEY = process.env.WS_APIKEY!;
|
||||
|
||||
if (!DATABASE_URL) throw new Error("Require DATABASE_URL");
|
||||
if (!WIBU_PWD) throw new Error("Require PWD");
|
||||
if (!Client_KEY) throw new Error("Require Client_KEY");
|
||||
if (!Server_KEY) throw new Error("Require Server_KEY");
|
||||
if (!MAPBOX_TOKEN) throw new Error("Require MAPBOX_TOKEN");
|
||||
if (!WS_APIKEY) throw new Error("Require WS_APIKEY");
|
||||
|
||||
const envObject = {
|
||||
DATABASE_URL,
|
||||
WIBU_PWD,
|
||||
Client_KEY,
|
||||
Server_KEY,
|
||||
MAPBOX_TOKEN,
|
||||
WS_APIKEY,
|
||||
};
|
||||
ServerEnv.set(envObject);
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
@@ -12,11 +40,11 @@ export default function RootLayout({
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
if (!token) return <>Require Token Storage</>;
|
||||
console.log(pwdCookies)
|
||||
|
||||
return (
|
||||
<RootStyleRegistry>
|
||||
<MqttLoader />
|
||||
<TokenProvider token={token} />
|
||||
<TokenProvider token={token} envObject={envObject} />
|
||||
{children}
|
||||
</RootStyleRegistry>
|
||||
);
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import APIs from "./APIs";
|
||||
import DIRECTORY_ID from "./id-derectory";
|
||||
import prisma from "./prisma";
|
||||
import { PwdCookies } from "./pwd";
|
||||
|
||||
export { DIRECTORY_ID };
|
||||
export { prisma };
|
||||
export { APIs };
|
||||
export { PwdCookies };
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
import "dotenv/config";
|
||||
const dotenv = require("dotenv").config(".env");
|
||||
const PwdCookies = dotenv?.parsed.PWD;
|
||||
|
||||
export { PwdCookies };
|
||||
@@ -2,4 +2,5 @@ export const RouterAuth = {
|
||||
login: "/dev/auth/login",
|
||||
validasi: "/dev/auth/validasi/",
|
||||
register: "/dev/auth/register/",
|
||||
check_cookies: "/dev/check-cookies",
|
||||
};
|
||||
|
||||
15
src/app/lib/server_env.ts
Normal file
15
src/app/lib/server_env.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
type ENV = {
|
||||
DATABASE_URL: string;
|
||||
WIBU_PWD: string;
|
||||
Client_KEY: string;
|
||||
Server_KEY: string;
|
||||
MAPBOX_TOKEN: string;
|
||||
WS_APIKEY: string;
|
||||
};
|
||||
export class ServerEnv {
|
||||
static value: ENV | null = null;
|
||||
|
||||
static set(val: ENV) {
|
||||
ServerEnv.value = val;
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,31 @@ class TokenStorage {
|
||||
}
|
||||
}
|
||||
|
||||
function TokenProvider({ token }: { token: string }) {
|
||||
type ENV = {
|
||||
DATABASE_URL: string;
|
||||
WIBU_PWD: string;
|
||||
Client_KEY: string;
|
||||
Server_KEY: string;
|
||||
MAPBOX_TOKEN: string;
|
||||
WS_APIKEY: string;
|
||||
};
|
||||
export class GlobalEnv {
|
||||
static value: ENV | null = null;
|
||||
|
||||
static set(val: ENV) {
|
||||
GlobalEnv.value = val;
|
||||
}
|
||||
}
|
||||
|
||||
function TokenProvider({
|
||||
token,
|
||||
envObject,
|
||||
}: {
|
||||
token: string;
|
||||
envObject: ENV;
|
||||
}) {
|
||||
TokenStorage.set(token);
|
||||
GlobalEnv.set(envObject);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,51 +1,9 @@
|
||||
"use client";
|
||||
import Coba from "@/ui/Coba";
|
||||
import { useState } from "react";
|
||||
// Beda Package
|
||||
import InfiniteScroll from "react-infinite-scroll-component";
|
||||
import { ServerEnv } from "../lib/server_env";
|
||||
|
||||
export default function App() {
|
||||
const [data, setData] = useState<any[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
const ttlData = Array.from({ length: 21 });
|
||||
const [list, setList] = useState<any[]>(ttlData);
|
||||
|
||||
// useShallowEffect(() => {
|
||||
// setData(createItems());
|
||||
// }, []);
|
||||
|
||||
// const next = async (direction: ScrollDirection) => {
|
||||
// console.log("next", direction);
|
||||
// try {
|
||||
// setIsLoading(true);
|
||||
// const newData = await loadMore();
|
||||
|
||||
// const d = direction === "up" ? [...newData, ...data] : [];
|
||||
// setData(d);
|
||||
// } finally {
|
||||
// setIsLoading(false);
|
||||
// }
|
||||
// };
|
||||
|
||||
// const ref = useInfiniteScroll({
|
||||
// next,
|
||||
// rowCount: data.length,
|
||||
// hasMore: { up: true },
|
||||
// });
|
||||
|
||||
const fetchMoreData = () => {
|
||||
setTimeout(() => {
|
||||
setList(list.concat(Array.from({ length: 20 })));
|
||||
}, 100);
|
||||
};
|
||||
|
||||
const style = {
|
||||
height: 30,
|
||||
border: "1px solid green",
|
||||
margin: 6,
|
||||
padding: 8,
|
||||
};
|
||||
|
||||
return <></>;
|
||||
return (
|
||||
<div>
|
||||
<pre>{JSON.stringify(ServerEnv.value, null, 2)}</pre>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
24
src/app_modules/_global/component/comp_box_upload_image.tsx
Normal file
24
src/app_modules/_global/component/comp_box_upload_image.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { ComponentGlobal_CardStyles } from "@/app_modules/_global/component";
|
||||
import { Box } from "@mantine/core";
|
||||
|
||||
export function ComponentGlobal_BoxUploadImage({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<ComponentGlobal_CardStyles height={300}>
|
||||
<Box
|
||||
style={{
|
||||
height: "100%",
|
||||
borderStyle: "dashed",
|
||||
borderRadius: "5px",
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</Box>
|
||||
</ComponentGlobal_CardStyles>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import ComponentGlobal_BoxInformation from "./box_information";
|
||||
import ComponentGlobal_AvatarAndAuthorName from "./comp_author_name_and_avatar";
|
||||
import { ComponentGlobal_BoxUploadImage } from "./comp_box_upload_image";
|
||||
import { ComponentGlobal_CardStyles } from "./comp_card_box_and_background";
|
||||
import ComponentGlobal_CardLoadingOverlay from "./comp_loading_card";
|
||||
import ComponentGlobal_TampilanAngkaRatusan from "./comp_tampilan_angka_ratusan";
|
||||
@@ -13,3 +14,4 @@ export { ComponentGlobal_CardLoadingOverlay };
|
||||
export { ComponentGlobal_BoxInformation };
|
||||
export { ComponentGlobal_InputCountDown };
|
||||
export { ComponentGlobal_CardStyles };
|
||||
export { ComponentGlobal_BoxUploadImage };
|
||||
|
||||
17
src/app_modules/_global/fun/get/fun_cek_token.ts
Normal file
17
src/app_modules/_global/fun/get/fun_cek_token.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
"use server";
|
||||
|
||||
import { prisma } from "@/app/lib";
|
||||
import _ from "lodash";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
export async function funCheckToken() {
|
||||
const c = cookies().get("ssn");
|
||||
const cekToken = await prisma.userSession.findFirst({
|
||||
where: {
|
||||
token: c?.value,
|
||||
},
|
||||
});
|
||||
|
||||
if (cekToken === null) return false;
|
||||
return true;
|
||||
}
|
||||
18
src/app_modules/_global/fun/get/fun_get_user_id_by_token.ts
Normal file
18
src/app_modules/_global/fun/get/fun_get_user_id_by_token.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
"use server";
|
||||
|
||||
import { cookies } from "next/headers";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { redirect } from "next/navigation";
|
||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||
|
||||
export async function funGetUserIdByToken() {
|
||||
const c = cookies().get("ssn");
|
||||
const cekToken = await prisma.userSession.findFirst({
|
||||
where: {
|
||||
token: c?.value,
|
||||
},
|
||||
});
|
||||
|
||||
if (cekToken === null) return redirect(RouterAuth.login);
|
||||
return cekToken.userId;
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
import { funCheckToken } from "./fun_cek_token";
|
||||
import { funGlobal_getNomorAdmin } from "./fun_get_nomor_admin";
|
||||
import { funGetUserIdByToken } from "./fun_get_user_id_by_token";
|
||||
import { funGlobal_getMasterKategoriApp } from "./fun_master_kategori_app";
|
||||
|
||||
export { funGlobal_getMasterKategoriApp };
|
||||
export { funGlobal_getNomorAdmin };
|
||||
export { funCheckToken };
|
||||
export { funGetUserIdByToken };
|
||||
|
||||
@@ -28,7 +28,7 @@ export default function Admin_Logout() {
|
||||
const [loadingLogout, setLoadingLogout] = useState(false);
|
||||
|
||||
async function onClickLogout() {
|
||||
await auth_Logout(kodeId).then((res) => {
|
||||
await auth_Logout().then((res) => {
|
||||
if (res.status === 200) {
|
||||
setLoadingLogout(true);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterAdminColab } from "@/app/lib/router_admin/router_admin_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 adminColab_funReportProjectById({
|
||||
@@ -12,7 +12,7 @@ export default async function adminColab_funReportProjectById({
|
||||
colabId: string;
|
||||
report: string;
|
||||
}) {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const projectUpdate = await prisma.projectCollaboration.update({
|
||||
where: {
|
||||
@@ -33,7 +33,7 @@ export default async function adminColab_funReportProjectById({
|
||||
const updateReport = await prisma.projectCollaboration_Notifikasi.create({
|
||||
data: {
|
||||
projectCollaborationId: colabId,
|
||||
adminId: authorId,
|
||||
adminId: userLoginId,
|
||||
userId: projectUpdate.userId as any,
|
||||
note: "Project Anda Telah Direport Admin",
|
||||
},
|
||||
|
||||
@@ -353,6 +353,11 @@ async function onPublish({
|
||||
"USER",
|
||||
JSON.stringify({ userId: publish?.data?.authorId, count: 1 })
|
||||
);
|
||||
|
||||
mqtt_client.publish(
|
||||
"Job_new_post",
|
||||
JSON.stringify({ isNewPost: true, count: 1 })
|
||||
);
|
||||
}
|
||||
|
||||
ComponentGlobal_NotifikasiBerhasil(publish.message);
|
||||
|
||||
@@ -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 adminNotifikasi_countNotifikasi() {
|
||||
const adminId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const data = await prisma.notifikasi.findMany({
|
||||
where: {
|
||||
adminId: adminId,
|
||||
adminId: userLoginId,
|
||||
isRead: false,
|
||||
userRoleId: "2",
|
||||
},
|
||||
|
||||
@@ -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";
|
||||
import { MODEL_NOTIFIKASI } from "@/app_modules/notifikasi/model/interface";
|
||||
|
||||
export default async function adminNotifikasi_funCreateToUser({
|
||||
@@ -9,11 +9,11 @@ export default async function adminNotifikasi_funCreateToUser({
|
||||
}: {
|
||||
data: MODEL_NOTIFIKASI;
|
||||
}) {
|
||||
const adminId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const create = await prisma.notifikasi.create({
|
||||
data: {
|
||||
adminId: adminId,
|
||||
adminId: userLoginId,
|
||||
userId: data.userId,
|
||||
appId: data.appId,
|
||||
status: data.status,
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { NextRequest } from "next/server";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
|
||||
export default async function adminNotifikasi_getByUserId() {
|
||||
const adminId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const data = await prisma.notifikasi.findMany({
|
||||
orderBy: [
|
||||
@@ -17,7 +16,7 @@ export default async function adminNotifikasi_getByUserId() {
|
||||
},
|
||||
],
|
||||
where: {
|
||||
adminId: adminId,
|
||||
adminId: userLoginId,
|
||||
userRoleId: "2",
|
||||
},
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { randomOTP } from "./rondom_otp";
|
||||
|
||||
export async function auth_funLogin(nomor: string) {
|
||||
export async function auth_funLogin({ nomor }: { nomor: string }) {
|
||||
const codeOtp = randomOTP();
|
||||
// console.log(nomor)
|
||||
|
||||
@@ -17,7 +17,7 @@ export async function auth_funLogin(nomor: string) {
|
||||
|
||||
const sendWa = await res.json();
|
||||
if (sendWa.status !== "success")
|
||||
return { status: 400, message: "WA Tidak Terdaftar" };
|
||||
return { status: 400, message: "WA Tidak Terdaftar", kodeId: {} };
|
||||
|
||||
const createOtpId = await prisma.kodeOtp.create({
|
||||
data: {
|
||||
@@ -26,15 +26,16 @@ export async function auth_funLogin(nomor: string) {
|
||||
},
|
||||
});
|
||||
|
||||
if (!createOtpId) return { status: 400, message: "Gagal Membuat Kode OTP" };
|
||||
if (!createOtpId)
|
||||
return { status: 400, message: "Gagal Membuat Kode OTP", kodeId: {} };
|
||||
|
||||
return {
|
||||
status: 200,
|
||||
message: "Kode Verifikasi Dikirim",
|
||||
kodeOtpId: createOtpId.id,
|
||||
kodeId: createOtpId.id,
|
||||
};
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return { status: 500, message: "Server Error !!!" };
|
||||
return { status: 500, message: "Server Error !!!", kodeId: {} };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,32 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
export async function auth_Logout(kodeId: string) {
|
||||
cookies().set({
|
||||
name: "ssn",
|
||||
value: "",
|
||||
maxAge: 0,
|
||||
});
|
||||
|
||||
const c = cookies().get("ssn");
|
||||
if (c?.value !== "") return { status: 400, message: "Gagal Logout" };
|
||||
export async function auth_Logout() {
|
||||
const userId = await funGetUserIdByToken();
|
||||
|
||||
// const del = await prisma.kodeOtp.delete({
|
||||
// where: {
|
||||
// id: kodeId,
|
||||
// },
|
||||
// });
|
||||
// if (!del) return { status: 400, message: "Gagal Hapus Kode OTP Id"};
|
||||
// revalidatePath("/dev/katalog")
|
||||
try {
|
||||
const delToken = await prisma.userSession.delete({
|
||||
where: {
|
||||
userId: userId,
|
||||
},
|
||||
});
|
||||
|
||||
if (!delToken) return { status: 400, message: "Gagal Hapus User Session" };
|
||||
cookies().set({
|
||||
name: "ssn",
|
||||
value: "",
|
||||
|
||||
});
|
||||
|
||||
return { status: 200, message: "Logout Berhasil" };
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
revalidatePath("/");
|
||||
return { status: 200, message: "Logout Berhasil" };
|
||||
}
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
"use server";
|
||||
|
||||
import { PwdCookies } from "@/app/lib";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
import { sealData } from "iron-session";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
|
||||
export async function Auth_funRegister(data: any) {
|
||||
|
||||
export async function Auth_funRegister({
|
||||
data,
|
||||
HIPMI_PWD,
|
||||
}: {
|
||||
data: any;
|
||||
HIPMI_PWD: string;
|
||||
}) {
|
||||
const cekUsername = await prisma.user.findUnique({
|
||||
where: {
|
||||
username: data.username,
|
||||
@@ -28,21 +33,36 @@ export async function Auth_funRegister(data: any) {
|
||||
});
|
||||
if (!create) return { status: 400, message: "Gagal Mendaftar" };
|
||||
|
||||
const seal = await sealData(
|
||||
const sealToken = await sealData(
|
||||
JSON.stringify({
|
||||
id: create.id,
|
||||
username: create.username,
|
||||
}),
|
||||
{
|
||||
password: PwdCookies
|
||||
password: HIPMI_PWD,
|
||||
}
|
||||
);
|
||||
|
||||
cookies().set({
|
||||
name: "ssn",
|
||||
value: seal,
|
||||
maxAge: 60 * 60 * 24 * 7,
|
||||
value: sealToken,
|
||||
// maxAge: 60 * 60 * 24 * 7,
|
||||
});
|
||||
|
||||
try {
|
||||
const createUserSession = await prisma.userSession.create({
|
||||
data: {
|
||||
token: sealToken,
|
||||
userId: create.id,
|
||||
},
|
||||
});
|
||||
|
||||
if (!createUserSession)
|
||||
return { status: 401, message: "Gagal Membuat User Session" };
|
||||
|
||||
revalidatePath(RouterHome.main_home);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
return { status: 200, message: "Berhasil Mendaftar" };
|
||||
}
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { sealData } from "iron-session";
|
||||
import { cookies } from "next/headers";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
import { PwdCookies } from "@/app/lib";
|
||||
import { sealData, unsealData } from "iron-session";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
|
||||
export async function auth_funValidasi(nomor: string) {
|
||||
const cek = await prisma.user.findUnique({
|
||||
export async function auth_funValidasi({
|
||||
nomor,
|
||||
HIPMI_PWD,
|
||||
}: {
|
||||
nomor: string;
|
||||
HIPMI_PWD: string;
|
||||
}) {
|
||||
const cekUser = await prisma.user.findUnique({
|
||||
where: {
|
||||
nomor: nomor,
|
||||
},
|
||||
@@ -21,30 +25,58 @@ export async function auth_funValidasi(nomor: string) {
|
||||
},
|
||||
});
|
||||
|
||||
if (cek === null) return { status: 400, message: "Nomor Belum Terdaftar" };
|
||||
if (cek) {
|
||||
const res = await sealData(
|
||||
JSON.stringify({
|
||||
id: cek.id,
|
||||
username: cek.username,
|
||||
}),
|
||||
{
|
||||
password: PwdCookies,
|
||||
}
|
||||
);
|
||||
if (cekUser === null)
|
||||
return { status: 400, message: "Nomor Belum Terdaftar", role: {} };
|
||||
|
||||
cookies().set({
|
||||
name: "ssn",
|
||||
value: res,
|
||||
maxAge: 60 * 60 * 24 * 30,
|
||||
const sealToken = await sealData(
|
||||
JSON.stringify({
|
||||
id: cekUser.id,
|
||||
username: cekUser.username,
|
||||
}),
|
||||
{
|
||||
password: HIPMI_PWD,
|
||||
}
|
||||
);
|
||||
|
||||
cookies().set({
|
||||
name: "ssn",
|
||||
value: sealToken,
|
||||
maxAge: 60 * 60 * 24 * 30,
|
||||
});
|
||||
|
||||
const cekSessionUser = await prisma.userSession.findFirst({
|
||||
where: {
|
||||
userId: cekUser.id,
|
||||
},
|
||||
});
|
||||
|
||||
if (cekSessionUser !== null) {
|
||||
await prisma.userSession.delete({
|
||||
where: {
|
||||
userId: cekUser.id,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const createUserSession = await prisma.userSession.create({
|
||||
data: {
|
||||
token: sealToken,
|
||||
userId: cekUser.id,
|
||||
},
|
||||
});
|
||||
|
||||
if (!createUserSession)
|
||||
return { status: 401, message: "Gagal Membuat User Session", role: {} };
|
||||
|
||||
revalidatePath(RouterHome.main_home);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
return {
|
||||
status: 200,
|
||||
message: "Nomor Terverifikasi",
|
||||
role: cek.masterUserRoleId,
|
||||
role: cekUser.masterUserRoleId,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function auth_getKodeOtpById(otpId: string) {
|
||||
export async function auth_getCodeOtpByNumber({kodeId}: {kodeId: string}) {
|
||||
const data = await prisma.kodeOtp.findFirst({
|
||||
where: {
|
||||
id: otpId,
|
||||
id: kodeId,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ import {
|
||||
MainColor,
|
||||
} from "@/app_modules/_global/color/color_pallet";
|
||||
import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { auth_funLogin } from "@/app_modules/auth/fun/fun_login";
|
||||
import {
|
||||
BackgroundImage,
|
||||
@@ -17,37 +15,35 @@ import {
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useFocusTrap } from "@mantine/hooks";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { PhoneInput } from "react-international-phone";
|
||||
import "react-international-phone/style.css";
|
||||
import { gs_kodeId } from "../state/state";
|
||||
import {
|
||||
ComponentGlobal_NotifikasiBerhasil,
|
||||
ComponentGlobal_NotifikasiPeringatan,
|
||||
} from "@/app_modules/_global/notif_global";
|
||||
|
||||
export default function Login() {
|
||||
const router = useRouter();
|
||||
const [kodeId, setKodeId] = useAtom(gs_kodeId);
|
||||
const focusTrapRef = useFocusTrap();
|
||||
const [phone, setPhone] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [isError, setError] = useState(false);
|
||||
|
||||
async function onLogin() {
|
||||
const nomorHp = phone.substring(1);
|
||||
const nomor = phone.substring(1);
|
||||
if (nomor.length <= 4) return setError(true);
|
||||
|
||||
if (nomorHp.length <= 4) return setError(true);
|
||||
|
||||
await auth_funLogin(nomorHp).then((res) => {
|
||||
if (res.status === 200) {
|
||||
setLoading(true);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message, 2000);
|
||||
setKodeId(res.kodeOtpId);
|
||||
router.push(RouterAuth.validasi + res.kodeOtpId);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||
}
|
||||
});
|
||||
const res = await auth_funLogin({ nomor: nomor });
|
||||
if (res.status === 200) {
|
||||
setLoading(true);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message, 2000);
|
||||
router.push(RouterAuth.validasi + res.kodeId, { scroll: false });
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||
}
|
||||
|
||||
// await fetch(ApiHipmi.login, {
|
||||
// method: "POST",
|
||||
|
||||
@@ -4,33 +4,21 @@ import { Warna } from "@/app/lib/warna";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import UIGlobal_Modal from "@/app_modules/_global/ui/ui_modal";
|
||||
import {
|
||||
ActionIcon,
|
||||
Button,
|
||||
Stack,
|
||||
Text
|
||||
} from "@mantine/core";
|
||||
import { ActionIcon, Button, Stack, Text } from "@mantine/core";
|
||||
import { IconLogout } from "@tabler/icons-react";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { auth_Logout } from "../fun/fun_logout";
|
||||
import { gs_kodeId } from "../state/state";
|
||||
|
||||
export default function Component_Logout() {
|
||||
const router = useRouter();
|
||||
const [opened, setOpened] = useState(false);
|
||||
const [kodeId, setKodeId] = useAtom(gs_kodeId);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
async function onClickLogout() {
|
||||
// await auth_Logout(kodeId).then((res) => {
|
||||
// ComponentGlobal_NotifikasiBerhasil("Berhasil Logout");
|
||||
// });
|
||||
await auth_Logout(kodeId).then((res) => {
|
||||
await auth_Logout().then((res) => {
|
||||
if (res.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
setKodeId("");
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||
}
|
||||
|
||||
@@ -15,17 +15,16 @@ import {
|
||||
Stack,
|
||||
Text,
|
||||
TextInput,
|
||||
Title
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useFocusTrap } from "@mantine/hooks";
|
||||
import {
|
||||
IconUserCircle
|
||||
} from "@tabler/icons-react";
|
||||
import { IconUserCircle } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { auth_funDeleteAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id";
|
||||
import { Auth_funRegister } from "../fun/fun_register";
|
||||
import { GlobalEnv } from "@/app/lib/token";
|
||||
|
||||
export default function Register({ dataOtp }: { dataOtp: any }) {
|
||||
const router = useRouter();
|
||||
@@ -40,7 +39,6 @@ export default function Register({ dataOtp }: { dataOtp: any }) {
|
||||
username: value,
|
||||
nomor: nomor,
|
||||
};
|
||||
// console.log(body);
|
||||
|
||||
if (body.username === "") {
|
||||
setIsValue(true);
|
||||
@@ -49,7 +47,7 @@ export default function Register({ dataOtp }: { dataOtp: any }) {
|
||||
if (body.username.length < 5) return null;
|
||||
if (_.values(body.username).includes(" ")) return null;
|
||||
|
||||
const res = await Auth_funRegister(body)
|
||||
const res = await Auth_funRegister({data: body, HIPMI_PWD: GlobalEnv.value?.WIBU_PWD as string});
|
||||
if (res.status === 200) {
|
||||
await auth_funDeleteAktivasiKodeOtpById(dataOtp.id).then((val) => {
|
||||
if (val.status === 200) {
|
||||
@@ -67,16 +65,12 @@ export default function Register({ dataOtp }: { dataOtp: any }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <pre>{JSON.stringify(dataOtp,null,2)}</pre> */}
|
||||
<BackgroundImage
|
||||
src={"/aset/global/main_background.png"}
|
||||
h={"100vh"}
|
||||
// pos={"static"}
|
||||
>
|
||||
<BackgroundImage src={"/aset/global/main_background.png"} h={"100vh"}>
|
||||
<Center h={"100vh"}>
|
||||
<Stack h={"100%"} align="center" justify="center" spacing={70}>
|
||||
<Title order={2} c={MainColor.yellow}>
|
||||
REGISTRASI
|
||||
{GlobalEnv.value?.DATABASE_URL}
|
||||
</Title>
|
||||
|
||||
<IconUserCircle size={100} color="white" />
|
||||
|
||||
@@ -26,6 +26,7 @@ import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { auth_funDeleteAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id";
|
||||
import { auth_funValidasi } from "../fun/fun_validasi";
|
||||
import { GlobalEnv } from "@/app/lib/token";
|
||||
|
||||
export default function Validasi({ dataOtp }: { dataOtp: any }) {
|
||||
const router = useRouter();
|
||||
@@ -41,9 +42,11 @@ export default function Validasi({ dataOtp }: { dataOtp: any }) {
|
||||
if (code != inputCode)
|
||||
return ComponentGlobal_NotifikasiPeringatan("Kode Salah");
|
||||
|
||||
const res = await auth_funValidasi(nomor);
|
||||
const res = await auth_funValidasi({
|
||||
nomor: nomor,
|
||||
HIPMI_PWD: GlobalEnv.value?.WIBU_PWD as string,
|
||||
});
|
||||
if (res.status === 200) {
|
||||
|
||||
const resAktivasi = await auth_funDeleteAktivasiKodeOtpById(dataOtp.id);
|
||||
if (resAktivasi.status === 200) {
|
||||
if (res.role === "1") {
|
||||
@@ -51,16 +54,27 @@ export default function Validasi({ dataOtp }: { dataOtp: any }) {
|
||||
setLoading(true);
|
||||
router.push(RouterHome.main_home, { scroll: false });
|
||||
} else {
|
||||
router.push(RouterAdminDashboard.splash_admin);
|
||||
ComponentGlobal_NotifikasiBerhasil("Admin Logged in");
|
||||
setLoading(true);
|
||||
router.push(RouterAdminDashboard.splash_admin, { scroll: false });
|
||||
}
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(resAktivasi.message);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if (res.status === 400) {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
router.push(RouterAuth.register + dataOtp.id, { scroll: false });
|
||||
}
|
||||
|
||||
if (res.status === 401) {
|
||||
const resAktivasi = await auth_funDeleteAktivasiKodeOtpById(dataOtp.id);
|
||||
if (resAktivasi.status === 200) {
|
||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||
router.push(RouterAuth.login, { scroll: false });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
5
src/app_modules/check_cookies/index.ts
Normal file
5
src/app_modules/check_cookies/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { CheckCookies_UiLayout } from "./layout_cek_cookies";
|
||||
import { CheckCookies_UiView } from "./ui_check_cookies";
|
||||
|
||||
export { CheckCookies_UiView };
|
||||
export { CheckCookies_UiLayout };
|
||||
27
src/app_modules/check_cookies/layout_cek_cookies.tsx
Normal file
27
src/app_modules/check_cookies/layout_cek_cookies.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
"use client";
|
||||
|
||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export function CheckCookies_UiLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
|
||||
useShallowEffect(() => {
|
||||
onCheckCookies();
|
||||
}, []);
|
||||
|
||||
async function onCheckCookies() {
|
||||
const cek = await fetch("/api/check-cookies");
|
||||
const result = await cek.json();
|
||||
if (result.success === false) {
|
||||
router.push(RouterAuth.login);
|
||||
}
|
||||
}
|
||||
|
||||
return <>{children}</>;
|
||||
}
|
||||
23
src/app_modules/check_cookies/ui_check_cookies.tsx
Normal file
23
src/app_modules/check_cookies/ui_check_cookies.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
"use client";
|
||||
|
||||
import { Button, Center } from "@mantine/core";
|
||||
import { UIGlobal_LayoutTamplate } from "../_global/ui";
|
||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
|
||||
export function CheckCookies_UiView() {
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate>
|
||||
<Center h={"80vh"}>
|
||||
<Button radius={"xl"} onClick={() => router.push(RouterAuth.login)}>
|
||||
Kembali ke Halaman Login
|
||||
</Button>
|
||||
</Center>
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -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,19 +1,19 @@
|
||||
"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_funCreateRoomChat(
|
||||
nameRoom: string,
|
||||
value: any[],
|
||||
colabId: string
|
||||
) {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const createRoom = await prisma.projectCollaboration_RoomChat.create({
|
||||
data: {
|
||||
name: nameRoom,
|
||||
userId: authorId,
|
||||
userId: userLoginId,
|
||||
projectCollaborationId: colabId,
|
||||
},
|
||||
});
|
||||
@@ -51,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,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_CekNotifikasi() {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
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,20 +1,20 @@
|
||||
"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_getListNotifikasiByUserId() {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
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,10 +1,15 @@
|
||||
"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_getListRoomChatByAuthorId({
|
||||
page,
|
||||
}: {
|
||||
page: number;
|
||||
}) {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
export default async function colab_getListRoomChatByAuthorId({page}: {page: number}) {
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
@@ -36,5 +41,4 @@ export default async function colab_getListRoomChatByAuthorId({page}: {page: num
|
||||
// console.log(listRoom);
|
||||
|
||||
return listRoom;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
"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 donasi_funGetAllInvoiceByAuthorId({
|
||||
page,
|
||||
}: {
|
||||
page: number;
|
||||
}) {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const takeData = 5;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
@@ -19,7 +20,7 @@ export async function donasi_funGetAllInvoiceByAuthorId({
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
authorId: authorId,
|
||||
authorId: userLoginId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user