Compare commits

..

3 Commits

Author SHA1 Message Date
nabillah
3306078829 chore(release): 1.5.3 2025-10-16 17:48:34 +08:00
nabillah
48b6628eb4 API Mobile: Admin Job
Add:  src/app/api/mobile/admin/job/

### No Issue
2025-10-16 17:48:18 +08:00
nabillah
d0fa33badc Mobile API: Collaboration
Fix:
 - /api/mobile/admin/collaboration/[id]/route.ts
 - /api/mobile/admin/collaboration/route.ts

### No Issue
2025-10-16 14:51:53 +08:00
5 changed files with 178 additions and 5 deletions

View File

@@ -2,6 +2,8 @@
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
## [1.5.3](https://wibugit.wibudev.com/bip/hipmi/compare/v1.5.2...v1.5.3) (2025-10-16)
## [1.5.2](https://wibugit.wibudev.com/bip/hipmi/compare/v1.5.1...v1.5.2) (2025-10-15)
## [1.5.1](https://wibugit.wibudev.com/bip/hipmi/compare/v1.5.0...v1.5.1) (2025-10-14)

View File

@@ -1,6 +1,6 @@
{
"name": "hipmi",
"version": "1.5.2",
"version": "1.5.3",
"private": true,
"prisma": {
"seed": "bun prisma/seed.ts"

View File

@@ -1,7 +1,7 @@
import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
export { GET };
export { GET, PUT };
async function GET(request: Request, { params }: { params: { id: string } }) {
const { id } = params;
@@ -10,7 +10,7 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
let fixData;
try {
if (category === "publish") {
if (category === "publish" || category === "reject") {
fixData = await prisma.projectCollaboration.findUnique({
where: {
id: id,
@@ -53,6 +53,45 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
},
},
});
} else if (category === "group") {
fixData = await prisma.projectCollaboration_RoomChat.findUnique({
where: {
id: id,
},
select: {
id: true,
name: true,
ProjectCollaboration: {
select: {
id: true,
isActive: true,
title: true,
lokasi: true,
purpose: true,
benefit: true,
createdAt: true,
ProjectCollaborationMaster_Industri: true,
Author: true,
},
},
ProjectCollaboration_AnggotaRoomChat: {
select: {
User: {
select: {
username: true,
id: true,
Profile: {
select: {
id: true,
name: true,
},
},
},
},
},
},
},
});
}
return NextResponse.json(
@@ -74,3 +113,44 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
);
}
}
async function PUT(request: Request, { params }: { params: { id: string } }) {
const { id } = params;
const { data } = await request.json();
// const {searchParams} = new URL(request.url);
// const status = searchParams.get("status");
try {
const projectUpdate = await prisma.projectCollaboration.update({
where: {
id: id,
},
data: {
isActive: false,
isReject: true,
report: data,
},
select: {
userId: true,
},
});
return NextResponse.json(
{
success: true,
message: "Success update data collaboration",
// data: projectUpdate,
},
{ status: 200 }
);
} catch (error) {
return NextResponse.json(
{
success: false,
message: "Error update data collaboration",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}

View File

@@ -8,8 +8,6 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
const category = searchParams.get("category");
let fixData;
console.log(["CATEGORY", category]);
try {
if (category === "dashboard") {
const publish = await prisma.projectCollaboration.count({

View File

@@ -0,0 +1,93 @@
import _ from "lodash";
import { NextResponse } from "next/server";
import { prisma } from "@/lib";
export { GET };
async function GET(request: Request, { params }: { params: { name: string } }) {
const { searchParams } = new URL(request.url);
const category = searchParams.get("category");
const search = searchParams.get("search");
let fixData;
console.log("[CAT]", category);
try {
if (category === "dashboard") {
const publish = await prisma.job.count({
where: {
MasterStatus: {
name: "Publish",
},
isArsip: false,
},
});
const review = await prisma.job.count({
where: {
MasterStatus: {
name: "Review",
},
isArsip: false,
},
});
const reject = await prisma.job.count({
where: {
MasterStatus: {
name: "Reject",
},
isArsip: false,
},
});
fixData = {
publish,
review,
reject,
};
} else {
const fixToStatus = _.startCase(category || "");
fixData = await prisma.job.findMany({
orderBy: {
updatedAt: "desc",
},
where: {
isActive: true,
isArsip: false,
MasterStatus: {
name: fixToStatus,
},
title: {
contains: search ? search : "",
mode: "insensitive",
},
},
select: {
id: true,
title: true,
Author: true,
},
});
}
return NextResponse.json(
{
success: true,
message: "Success get data job-vacancy dashboard",
data: fixData,
},
{ status: 200 }
);
} catch (error) {
return NextResponse.json(
{
success: false,
message: "Error get data job-vacancy dashboard",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}