Merge pull request 'Mobile API' (#1) from mobile/14-aug-25 into staging
Reviewed-on: bip/hipmi#1
This commit is contained in:
15
.eslintrc.mjs
Normal file
15
.eslintrc.mjs
Normal file
@@ -0,0 +1,15 @@
|
||||
import { FlatCompat } from "@eslint/eslintrc";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname,
|
||||
});
|
||||
|
||||
const config = compat.extends("next/core-web-vitals", "next/typescript");
|
||||
console.log(config); // Cek output di terminal
|
||||
|
||||
export default Array.isArray(config) ? config : [config];
|
||||
33
.gitignore
vendored
33
.gitignore
vendored
@@ -21,21 +21,48 @@
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
|
||||
rn-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# local env files
|
||||
.env*.local
|
||||
|
||||
# build env files
|
||||
.env*.build
|
||||
|
||||
# env here
|
||||
.env
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# logs - mengabaikan isi logs tetapi menyimpan struktur folder
|
||||
logs/*
|
||||
!logs/.gitkeep
|
||||
!logs/backend/
|
||||
!logs/frontend/
|
||||
logs/backend/*
|
||||
!logs/backend/.gitkeep
|
||||
logs/frontend/*
|
||||
!logs/frontend/.gitkeep
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
|
||||
certificates
|
||||
# certificates
|
||||
certificates/
|
||||
**/certificates/
|
||||
*.cert
|
||||
*.key
|
||||
*.pem
|
||||
|
||||
# IDE and editor files
|
||||
.idea/
|
||||
.vscode/
|
||||
*.swp
|
||||
*.swo
|
||||
*.swn
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
.qodo
|
||||
|
||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"WillLuke.nextjs.addTypesOnSave": true,
|
||||
"WillLuke.nextjs.hasPrompted": true
|
||||
}
|
||||
423
CHANGELOG.md
423
CHANGELOG.md
@@ -2,6 +2,429 @@
|
||||
|
||||
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.4.28](https://github.com/bipproduction/hipmi/compare/v1.4.27...v1.4.28) (2025-06-16)
|
||||
|
||||
## [1.4.27](https://github.com/bipproduction/hipmi/compare/v1.4.26...v1.4.27) (2025-06-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* dynamic error ([86bfbcb](https://github.com/bipproduction/hipmi/commit/86bfbcb60e225adcba6504869cf8548370fc6750))
|
||||
|
||||
## [1.4.26](https://github.com/bipproduction/hipmi/compare/v1.4.25...v1.4.26) (2025-06-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* admin donasi ([6ccdbf9](https://github.com/bipproduction/hipmi/commit/6ccdbf9763c1ce8443a6a691b24817d6b80265c6))
|
||||
* super admin ([5bc70ba](https://github.com/bipproduction/hipmi/commit/5bc70baf96e792e1e1492027747f8352f2f80313))
|
||||
|
||||
## [1.4.25](https://github.com/bipproduction/hipmi/compare/v1.4.24...v1.4.25) (2025-06-12)
|
||||
|
||||
## [1.4.24](https://github.com/bipproduction/hipmi/compare/v1.4.23...v1.4.24) (2025-06-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* admin collaboration ([039ffc5](https://github.com/bipproduction/hipmi/commit/039ffc57b18d24968d854d06cd62fff13b769a6f))
|
||||
* admin forum ([aba2585](https://github.com/bipproduction/hipmi/commit/aba258517db277fd85d043c3aa4df279a5ec232d))
|
||||
* forum admin ([4b8316c](https://github.com/bipproduction/hipmi/commit/4b8316cc1311eb88840c029f1dfdb6a43e3a7f4f))
|
||||
|
||||
## [1.4.23](https://github.com/bipproduction/hipmi/compare/v1.4.22...v1.4.23) (2025-06-11)
|
||||
|
||||
## [1.4.22](https://github.com/bipproduction/hipmi/compare/v1.4.21...v1.4.22) (2025-06-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* donasi ([f2c6940](https://github.com/bipproduction/hipmi/commit/f2c694022e510ea99726cfffaf06b6cfffb808c1))
|
||||
* donasi ([1f1cca3](https://github.com/bipproduction/hipmi/commit/1f1cca3520ff22b878e945383a580b32a3054a3d))
|
||||
* donasi ([e94090e](https://github.com/bipproduction/hipmi/commit/e94090eb30c2f34af08816b3c4ad8ac4cbd360e8))
|
||||
* donasi ([bb65042](https://github.com/bipproduction/hipmi/commit/bb650429b323670c85adc582eda8ff522bd4dd60))
|
||||
* donasi ([886d9f3](https://github.com/bipproduction/hipmi/commit/886d9f37f4636576b8a89020537e13708f582431))
|
||||
|
||||
## [1.4.21](https://github.com/bipproduction/hipmi/compare/v1.4.20...v1.4.21) (2025-06-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* donasi ([709de95](https://github.com/bipproduction/hipmi/commit/709de95b10650ae1472b75d73bdd0bf20306633e))
|
||||
* donasi ([9c5f005](https://github.com/bipproduction/hipmi/commit/9c5f0053b6b834c67f170767e28dd9e04c5614a4))
|
||||
* donasi ([4fdfb6f](https://github.com/bipproduction/hipmi/commit/4fdfb6f4b0548d78a712443ac24e37e933665d41))
|
||||
* donasi ([1b23c50](https://github.com/bipproduction/hipmi/commit/1b23c50ff08f2bbb46ecfeec9d0c02c03f9230c1))
|
||||
* donasi ([0e4dda5](https://github.com/bipproduction/hipmi/commit/0e4dda5356df96f4dc749c5a7d5613e378eb6096))
|
||||
|
||||
## [1.4.20](https://github.com/bipproduction/hipmi/compare/v1.4.19...v1.4.20) (2025-06-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* investasi ([69c0abe](https://github.com/bipproduction/hipmi/commit/69c0abed75cb7b777c7072969e8826663dd32fdc))
|
||||
|
||||
## [1.4.19](https://github.com/bipproduction/hipmi/compare/v1.4.18...v1.4.19) (2025-06-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* forum ([0de70b0](https://github.com/bipproduction/hipmi/commit/0de70b038429a63be25b669ef6d8732e2312fd9d))
|
||||
* forum ([42cfe65](https://github.com/bipproduction/hipmi/commit/42cfe650b565c02eb7ebf639ecef41c188ad4449))
|
||||
* investasi ([7a95395](https://github.com/bipproduction/hipmi/commit/7a95395fe9861997527d76f08073db8de4ba48aa))
|
||||
* investasi: ([5c3fe55](https://github.com/bipproduction/hipmi/commit/5c3fe551aeb57bdd24ad616f9cbe37c2d417efca))
|
||||
|
||||
## [1.4.18](https://github.com/bipproduction/hipmi/compare/v1.4.17...v1.4.18) (2025-06-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* forum ([512d170](https://github.com/bipproduction/hipmi/commit/512d170c3e047848c9b26144533e50720e04950b))
|
||||
|
||||
## [1.4.17](https://github.com/bipproduction/hipmi/compare/v1.4.16...v1.4.17) (2025-06-02)
|
||||
|
||||
## [1.4.16](https://github.com/bipproduction/hipmi/compare/v1.4.15...v1.4.16) (2025-06-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* event ([6f686b6](https://github.com/bipproduction/hipmi/commit/6f686b6abf4ba6201df632938e4024004fe749b3))
|
||||
* voting ([c057f20](https://github.com/bipproduction/hipmi/commit/c057f20963df70f4ce2ac071007541678c6ff854))
|
||||
|
||||
## [1.4.15](https://github.com/bipproduction/hipmi/compare/v1.4.14...v1.4.15) (2025-05-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* collaboration ([5030253](https://github.com/bipproduction/hipmi/commit/5030253b07c1264229d066d18732d81e2636c5a6))
|
||||
* collaboration ([740ae44](https://github.com/bipproduction/hipmi/commit/740ae447340ce48d168e0e8e7c14079b3cf61817))
|
||||
|
||||
## [1.4.14](https://github.com/bipproduction/hipmi/compare/v1.4.13...v1.4.14) (2025-05-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* collaboration ([bdff760](https://github.com/bipproduction/hipmi/commit/bdff760f7021c624f8338da3af2d46c911b1dcff))
|
||||
|
||||
## [1.4.13](https://github.com/bipproduction/hipmi/compare/v1.4.12...v1.4.13) (2025-05-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* collaboration ([5007827](https://github.com/bipproduction/hipmi/commit/5007827d51117105b879bf18f06da60db8c48ff4))
|
||||
|
||||
## [1.4.12](https://github.com/bipproduction/hipmi/compare/v1.4.11...v1.4.12) (2025-05-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Map ([f23defd](https://github.com/bipproduction/hipmi/commit/f23defd972fbd276fee546677dc5e9565651b4f4))
|
||||
|
||||
## [1.4.11](https://github.com/bipproduction/hipmi/compare/v1.4.10...v1.4.11) (2025-05-26)
|
||||
|
||||
## [1.4.10](https://github.com/bipproduction/hipmi/compare/v1.4.9...v1.4.10) (2025-05-23)
|
||||
|
||||
## [1.4.9](https://github.com/bipproduction/hipmi/compare/v1.4.8...v1.4.9) (2025-05-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* nested layout ([c202cc8](https://github.com/bipproduction/hipmi/commit/c202cc8ea08ce8cdb351136a47c2afe10afb14c9))
|
||||
|
||||
## [1.4.8](https://github.com/bipproduction/hipmi/compare/v1.4.7...v1.4.8) (2025-05-22)
|
||||
|
||||
## [1.4.7](https://github.com/bipproduction/hipmi/compare/v1.4.6...v1.4.7) (2025-05-22)
|
||||
|
||||
## [1.4.6](https://github.com/bipproduction/hipmi/compare/v1.4.5...v1.4.6) (2025-05-21)
|
||||
|
||||
## [1.4.5](https://github.com/bipproduction/hipmi/compare/v1.4.4...v1.4.5) (2025-05-21)
|
||||
|
||||
## [1.4.4](https://github.com/bipproduction/hipmi/compare/v1.4.3...v1.4.4) (2025-05-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* button sticker ([3743008](https://github.com/bipproduction/hipmi/commit/37430081d8718b4b2b06f5c3c09f13935bf413c4))
|
||||
* event ([02bbdfd](https://github.com/bipproduction/hipmi/commit/02bbdfd5f6a2d299b8d527b9211f7b6ff598602f))
|
||||
|
||||
## [1.4.3](https://github.com/bipproduction/hipmi/compare/v1.4.2...v1.4.3) (2025-05-20)
|
||||
|
||||
## [1.4.2](https://github.com/bipproduction/hipmi/compare/v1.4.1...v1.4.2) (2025-05-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* admin app info ([117dbe6](https://github.com/bipproduction/hipmi/commit/117dbe6157fbb74d359db1c8baffe3c4985fab4a))
|
||||
* admin app info ([0cbcee8](https://github.com/bipproduction/hipmi/commit/0cbcee87bd52f6a7b596e260841deef9d4615016))
|
||||
|
||||
## [1.4.1](https://github.com/bipproduction/hipmi/compare/v1.4.0...v1.4.1) (2025-05-19)
|
||||
|
||||
## [1.4.0](https://github.com/bipproduction/hipmi/compare/v1.3.1...v1.4.0) (2025-05-16)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* admin sticker ([2a8c79f](https://github.com/bipproduction/hipmi/commit/2a8c79fd09c3f7fd7ee58ac6896b17802dfe0147))
|
||||
* admin stiker ([e7858a2](https://github.com/bipproduction/hipmi/commit/e7858a281223a81037219afec58e5f6b9e04be15))
|
||||
|
||||
## [1.3.1](https://github.com/bipproduction/hipmi/compare/v1.3.0...v1.3.1) (2025-05-16)
|
||||
|
||||
## [1.3.0](https://github.com/bipproduction/hipmi/compare/v1.2.126...v1.3.0) (2025-05-15)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* admin app information ([bc10b80](https://github.com/bipproduction/hipmi/commit/bc10b80139833966d3e39b52cabf577930552052))
|
||||
* tampilan upload stiker di admin ([fbea35e](https://github.com/bipproduction/hipmi/commit/fbea35eef96a656e1b474959aa3fb8198c7d2b0e))
|
||||
|
||||
## [1.2.126](https://github.com/bipproduction/hipmi/compare/v1.2.125...v1.2.126) (2025-05-13)
|
||||
|
||||
## [1.2.125](https://github.com/bipproduction/hipmi/compare/v1.2.124...v1.2.125) (2025-05-09)
|
||||
|
||||
## [1.2.124](https://github.com/bipproduction/hipmi/compare/v1.2.123...v1.2.124) (2025-05-08)
|
||||
|
||||
## [1.2.123](https://github.com/bipproduction/hipmi/compare/v1.2.122...v1.2.123) (2025-05-06)
|
||||
|
||||
## [1.2.122](https://github.com/bipproduction/hipmi/compare/v1.2.121...v1.2.122) (2025-05-06)
|
||||
|
||||
## [1.2.121](https://github.com/bipproduction/hipmi/compare/v1.2.120...v1.2.121) (2025-05-05)
|
||||
|
||||
## [1.2.120](https://github.com/bipproduction/hipmi/compare/v1.2.119...v1.2.120) (2025-05-05)
|
||||
|
||||
## [1.2.119](https://github.com/bipproduction/hipmi/compare/v1.2.118...v1.2.119) (2025-05-02)
|
||||
|
||||
## [1.2.118](https://github.com/bipproduction/hipmi/compare/v1.2.117...v1.2.118) (2025-04-30)
|
||||
|
||||
## [1.2.117](https://github.com/bipproduction/hipmi/compare/v1.2.116...v1.2.117) (2025-04-29)
|
||||
|
||||
## [1.2.116](https://github.com/bipproduction/hipmi/compare/v1.2.115...v1.2.116) (2025-04-28)
|
||||
|
||||
## [1.2.115](https://github.com/bipproduction/hipmi/compare/v1.2.114...v1.2.115) (2025-04-28)
|
||||
|
||||
## [1.2.114](https://github.com/bipproduction/hipmi/compare/v1.2.113...v1.2.114) (2025-04-23)
|
||||
|
||||
## [1.2.113](https://github.com/bipproduction/hipmi/compare/v1.2.112...v1.2.113) (2025-04-21)
|
||||
|
||||
## [1.2.112](https://github.com/bipproduction/hipmi/compare/v1.2.111...v1.2.112) (2025-04-17)
|
||||
|
||||
## [1.2.111](https://github.com/bipproduction/hipmi/compare/v1.2.110...v1.2.111) (2025-04-17)
|
||||
|
||||
## [1.2.110](https://github.com/bipproduction/hipmi/compare/v1.2.109...v1.2.110) (2025-04-16)
|
||||
|
||||
## [1.2.109](https://github.com/bipproduction/hipmi/compare/v1.2.108...v1.2.109) (2025-04-16)
|
||||
|
||||
## [1.2.108](https://github.com/bipproduction/hipmi/compare/v1.2.107...v1.2.108) (2025-04-14)
|
||||
|
||||
## [1.2.107](https://github.com/bipproduction/hipmi/compare/v1.2.106...v1.2.107) (2025-04-10)
|
||||
|
||||
## [1.2.106](https://github.com/bipproduction/hipmi/compare/v1.2.105...v1.2.106) (2025-04-09)
|
||||
|
||||
## [1.2.105](https://github.com/bipproduction/hipmi/compare/v1.2.104...v1.2.105) (2025-04-09)
|
||||
|
||||
## [1.2.104](https://github.com/bipproduction/hipmi/compare/v1.2.103...v1.2.104) (2025-04-09)
|
||||
|
||||
## [1.2.103](https://github.com/bipproduction/hipmi/compare/v1.2.102...v1.2.103) (2025-04-09)
|
||||
|
||||
## [1.2.102](https://github.com/bipproduction/hipmi/compare/v1.2.101...v1.2.102) (2025-04-08)
|
||||
|
||||
## [1.2.101](https://github.com/bipproduction/hipmi/compare/v1.2.100...v1.2.101) (2025-04-08)
|
||||
|
||||
## [1.2.100](https://github.com/bipproduction/hipmi/compare/v1.2.99...v1.2.100) (2025-04-08)
|
||||
|
||||
## [1.2.99](https://github.com/bipproduction/hipmi/compare/v1.2.98...v1.2.99) (2025-04-08)
|
||||
|
||||
## [1.2.98](https://github.com/bipproduction/hipmi/compare/v1.2.97...v1.2.98) (2025-04-08)
|
||||
|
||||
## [1.2.97](https://github.com/bipproduction/hipmi/compare/v1.2.96...v1.2.97) (2025-04-08)
|
||||
|
||||
## [1.2.96](https://github.com/bipproduction/hipmi/compare/v1.2.95...v1.2.96) (2025-04-08)
|
||||
|
||||
## [1.2.95](https://github.com/bipproduction/hipmi/compare/v1.2.94...v1.2.95) (2025-04-08)
|
||||
|
||||
## [1.2.94](https://github.com/bipproduction/hipmi/compare/v1.2.93...v1.2.94) (2025-04-08)
|
||||
|
||||
## [1.2.93](https://github.com/bipproduction/hipmi/compare/v1.2.92...v1.2.93) (2025-04-08)
|
||||
|
||||
## [1.2.92](https://github.com/bipproduction/hipmi/compare/v1.2.91...v1.2.92) (2025-04-08)
|
||||
|
||||
## [1.2.91](https://github.com/bipproduction/hipmi/compare/v1.2.90...v1.2.91) (2025-04-08)
|
||||
|
||||
## [1.2.90](https://github.com/bipproduction/hipmi/compare/v1.2.89...v1.2.90) (2025-04-07)
|
||||
|
||||
## [1.2.89](https://github.com/bipproduction/hipmi/compare/v1.2.88...v1.2.89) (2025-04-07)
|
||||
|
||||
## [1.2.88](https://github.com/bipproduction/hipmi/compare/v1.2.87...v1.2.88) (2025-04-07)
|
||||
|
||||
## [1.2.87](https://github.com/bipproduction/hipmi/compare/v1.2.86...v1.2.87) (2025-03-26)
|
||||
|
||||
## [1.2.86](https://github.com/bipproduction/hipmi/compare/v1.2.85...v1.2.86) (2025-03-25)
|
||||
|
||||
## [1.2.85](https://github.com/bipproduction/hipmi/compare/v1.2.84...v1.2.85) (2025-03-24)
|
||||
|
||||
## [1.2.84](https://github.com/bipproduction/hipmi/compare/v1.2.83...v1.2.84) (2025-03-21)
|
||||
|
||||
## [1.2.83](https://github.com/bipproduction/hipmi/compare/v1.2.82...v1.2.83) (2025-03-20)
|
||||
|
||||
## [1.2.82](https://github.com/bipproduction/hipmi/compare/v1.2.81...v1.2.82) (2025-03-19)
|
||||
|
||||
## [1.2.81](https://github.com/bipproduction/hipmi/compare/v1.2.80...v1.2.81) (2025-03-17)
|
||||
|
||||
## [1.2.80](https://github.com/bipproduction/hipmi/compare/v1.2.79...v1.2.80) (2025-03-14)
|
||||
|
||||
## [1.2.79](https://github.com/bipproduction/hipmi/compare/v1.2.78...v1.2.79) (2025-03-14)
|
||||
|
||||
## [1.2.78](https://github.com/bipproduction/hipmi/compare/v1.2.77...v1.2.78) (2025-03-12)
|
||||
|
||||
## [1.2.77](https://github.com/bipproduction/hipmi/compare/v1.2.76...v1.2.77) (2025-03-12)
|
||||
|
||||
## [1.2.76](https://github.com/bipproduction/hipmi/compare/v1.2.75...v1.2.76) (2025-03-12)
|
||||
|
||||
## [1.2.75](https://github.com/bipproduction/hipmi/compare/v1.2.74...v1.2.75) (2025-03-07)
|
||||
|
||||
## [1.2.74](https://github.com/bipproduction/hipmi/compare/v1.2.73...v1.2.74) (2025-03-07)
|
||||
|
||||
## [1.2.73](https://github.com/bipproduction/hipmi/compare/v1.2.72...v1.2.73) (2025-03-06)
|
||||
|
||||
## [1.2.72](https://github.com/bipproduction/hipmi/compare/v1.2.71...v1.2.72) (2025-03-05)
|
||||
|
||||
## [1.2.71](https://github.com/bipproduction/hipmi/compare/v1.2.70...v1.2.71) (2025-03-04)
|
||||
|
||||
## [1.2.70](https://github.com/bipproduction/hipmi/compare/v1.2.69...v1.2.70) (2025-03-04)
|
||||
|
||||
## [1.2.69](https://github.com/bipproduction/hipmi/compare/v1.2.68...v1.2.69) (2025-02-28)
|
||||
|
||||
## [1.2.68](https://github.com/bipproduction/hipmi/compare/v1.2.67...v1.2.68) (2025-02-28)
|
||||
|
||||
## [1.2.67](https://github.com/bipproduction/hipmi/compare/v1.2.66...v1.2.67) (2025-02-27)
|
||||
|
||||
## [1.2.66](https://github.com/bipproduction/hipmi/compare/v1.2.65...v1.2.66) (2025-02-27)
|
||||
|
||||
## [1.2.65](https://github.com/bipproduction/hipmi/compare/v1.2.64...v1.2.65) (2025-02-27)
|
||||
|
||||
## [1.2.64](https://github.com/bipproduction/hipmi/compare/v1.2.63...v1.2.64) (2025-02-26)
|
||||
|
||||
## [1.2.63](https://github.com/bipproduction/hipmi/compare/v1.2.62...v1.2.63) (2025-02-26)
|
||||
|
||||
## [1.2.62](https://github.com/bipproduction/hipmi/compare/v1.2.61...v1.2.62) (2025-02-25)
|
||||
|
||||
## [1.2.61](https://github.com/bipproduction/hipmi/compare/v1.2.60...v1.2.61) (2025-02-25)
|
||||
|
||||
## [1.2.60](https://github.com/bipproduction/hipmi/compare/v1.2.59...v1.2.60) (2025-02-25)
|
||||
|
||||
## [1.2.59](https://github.com/bipproduction/hipmi/compare/v1.2.58...v1.2.59) (2025-02-25)
|
||||
|
||||
## [1.2.58](https://github.com/bipproduction/hipmi/compare/v1.2.57...v1.2.58) (2025-02-25)
|
||||
|
||||
## [1.2.57](https://github.com/bipproduction/hipmi/compare/v1.2.56...v1.2.57) (2025-02-20)
|
||||
|
||||
## [1.2.56](https://github.com/bipproduction/hipmi/compare/v1.2.55...v1.2.56) (2025-02-19)
|
||||
|
||||
## [1.2.55](https://github.com/bipproduction/hipmi/compare/v1.2.54...v1.2.55) (2025-02-12)
|
||||
|
||||
## [1.2.54](https://github.com/bipproduction/hipmi/compare/v1.2.53...v1.2.54) (2025-02-12)
|
||||
|
||||
## [1.2.53](https://github.com/bipproduction/hipmi/compare/v1.2.52...v1.2.53) (2025-02-11)
|
||||
|
||||
## [1.2.52](https://github.com/bipproduction/hipmi/compare/v1.2.51...v1.2.52) (2025-02-10)
|
||||
|
||||
## [1.2.51](https://github.com/bipproduction/hipmi/compare/v1.2.50...v1.2.51) (2025-02-10)
|
||||
|
||||
## [1.2.50](https://github.com/bipproduction/hipmi/compare/v1.2.49...v1.2.50) (2025-02-10)
|
||||
|
||||
## [1.2.49](https://github.com/bipproduction/hipmi/compare/v1.2.48...v1.2.49) (2025-02-07)
|
||||
|
||||
## [1.2.48](https://github.com/bipproduction/hipmi/compare/v1.2.47...v1.2.48) (2025-02-07)
|
||||
|
||||
## [1.2.47](https://github.com/bipproduction/hipmi/compare/v1.2.46...v1.2.47) (2025-02-03)
|
||||
|
||||
## [1.2.46](https://github.com/bipproduction/hipmi/compare/v1.2.45...v1.2.46) (2025-02-03)
|
||||
|
||||
## [1.2.45](https://github.com/bipproduction/hipmi/compare/v1.2.44...v1.2.45) (2025-02-03)
|
||||
|
||||
## [1.2.44](https://github.com/bipproduction/hipmi/compare/v1.2.43...v1.2.44) (2025-02-03)
|
||||
|
||||
## [1.2.43](https://github.com/bipproduction/hipmi/compare/v1.2.42...v1.2.43) (2025-02-03)
|
||||
|
||||
## [1.2.42](https://github.com/bipproduction/hipmi/compare/v1.2.41...v1.2.42) (2025-01-30)
|
||||
|
||||
## [1.2.41](https://github.com/bipproduction/hipmi/compare/v1.2.40...v1.2.41) (2025-01-21)
|
||||
|
||||
## [1.2.40](https://github.com/bipproduction/hipmi/compare/v1.2.39...v1.2.40) (2025-01-16)
|
||||
|
||||
## [1.2.39](https://github.com/bipproduction/hipmi/compare/v1.2.38...v1.2.39) (2025-01-12)
|
||||
|
||||
## [1.2.38](https://github.com/bipproduction/hipmi/compare/v1.2.37...v1.2.38) (2025-01-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* user ([215accb](https://github.com/bipproduction/hipmi/commit/215accbcaa989e43f43dfc5f400d5411013f4ef3))
|
||||
|
||||
## [1.2.37](https://github.com/bipproduction/hipmi/compare/v1.2.36...v1.2.37) (2025-01-02)
|
||||
|
||||
## [1.2.36](https://github.com/bipproduction/hipmi/compare/v1.2.35...v1.2.36) (2024-12-30)
|
||||
|
||||
## [1.2.35](https://github.com/bipproduction/hipmi/compare/v1.2.34...v1.2.35) (2024-12-27)
|
||||
|
||||
## [1.2.34](https://github.com/bipproduction/hipmi/compare/v1.2.33...v1.2.34) (2024-12-24)
|
||||
|
||||
## [1.2.33](https://github.com/bipproduction/hipmi/compare/v1.2.32...v1.2.33) (2024-12-22)
|
||||
|
||||
## [1.2.32](https://github.com/bipproduction/hipmi/compare/v1.2.31...v1.2.32) (2024-12-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* donasi ([72b6d23](https://github.com/bipproduction/hipmi/commit/72b6d239fee3e90e812ab24192154e5e8910fccb))
|
||||
|
||||
## [1.2.31](https://github.com/bipproduction/hipmi/compare/v1.2.30...v1.2.31) (2024-12-17)
|
||||
|
||||
## [1.2.30](https://github.com/bipproduction/hipmi/compare/v1.2.29...v1.2.30) (2024-12-16)
|
||||
|
||||
## [1.2.29](https://github.com/bipproduction/hipmi/compare/v1.2.28...v1.2.29) (2024-12-13)
|
||||
|
||||
## [1.2.28](https://github.com/bipproduction/hipmi/compare/v1.2.27...v1.2.28) (2024-12-12)
|
||||
|
||||
## [1.2.27](https://github.com/bipproduction/hipmi/compare/v1.2.26...v1.2.27) (2024-12-12)
|
||||
|
||||
## [1.2.26](https://github.com/bipproduction/hipmi/compare/v1.2.25...v1.2.26) (2024-12-12)
|
||||
|
||||
## [1.2.25](https://github.com/bipproduction/hipmi/compare/v1.2.24...v1.2.25) (2024-12-12)
|
||||
|
||||
## [1.2.24](https://github.com/bipproduction/hipmi/compare/v1.2.23...v1.2.24) (2024-12-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* drawer katalog ([eab293d](https://github.com/bipproduction/hipmi/commit/eab293dd35a6f061cfa4675679de1ce68f506c3c))
|
||||
* loading button tambah portofolio ([8823a01](https://github.com/bipproduction/hipmi/commit/8823a01b067928cbeea195402f2bb454df8e8bea))
|
||||
* pencegahan error ([afe8014](https://github.com/bipproduction/hipmi/commit/afe8014cc8b4ab7266f3c52918a6bc82bb62bc58))
|
||||
|
||||
## [1.2.23](https://github.com/bipproduction/hipmi/compare/v1.2.22...v1.2.23) (2024-12-11)
|
||||
|
||||
## [1.2.22](https://github.com/bipproduction/hipmi/compare/v1.2.21...v1.2.22) (2024-12-10)
|
||||
|
||||
## [1.2.21](https://github.com/bipproduction/hipmi/compare/v1.2.20...v1.2.21) (2024-12-09)
|
||||
|
||||
## [1.2.20](https://github.com/bipproduction/hipmi/compare/v1.2.19...v1.2.20) (2024-12-09)
|
||||
|
||||
## [1.2.19](https://github.com/bipproduction/hipmi/compare/v1.2.18...v1.2.19) (2024-12-06)
|
||||
|
||||
## [1.2.18](https://github.com/bipproduction/hipmi/compare/v1.2.17...v1.2.18) (2024-12-04)
|
||||
|
||||
## [1.2.17](https://github.com/bipproduction/hipmi/compare/v1.2.16...v1.2.17) (2024-12-04)
|
||||
|
||||
## [1.2.16](https://github.com/bipproduction/hipmi/compare/v1.2.15...v1.2.16) (2024-12-03)
|
||||
|
||||
## [1.2.15](https://github.com/bipproduction/hipmi/compare/v1.2.14...v1.2.15) (2024-12-03)
|
||||
|
||||
## [1.2.14](https://github.com/bipproduction/hipmi/compare/v1.2.13...v1.2.14) (2024-12-03)
|
||||
|
||||
## [1.2.13](https://github.com/bipproduction/hipmi/compare/v1.2.12...v1.2.13) (2024-12-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* event ([fc38813](https://github.com/bipproduction/hipmi/commit/fc388133a638d4288314dd3faeddfcce61fe7292))
|
||||
* version 1.2.12 ([932735f](https://github.com/bipproduction/hipmi/commit/932735f9238db07b331b1b26328624247371c3d6))
|
||||
|
||||
## [1.2.12](https://github.com/bipproduction/hipmi/compare/v1.2.11...v1.2.12) (2024-12-02)
|
||||
|
||||
|
||||
|
||||
3399
backup.sql
Normal file
3399
backup.sql
Normal file
File diff suppressed because it is too large
Load Diff
3
build.wibu
Normal file
3
build.wibu
Normal file
@@ -0,0 +1,3 @@
|
||||
bun --env-file=.env.build prisma db push
|
||||
bun --env-file=.env.build prisma db seed
|
||||
bun --env-file=.env.build run build
|
||||
16
eslint.config.mjs.back.txt
Normal file
16
eslint.config.mjs.back.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
import { fileURLToPath } from "url";
|
||||
import { dirname } from "path"; // Pastikan `dirname` diimpor
|
||||
import { FlatCompat } from "@eslint/eslintrc";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname,
|
||||
});
|
||||
|
||||
const eslintConfig = [
|
||||
...compat.extends("next/core-web-vitals", "next/typescript"),
|
||||
];
|
||||
|
||||
export default eslintConfig;
|
||||
0
logs/.gitkeep
Normal file
0
logs/.gitkeep
Normal file
0
logs/backend/.gitkeep
Normal file
0
logs/backend/.gitkeep
Normal file
0
logs/frontend/.gitkeep
Normal file
0
logs/frontend/.gitkeep
Normal file
@@ -1,10 +1,27 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
reactStrictMode: false,
|
||||
experimental: {
|
||||
serverActions: true
|
||||
},
|
||||
|
||||
}
|
||||
reactStrictMode: false,
|
||||
experimental: {
|
||||
serverActions: true,
|
||||
},
|
||||
output: "standalone",
|
||||
staticPageGenerationTimeout: 180, // tingkatkan menjadi 3 menit
|
||||
eslint: {
|
||||
ignoreDuringBuilds: true,
|
||||
},
|
||||
// async headers() {
|
||||
// return [
|
||||
// {
|
||||
// source: "/(.*)",
|
||||
// headers: [
|
||||
// {
|
||||
// key: "Cache-Control",
|
||||
// value: "no-store, max-age=0",
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// ];
|
||||
// },
|
||||
};
|
||||
|
||||
module.exports = nextConfig
|
||||
module.exports = nextConfig;
|
||||
|
||||
46
package.json
46
package.json
@@ -1,15 +1,16 @@
|
||||
{
|
||||
"name": "hipmi",
|
||||
"version": "1.2.12",
|
||||
"version": "1.4.28",
|
||||
"private": true,
|
||||
"prisma": {
|
||||
"seed": "npx tsx prisma/seed.ts --yes"
|
||||
"seed": "bun prisma/seed.ts"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "bun --bun run next dev --experimental-https",
|
||||
"build": "bun --bun run next build",
|
||||
"start": "bun --bun run next start",
|
||||
"lint": "bun --bun run next lint",
|
||||
"scripts": {
|
||||
"dev": "next dev --experimental-https",
|
||||
"build": "next build",
|
||||
"build:dev": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"ver": "bunx commit-and-tag-version -- --prerelease"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -27,18 +28,20 @@
|
||||
"@mantine/next": "^6.0.17",
|
||||
"@mantine/notifications": "^6.0.17",
|
||||
"@mantine/tiptap": "^7.5.3",
|
||||
"@prisma/client": "^5.0.0",
|
||||
"@prisma/client": "^6.3.0",
|
||||
"@react-pdf/renderer": "^3.4.4",
|
||||
"@tabler/icons-react": "^2.38.0",
|
||||
"@tabler/icons-react": "^3.31.0",
|
||||
"@tiptap/extension-highlight": "^2.2.3",
|
||||
"@tiptap/extension-image": "^2.11.7",
|
||||
"@tiptap/extension-link": "^2.2.3",
|
||||
"@tiptap/extension-subscript": "^2.2.3",
|
||||
"@tiptap/extension-superscript": "^2.2.3",
|
||||
"@tiptap/extension-text-align": "^2.2.3",
|
||||
"@tiptap/extension-underline": "^2.2.3",
|
||||
"@tiptap/extension-underline": "^2.11.7",
|
||||
"@tiptap/pm": "^2.2.3",
|
||||
"@tiptap/react": "^2.2.3",
|
||||
"@tiptap/starter-kit": "^2.2.3",
|
||||
"@types/bun": "^1.1.14",
|
||||
"@types/lodash": "^4.17.4",
|
||||
"@types/mapbox-gl": "^3.4.0",
|
||||
"@types/node": "20.4.5",
|
||||
@@ -47,13 +50,15 @@
|
||||
"@types/uuid": "^9.0.4",
|
||||
"autoprefixer": "10.4.14",
|
||||
"bufferutil": "^4.0.8",
|
||||
"bun": "^1.1.38",
|
||||
"colors": "^1.4.0",
|
||||
"date-fns": "^4.1.0",
|
||||
"dayjs": "^1.11.10",
|
||||
"dotenv": "^16.4.5",
|
||||
"echarts": "^5.4.3",
|
||||
"echarts-for-react": "^3.0.2",
|
||||
"embla-carousel-react": "^8.0.0-rc14",
|
||||
"eslint": "8.45.0",
|
||||
"eslint-config-next": "13.4.12",
|
||||
"eslint-config-next": "^13.5.4",
|
||||
"iron-session": "^6.3.1",
|
||||
"jose": "^5.9.2",
|
||||
"jotai": "^2.4.3",
|
||||
@@ -62,18 +67,20 @@
|
||||
"midtrans-client": "^1.3.1",
|
||||
"moment": "^2.29.4",
|
||||
"mqtt": "^5.5.0",
|
||||
"next": "^13.5.4-canary.8",
|
||||
"next": "^13.5.4",
|
||||
"next-dev": "^1.1.9",
|
||||
"next-scroll-loader": "^1.0.9",
|
||||
"p-limit": "^6.2.0",
|
||||
"pdf-lib": "^1.17.1",
|
||||
"pdf2pic": "^3.1.3",
|
||||
"pdfjs-dist": "^4.6.82",
|
||||
"postcss": "8.4.27",
|
||||
"prisma": "^5.19.1",
|
||||
"prisma": "^6.3.0",
|
||||
"react": "18.2.0",
|
||||
"react-countdown": "^2.3.5",
|
||||
"react-dom": "18.2.0",
|
||||
"react-easy-infinite-scroll-hook": "^2.1.4",
|
||||
"react-fast-marquee": "^1.6.4",
|
||||
"react-icons": "^5.0.1",
|
||||
"react-iframe": "^1.8.5",
|
||||
"react-infinite-scroll-component": "^6.1.0",
|
||||
"react-international-phone": "^4.2.6",
|
||||
@@ -83,7 +90,9 @@
|
||||
"react-quill": "^2.0.0",
|
||||
"react-responsive-carousel": "^3.2.23",
|
||||
"react-toastify": "^9.1.3",
|
||||
"sharp": "^0.33.5",
|
||||
"socket.io-client": "^4.7.2",
|
||||
"swr": "^2.3.0",
|
||||
"tailwindcss": "3.3.3",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "5.1.6",
|
||||
@@ -92,6 +101,13 @@
|
||||
"wibu": "bipproduction/wibu",
|
||||
"wibu-cli": "^1.0.91",
|
||||
"wibu-pkg": "^1.0.3",
|
||||
"winston": "^3.17.0",
|
||||
"winston-daily-rotate-file": "^5.0.0",
|
||||
"yaml": "^2.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.56.0",
|
||||
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
||||
"@typescript-eslint/parser": "^7.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
198
prisma/migrations/20250108154615_new_database/migration.sql
Normal file
198
prisma/migrations/20250108154615_new_database/migration.sql
Normal file
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `imagesId` on the `Job` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `active` on the `MasterBank` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `name` on the `MasterBank` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `imagesBackgroundId` on the `Profile` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `imagesId` on the `Profile` table. All the data in the column will be lost.
|
||||
- You are about to drop the `ImagesBackground` table. If the table is not empty, all the data it contains will be lost.
|
||||
- Added the required column `namaAkun` to the `MasterBank` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `namaBank` to the `MasterBank` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Job" DROP CONSTRAINT "Job_imagesId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Notifikasi" DROP CONSTRAINT "NotifikasiAdmin";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Notifikasi" DROP CONSTRAINT "NotifikasiUser";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Portofolio" DROP CONSTRAINT "Portofolio_logoId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Profile" DROP CONSTRAINT "Profile_imagesBackgroundId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Profile" DROP CONSTRAINT "Profile_imagesId_fkey";
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "Profile_imagesBackgroundId_key";
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "Profile_imagesId_key";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "BeritaInvestasi" ADD COLUMN "imageId" TEXT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "DokumenInvestasi" ADD COLUMN "fileId" TEXT,
|
||||
ALTER COLUMN "url" DROP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Donasi" ADD COLUMN "imageId" TEXT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Donasi_Cerita" ADD COLUMN "imageId" TEXT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Donasi_Invoice" ADD COLUMN "imageId" TEXT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Donasi_Kabar" ADD COLUMN "imageId" TEXT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Donasi_PencairanDana" ADD COLUMN "imageId" TEXT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Donasi_TemporaryCreate" ADD COLUMN "imageId" TEXT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Event" ADD COLUMN "isArsip" BOOLEAN DEFAULT false,
|
||||
ADD COLUMN "tanggalSelesai" TIMESTAMP(3),
|
||||
ALTER COLUMN "tanggal" DROP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Event_Peserta" ADD COLUMN "isPresent" BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Investasi" ADD COLUMN "imageId" TEXT,
|
||||
ADD COLUMN "prospektusFileId" TEXT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Job" DROP COLUMN "imagesId",
|
||||
ADD COLUMN "imageId" TEXT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "MasterBank" DROP COLUMN "active",
|
||||
DROP COLUMN "name",
|
||||
ADD COLUMN "isActive" BOOLEAN NOT NULL DEFAULT true,
|
||||
ADD COLUMN "namaAkun" TEXT NOT NULL,
|
||||
ADD COLUMN "namaBank" TEXT NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Notifikasi" ALTER COLUMN "userId" DROP NOT NULL,
|
||||
ALTER COLUMN "adminId" DROP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Profile" DROP COLUMN "imagesBackgroundId",
|
||||
DROP COLUMN "imagesId",
|
||||
ADD COLUMN "imageBackgroundId" TEXT,
|
||||
ADD COLUMN "imageId" TEXT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "ProspektusInvestasi" ADD COLUMN "fileId" TEXT,
|
||||
ADD COLUMN "title" TEXT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ALTER COLUMN "active" SET DEFAULT false;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "UserSession" ALTER COLUMN "expires" DROP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Voting" ADD COLUMN "isArsip" BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "ImagesBackground";
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Investasi_Invoice" (
|
||||
"id" TEXT NOT NULL,
|
||||
"isActive" BOOLEAN NOT NULL DEFAULT true,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"nominal" TEXT NOT NULL,
|
||||
"lembarTerbeli" TEXT NOT NULL,
|
||||
"investasiId" TEXT,
|
||||
"masterBankId" TEXT,
|
||||
"statusInvoiceId" TEXT,
|
||||
"authorId" TEXT,
|
||||
"imagesId" TEXT,
|
||||
"imageId" TEXT,
|
||||
|
||||
CONSTRAINT "Investasi_Invoice_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "InvestasiMaster_StatusInvoice" (
|
||||
"id" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"isActive" BOOLEAN NOT NULL DEFAULT true,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "InvestasiMaster_StatusInvoice_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "BusinessMaps" (
|
||||
"id" TEXT NOT NULL,
|
||||
"isActive" BOOLEAN NOT NULL DEFAULT true,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"namePin" TEXT NOT NULL,
|
||||
"latitude" DOUBLE PRECISION NOT NULL,
|
||||
"longitude" DOUBLE PRECISION NOT NULL,
|
||||
"authorId" TEXT,
|
||||
"portofolioId" TEXT,
|
||||
"imageId" TEXT,
|
||||
"pinId" TEXT,
|
||||
|
||||
CONSTRAINT "BusinessMaps_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "MasterKategoriApp" (
|
||||
"id" TEXT NOT NULL,
|
||||
"isActive" BOOLEAN NOT NULL DEFAULT true,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"value" TEXT,
|
||||
|
||||
CONSTRAINT "MasterKategoriApp_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "BusinessMaps_portofolioId_key" ON "BusinessMaps"("portofolioId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Investasi_Invoice" ADD CONSTRAINT "Investasi_Invoice_investasiId_fkey" FOREIGN KEY ("investasiId") REFERENCES "Investasi"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Investasi_Invoice" ADD CONSTRAINT "Investasi_Invoice_masterBankId_fkey" FOREIGN KEY ("masterBankId") REFERENCES "MasterBank"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Investasi_Invoice" ADD CONSTRAINT "Investasi_Invoice_statusInvoiceId_fkey" FOREIGN KEY ("statusInvoiceId") REFERENCES "InvestasiMaster_StatusInvoice"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Investasi_Invoice" ADD CONSTRAINT "Investasi_Invoice_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Investasi_Invoice" ADD CONSTRAINT "Investasi_Invoice_imagesId_fkey" FOREIGN KEY ("imagesId") REFERENCES "Images"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Notifikasi" ADD CONSTRAINT "NotifikasiUser" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Notifikasi" ADD CONSTRAINT "NotifikasiAdmin" FOREIGN KEY ("adminId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BusinessMaps" ADD CONSTRAINT "BusinessMaps_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BusinessMaps" ADD CONSTRAINT "BusinessMaps_portofolioId_fkey" FOREIGN KEY ("portofolioId") REFERENCES "Portofolio"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,125 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "MasterBidangBisnis" ADD COLUMN "slug" TEXT NOT NULL DEFAULT 'NULL';
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Portofolio_BidangDanSubBidangBisnis" (
|
||||
"id" TEXT NOT NULL,
|
||||
"isActive" BOOLEAN NOT NULL DEFAULT true,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"portofolioId" TEXT,
|
||||
"masterBidangBisnisId" TEXT,
|
||||
"masterSubBidangBisnisId" TEXT,
|
||||
|
||||
CONSTRAINT "Portofolio_BidangDanSubBidangBisnis_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "MasterSubBidangBisnis" (
|
||||
"id" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"slug" TEXT NOT NULL DEFAULT 'NULL',
|
||||
"isActive" BOOLEAN NOT NULL DEFAULT true,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"masterBidangBisnisId" TEXT,
|
||||
|
||||
CONSTRAINT "MasterSubBidangBisnis_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "MasterStatusTransaksi" (
|
||||
"id" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"isActive" BOOLEAN NOT NULL DEFAULT true,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "MasterStatusTransaksi_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "MasterEmotions" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"label" TEXT NOT NULL,
|
||||
"value" TEXT NOT NULL,
|
||||
"isActive" BOOLEAN NOT NULL DEFAULT true,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "MasterEmotions_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "EventSponsor" (
|
||||
"id" TEXT NOT NULL,
|
||||
"isActive" BOOLEAN NOT NULL DEFAULT true,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"isTransfer" BOOLEAN DEFAULT false,
|
||||
"fileName" TEXT NOT NULL,
|
||||
"fileExt" TEXT,
|
||||
"fileId" TEXT NOT NULL,
|
||||
"authorId" TEXT,
|
||||
"eventId" TEXT,
|
||||
|
||||
CONSTRAINT "EventSponsor_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "EventTransaksi" (
|
||||
"id" TEXT NOT NULL,
|
||||
"isActive" BOOLEAN NOT NULL DEFAULT true,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"nominal" INTEGER NOT NULL,
|
||||
"status" TEXT NOT NULL,
|
||||
"transferImageId" TEXT,
|
||||
"masterBankId" TEXT,
|
||||
"authorId" TEXT,
|
||||
"eventId" TEXT,
|
||||
"eventSponsorId" TEXT,
|
||||
"masterStatusTransaksiId" TEXT,
|
||||
|
||||
CONSTRAINT "EventTransaksi_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "MasterEmotions_value_key" ON "MasterEmotions"("value");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "EventTransaksi_eventSponsorId_key" ON "EventTransaksi"("eventSponsorId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Portofolio_BidangDanSubBidangBisnis" ADD CONSTRAINT "Portofolio_BidangDanSubBidangBisnis_portofolioId_fkey" FOREIGN KEY ("portofolioId") REFERENCES "Portofolio"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Portofolio_BidangDanSubBidangBisnis" ADD CONSTRAINT "Portofolio_BidangDanSubBidangBisnis_masterBidangBisnisId_fkey" FOREIGN KEY ("masterBidangBisnisId") REFERENCES "MasterBidangBisnis"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Portofolio_BidangDanSubBidangBisnis" ADD CONSTRAINT "Portofolio_BidangDanSubBidangBisnis_masterSubBidangBisnisI_fkey" FOREIGN KEY ("masterSubBidangBisnisId") REFERENCES "MasterSubBidangBisnis"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "MasterSubBidangBisnis" ADD CONSTRAINT "MasterSubBidangBisnis_masterBidangBisnisId_fkey" FOREIGN KEY ("masterBidangBisnisId") REFERENCES "MasterBidangBisnis"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "EventSponsor" ADD CONSTRAINT "EventSponsor_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "EventSponsor" ADD CONSTRAINT "EventSponsor_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "Event"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "EventTransaksi" ADD CONSTRAINT "EventTransaksi_masterBankId_fkey" FOREIGN KEY ("masterBankId") REFERENCES "MasterBank"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "EventTransaksi" ADD CONSTRAINT "EventTransaksi_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "EventTransaksi" ADD CONSTRAINT "EventTransaksi_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "Event"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "EventTransaksi" ADD CONSTRAINT "EventTransaksi_eventSponsorId_fkey" FOREIGN KEY ("eventSponsorId") REFERENCES "EventSponsor"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "EventTransaksi" ADD CONSTRAINT "EventTransaksi_masterStatusTransaksiId_fkey" FOREIGN KEY ("masterStatusTransaksiId") REFERENCES "MasterStatusTransaksi"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
30
prisma/migrations/20250515060811_relasi/migration.sql
Normal file
30
prisma/migrations/20250515060811_relasi/migration.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "Stiker" (
|
||||
"id" TEXT NOT NULL,
|
||||
"isActive" BOOLEAN NOT NULL DEFAULT true,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"name" TEXT,
|
||||
"fileName" TEXT,
|
||||
"fileExt" TEXT,
|
||||
"fileId" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "Stiker_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "_StikerEmotions" (
|
||||
"A" INTEGER NOT NULL,
|
||||
"B" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "_StikerEmotions_AB_pkey" PRIMARY KEY ("A","B")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "_StikerEmotions_B_index" ON "_StikerEmotions"("B");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_StikerEmotions" ADD CONSTRAINT "_StikerEmotions_A_fkey" FOREIGN KEY ("A") REFERENCES "MasterEmotions"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_StikerEmotions" ADD CONSTRAINT "_StikerEmotions_B_fkey" FOREIGN KEY ("B") REFERENCES "Stiker"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
28
prisma/migrations/20250515062136_ganti/migration.sql
Normal file
28
prisma/migrations/20250515062136_ganti/migration.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the `Stiker` table. If the table is not empty, all the data it contains will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "_StikerEmotions" DROP CONSTRAINT "_StikerEmotions_B_fkey";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Stiker";
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Sticker" (
|
||||
"id" TEXT NOT NULL,
|
||||
"isActive" BOOLEAN NOT NULL DEFAULT true,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"name" TEXT,
|
||||
"fileName" TEXT,
|
||||
"fileExt" TEXT,
|
||||
"fileId" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "Sticker_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_StikerEmotions" ADD CONSTRAINT "_StikerEmotions_B_fkey" FOREIGN KEY ("B") REFERENCES "Sticker"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -1,3 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (i.e. Git)
|
||||
# It should be added in your version-control system (e.g., Git)
|
||||
provider = "postgresql"
|
||||
@@ -2,8 +2,9 @@
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
engineType = "binary"
|
||||
provider = "prisma-client-js"
|
||||
engineType = "binary"
|
||||
binaryTargets = ["native"]
|
||||
}
|
||||
|
||||
datasource db {
|
||||
@@ -47,6 +48,9 @@ model User {
|
||||
User_Notifikasi Notifikasi[] @relation("UserNotifikasi")
|
||||
BusinessMaps BusinessMaps[]
|
||||
Investasi_Invoice Investasi_Invoice[]
|
||||
|
||||
EventSponsor EventSponsor[]
|
||||
EventTransaksi EventTransaksi[]
|
||||
}
|
||||
|
||||
model MasterUserRole {
|
||||
@@ -125,11 +129,13 @@ model Portofolio {
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
Profile Profile? @relation(fields: [profileId], references: [id])
|
||||
profileId String?
|
||||
MasterBidangBisnis MasterBidangBisnis @relation(fields: [masterBidangBisnisId], references: [id])
|
||||
masterBidangBisnisId String
|
||||
Portofolio_MediaSosial Portofolio_MediaSosial?
|
||||
BusinessMaps BusinessMaps?
|
||||
logoId String?
|
||||
|
||||
MasterBidangBisnis MasterBidangBisnis @relation(fields: [masterBidangBisnisId], references: [id])
|
||||
masterBidangBisnisId String
|
||||
Portofolio_BidangDanSubBidangBisnis Portofolio_BidangDanSubBidangBisnis[]
|
||||
}
|
||||
|
||||
model Portofolio_MediaSosial {
|
||||
@@ -146,17 +152,46 @@ model Portofolio_MediaSosial {
|
||||
portofolioId String? @unique
|
||||
}
|
||||
|
||||
model MasterBidangBisnis {
|
||||
id String @id
|
||||
name String
|
||||
active Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
Portofolio Portofolio[]
|
||||
model Portofolio_BidangDanSubBidangBisnis {
|
||||
id String @id @default(cuid())
|
||||
isActive Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
Portofolio Portofolio? @relation(fields: [portofolioId], references: [id])
|
||||
portofolioId String?
|
||||
MasterBidangBisnis MasterBidangBisnis? @relation(fields: [masterBidangBisnisId], references: [id])
|
||||
masterBidangBisnisId String?
|
||||
MasterSubBidangBisnis MasterSubBidangBisnis? @relation(fields: [masterSubBidangBisnisId], references: [id])
|
||||
masterSubBidangBisnisId String?
|
||||
}
|
||||
|
||||
// ------------------- MASTER -------------------------- //
|
||||
|
||||
model MasterBidangBisnis {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
slug String @default("NULL")
|
||||
active Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
Portofolio Portofolio[]
|
||||
MasterSubBidangBisnis MasterSubBidangBisnis[]
|
||||
Portofolio_BidangDanSubBidangBisnis Portofolio_BidangDanSubBidangBisnis[]
|
||||
}
|
||||
|
||||
model MasterSubBidangBisnis {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
slug String @default("NULL")
|
||||
isActive Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
MasterBidangBisnis MasterBidangBisnis? @relation(fields: [masterBidangBisnisId], references: [id])
|
||||
masterBidangBisnisId String?
|
||||
Portofolio_BidangDanSubBidangBisnis Portofolio_BidangDanSubBidangBisnis[]
|
||||
}
|
||||
|
||||
model MasterBank {
|
||||
id String @id @default(cuid())
|
||||
namaBank String
|
||||
@@ -166,6 +201,7 @@ model MasterBank {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
Investasi_Invoice Investasi_Invoice[]
|
||||
EventTransaksi EventTransaksi[]
|
||||
}
|
||||
|
||||
model MasterStatus {
|
||||
@@ -177,6 +213,25 @@ model MasterStatus {
|
||||
Job Job[]
|
||||
}
|
||||
|
||||
model MasterStatusTransaksi {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
isActive Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
EventTransaksi EventTransaksi[]
|
||||
}
|
||||
|
||||
model MasterEmotions {
|
||||
id Int @id @default(autoincrement())
|
||||
label String
|
||||
value String @unique
|
||||
isActive Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
Sticker Sticker[] @relation("StikerEmotions")
|
||||
}
|
||||
|
||||
// -------------------- INVESTASI --------------------- //
|
||||
// Table investasi / saham
|
||||
model Investasi {
|
||||
@@ -593,6 +648,8 @@ model Event {
|
||||
Event_Peserta Event_Peserta[]
|
||||
EventMaster_TipeAcara EventMaster_TipeAcara? @relation(fields: [eventMaster_TipeAcaraId], references: [id])
|
||||
eventMaster_TipeAcaraId Int?
|
||||
EventSponsor EventSponsor[]
|
||||
EventTransaksi EventTransaksi[]
|
||||
}
|
||||
|
||||
model EventMaster_TipeAcara {
|
||||
@@ -618,6 +675,7 @@ model Event_Peserta {
|
||||
active Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
isPresent Boolean @default(false)
|
||||
|
||||
Event Event? @relation(fields: [eventId], references: [id])
|
||||
eventId String?
|
||||
@@ -951,3 +1009,64 @@ model MasterKategoriApp {
|
||||
name String
|
||||
value String?
|
||||
}
|
||||
|
||||
// ======================= EVENT ======================= //
|
||||
|
||||
model EventSponsor {
|
||||
id String @id @default(cuid())
|
||||
isActive Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
name String
|
||||
isTransfer Boolean? @default(false)
|
||||
fileName String
|
||||
fileExt String?
|
||||
fileId String
|
||||
|
||||
Author User? @relation(fields: [authorId], references: [id])
|
||||
authorId String?
|
||||
|
||||
Event Event? @relation(fields: [eventId], references: [id])
|
||||
eventId String?
|
||||
|
||||
EventTransaksi EventTransaksi?
|
||||
}
|
||||
|
||||
model EventTransaksi {
|
||||
id String @id @default(cuid())
|
||||
isActive Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
nominal Int
|
||||
status String
|
||||
transferImageId String?
|
||||
|
||||
MasterBank MasterBank? @relation(fields: [masterBankId], references: [id])
|
||||
masterBankId String?
|
||||
|
||||
AuthorId User? @relation(fields: [authorId], references: [id])
|
||||
authorId String?
|
||||
|
||||
Event Event? @relation(fields: [eventId], references: [id])
|
||||
eventId String?
|
||||
|
||||
EventSponsor EventSponsor? @relation(fields: [eventSponsorId], references: [id])
|
||||
eventSponsorId String? @unique
|
||||
|
||||
MasterStatusTransaksi MasterStatusTransaksi? @relation(fields: [masterStatusTransaksiId], references: [id])
|
||||
masterStatusTransaksiId String?
|
||||
}
|
||||
|
||||
model Sticker {
|
||||
id String @id @default(cuid())
|
||||
isActive Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
name String?
|
||||
fileName String?
|
||||
fileExt String?
|
||||
fileId String
|
||||
jenisKelamin String?
|
||||
|
||||
MasterEmotions MasterEmotions[] @relation("StikerEmotions")
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import prisma from "./../src/app/lib/prisma";
|
||||
import prisma from "../src/lib/prisma";
|
||||
import { generate_seeder } from "./../src/app_modules/_global/fun/generate_seeder";
|
||||
|
||||
(async () => {
|
||||
console.log("start");
|
||||
console.log("start seeder >>");
|
||||
await generate_seeder();
|
||||
})()
|
||||
.then(() => {
|
||||
console.log("success");
|
||||
console.log("<< success seeder");
|
||||
process.exit(0);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
console.error("<< error seeder", e);
|
||||
process.exit(1);
|
||||
})
|
||||
.finally(async () => {
|
||||
|
||||
BIN
public/aset/global/dummy-image.jpg
Normal file
BIN
public/aset/global/dummy-image.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
BIN
public/aset/home/home-hipmi-new.png
Normal file
BIN
public/aset/home/home-hipmi-new.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 128 KiB |
BIN
public/aset/investasi/logo-crowd-panjang-new.png
Normal file
BIN
public/aset/investasi/logo-crowd-panjang-new.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 331 KiB |
1
run.env.build.dev
Normal file
1
run.env.build.dev
Normal file
@@ -0,0 +1 @@
|
||||
nice -n 19 bun --env-file=.env run --bun build
|
||||
1
run.env.build.local
Normal file
1
run.env.build.local
Normal file
@@ -0,0 +1 @@
|
||||
bun --env-file=.env.local run --bun build
|
||||
1
run.env.dev
Normal file
1
run.env.dev
Normal file
@@ -0,0 +1 @@
|
||||
bun --env-file=.env run --bun dev -p 3000
|
||||
1
run.env.local.dev
Normal file
1
run.env.local.dev
Normal file
@@ -0,0 +1 @@
|
||||
bun --env-file=.env.local run --bun dev -p 3005
|
||||
1
run.env.start.dev
Normal file
1
run.env.start.dev
Normal file
@@ -0,0 +1 @@
|
||||
bun --env-file=.env run --bun start -p 3000
|
||||
1
run.env.start.local
Normal file
1
run.env.start.local
Normal file
@@ -0,0 +1 @@
|
||||
bun --env-file=.env-local run --bun start -p 3000
|
||||
3
run.prisma.env.local
Normal file
3
run.prisma.env.local
Normal file
@@ -0,0 +1,3 @@
|
||||
bun --env-file=.env.local prisma db push
|
||||
bun --env-file=.env.local prisma db seed
|
||||
bun --env-file=.env.local run --bun build
|
||||
138
src/app/(admin)/logs/logs.module.css
Normal file
138
src/app/(admin)/logs/logs.module.css
Normal file
@@ -0,0 +1,138 @@
|
||||
/* app/admin/logs/logs.module.css */
|
||||
.container {
|
||||
padding: 24px;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.filterContainer {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.select {
|
||||
padding: 8px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
.logsContainer {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.logItem {
|
||||
padding: 16px;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.errorLog {
|
||||
background-color: #fef2f2;
|
||||
}
|
||||
|
||||
.warnLog {
|
||||
background-color: #fefce8;
|
||||
}
|
||||
|
||||
.infoLog {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.logHeader {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.timestamp {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.level {
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.errorLevel {
|
||||
background-color: #fee2e2;
|
||||
color: #991b1b;
|
||||
}
|
||||
|
||||
.warnLevel {
|
||||
background-color: #fef3c7;
|
||||
color: #92400e;
|
||||
}
|
||||
|
||||
.infoLevel {
|
||||
background-color: #dbeafe;
|
||||
color: #1e40af;
|
||||
}
|
||||
|
||||
.message {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.metadata {
|
||||
margin-top: 8px;
|
||||
padding: 8px;
|
||||
background-color: #f9fafb;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
overflow-x: auto;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.loading {
|
||||
text-align: center;
|
||||
padding: 24px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: #dc2626;
|
||||
text-align: center;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
/* Hover effects */
|
||||
.logItem:hover {
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.select:hover {
|
||||
border-color: #999;
|
||||
}
|
||||
|
||||
/* Focus states */
|
||||
.select:focus {
|
||||
outline: none;
|
||||
border-color: #2563eb;
|
||||
box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
|
||||
}
|
||||
|
||||
/* Responsive adjustments */
|
||||
@media (max-width: 768px) {
|
||||
.container {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.logHeader {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.metadata {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
106
src/app/(admin)/logs/page.tsx
Normal file
106
src/app/(admin)/logs/page.tsx
Normal file
@@ -0,0 +1,106 @@
|
||||
// app/admin/logs/page.tsx
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { format } from "date-fns";
|
||||
import styles from "./logs.module.css";
|
||||
|
||||
interface LogEntry {
|
||||
timestamp: string;
|
||||
level: string;
|
||||
message: string;
|
||||
metadata?: any;
|
||||
}
|
||||
|
||||
export default function LogsPage() {
|
||||
const [logs, setLogs] = useState<LogEntry[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [filter, setFilter] = useState<"all" | "error" | "info" | "warn">(
|
||||
"all"
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
fetchLogs();
|
||||
}, []);
|
||||
|
||||
async function fetchLogs() {
|
||||
try {
|
||||
const response = await fetch("/api/logs/view");
|
||||
if (!response.ok) throw new Error("Failed to fetch logs");
|
||||
|
||||
const data = await response.json();
|
||||
setLogs(data.logs);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : "Error fetching logs");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
const filteredLogs = logs.filter((log) =>
|
||||
filter === "all" ? true : log.level === filter
|
||||
);
|
||||
|
||||
if (loading) return <div className={styles.loading}>Loading logs...</div>;
|
||||
if (error) return <div className={styles.error}>Error: {error}</div>;
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<h1 className={styles.title}>System Logs</h1>
|
||||
|
||||
<div className={styles.filterContainer}>
|
||||
<select
|
||||
value={filter}
|
||||
onChange={(e) => setFilter(e.target.value as any)}
|
||||
className={styles.select}
|
||||
>
|
||||
<option value="all">All Logs</option>
|
||||
<option value="error">Errors</option>
|
||||
<option value="warn">Warnings</option>
|
||||
<option value="info">Info</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div className={styles.logsContainer}>
|
||||
{filteredLogs.map((log, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className={`${styles.logItem} ${
|
||||
log.level === "error"
|
||||
? styles.errorLog
|
||||
: log.level === "warn"
|
||||
? styles.warnLog
|
||||
: styles.infoLog
|
||||
}`}
|
||||
>
|
||||
<div className={styles.logHeader}>
|
||||
<span className={styles.timestamp}>
|
||||
{format(new Date(log.timestamp), "yyyy-MM-dd HH:mm:ss")}
|
||||
</span>
|
||||
<span
|
||||
className={`${styles.level} ${
|
||||
log.level === "error"
|
||||
? styles.errorLevel
|
||||
: log.level === "warn"
|
||||
? styles.warnLevel
|
||||
: styles.infoLevel
|
||||
}`}
|
||||
>
|
||||
{log.level.toUpperCase()}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className={styles.message}>{log.message}</div>
|
||||
|
||||
{log.metadata && (
|
||||
<pre className={styles.metadata}>
|
||||
{JSON.stringify(log.metadata, null, 2)}
|
||||
</pre>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
49
src/app/(auth)/_lib/decrypt.ts
Normal file
49
src/app/(auth)/_lib/decrypt.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { jwtVerify } from "jose";
|
||||
|
||||
export async function decrypt({
|
||||
token,
|
||||
encodedKey,
|
||||
}: {
|
||||
token: string;
|
||||
encodedKey: string;
|
||||
}): Promise<Record<string, any> | null> {
|
||||
if (!token || !encodedKey) {
|
||||
console.error("Missing required parameters:", {
|
||||
hasToken: !!token,
|
||||
hasEncodedKey: !!encodedKey,
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
const enc = new TextEncoder().encode(encodedKey);
|
||||
const { payload } = await jwtVerify(token, enc, {
|
||||
algorithms: ["HS256"],
|
||||
});
|
||||
|
||||
if (!payload || !payload.user) {
|
||||
console.error("Invalid payload structure:", {
|
||||
hasPayload: !!payload,
|
||||
hasUser: payload ? !!payload.user : false,
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
// Logging untuk debug
|
||||
// console.log("Decrypt successful:", {
|
||||
// payloadExists: !!payload,
|
||||
// userExists: !!payload.user,
|
||||
// tokenPreview: token.substring(0, 10) + "...",
|
||||
// });
|
||||
|
||||
return payload.user as Record<string, any>;
|
||||
} catch (error) {
|
||||
console.error("Token verification failed:", {
|
||||
error,
|
||||
tokenLength: token?.length,
|
||||
errorName: error instanceof Error ? error.name : "Unknown error",
|
||||
errorMessage: error instanceof Error ? error.message : String(error),
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
9
src/app/(auth)/invalid-user/page.tsx
Normal file
9
src/app/(auth)/invalid-user/page.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { InvalidUser } from "@/app_modules/auth";
|
||||
|
||||
export default function Page() {
|
||||
return (
|
||||
<>
|
||||
<InvalidUser />
|
||||
</>
|
||||
);
|
||||
}
|
||||
14
src/app/(auth)/waiting-room/page.tsx
Normal file
14
src/app/(auth)/waiting-room/page.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import WaitingRoom_View from "@/app_modules/waiting_room/view";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function Page() {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
<WaitingRoom_View userLoginId={userLoginId as string} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,13 +1,10 @@
|
||||
import { Job_UiNotUserView } from "@/app_modules/job/_ui";
|
||||
import { job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const jobId = params.id;
|
||||
const dataJob = await job_getOneById(jobId);
|
||||
export default async function Page() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Job_UiNotUserView data={dataJob} />
|
||||
<Job_UiNotUserView />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { funGlobal_checkActivationUseById } from "@/app_modules/_global/fun/get/fun_check_activation_use_by_id";
|
||||
import WaitingRoom_View from "@/app_modules/waiting_room/view";
|
||||
|
||||
export default async function Page() {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
const activationUser = await funGlobal_checkActivationUseById({
|
||||
userId: userLoginId as string,
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<WaitingRoom_View
|
||||
activationUser={activationUser as boolean}
|
||||
userLoginId={userLoginId as string}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
72
src/app/api/admin/collaboration/[id]/route.ts
Normal file
72
src/app/api/admin/collaboration/[id]/route.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import prisma from "@/lib/prisma";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(
|
||||
req: Request,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
try {
|
||||
const { id } = params;
|
||||
const data = await prisma.projectCollaboration.findUnique({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
isActive: true,
|
||||
title: true,
|
||||
lokasi: true,
|
||||
purpose: true,
|
||||
benefit: true,
|
||||
createdAt: true,
|
||||
report: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
},
|
||||
},
|
||||
ProjectCollaborationMaster_Industri: true,
|
||||
ProjectCollaboration_Partisipasi: {
|
||||
where: {
|
||||
User: {
|
||||
active: true,
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
User: {
|
||||
select: {
|
||||
id: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get collaboration",
|
||||
data: data,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get collaboration >>", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Error get collaboration",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
58
src/app/api/admin/collaboration/dashboard/[name]/route.ts
Normal file
58
src/app/api/admin/collaboration/dashboard/[name]/route.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request, { params }: {
|
||||
params: { name: string }
|
||||
}) {
|
||||
const { name } = params;
|
||||
try {
|
||||
let fixData;
|
||||
const fixStatus = _.startCase(name);
|
||||
|
||||
if (fixStatus === "Publish") {
|
||||
fixData = await prisma.projectCollaboration.count({
|
||||
where: {
|
||||
isActive: true,
|
||||
isReject: false,
|
||||
Author: {
|
||||
active: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
} else if (fixStatus === "Reject") {
|
||||
fixData = await prisma.projectCollaboration.count({
|
||||
where: {
|
||||
isReject: true,
|
||||
},
|
||||
});
|
||||
|
||||
} else if (fixStatus === "Room") {
|
||||
fixData = await prisma.projectCollaboration_RoomChat.count({
|
||||
where: {
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: `Success Get Data ${fixStatus}`,
|
||||
data: fixData,
|
||||
|
||||
},
|
||||
{ status: 200 }
|
||||
)
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get count group chat", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get data count group chat ",
|
||||
reason: (error as Error).message
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
74
src/app/api/admin/collaboration/group/[id]/route.ts
Normal file
74
src/app/api/admin/collaboration/group/[id]/route.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@/lib";
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
try {
|
||||
const { id } = params;
|
||||
|
||||
const data = 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(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get data collaboration group",
|
||||
data: data,
|
||||
},
|
||||
{
|
||||
status: 200,
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data collaboration group", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Error get data collaboration group",
|
||||
error: (error as Error).message,
|
||||
},
|
||||
{
|
||||
status: 500,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
146
src/app/api/admin/collaboration/group/route.ts
Normal file
146
src/app/api/admin/collaboration/group/route.ts
Normal file
@@ -0,0 +1,146 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get("search");
|
||||
const page = searchParams.get("page");
|
||||
const takeData = 10;
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.projectCollaboration_RoomChat.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
isActive: true,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
createdAt: true,
|
||||
isActive: true,
|
||||
name: true,
|
||||
ProjectCollaboration_AnggotaRoomChat: {
|
||||
select: {
|
||||
User: {
|
||||
select: {
|
||||
id: true,
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ProjectCollaboration: {
|
||||
select: {
|
||||
id: true,
|
||||
isActive: true,
|
||||
title: true,
|
||||
lokasi: true,
|
||||
purpose: true,
|
||||
benefit: true,
|
||||
createdAt: true,
|
||||
report: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ProjectCollaborationMaster_Industri: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const data = await prisma.projectCollaboration_RoomChat.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
isActive: true,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
createdAt: true,
|
||||
isActive: true,
|
||||
name: true,
|
||||
ProjectCollaboration_AnggotaRoomChat: {
|
||||
select: {
|
||||
User: {
|
||||
select: {
|
||||
id: true,
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ProjectCollaboration: {
|
||||
select: {
|
||||
id: true,
|
||||
isActive: true,
|
||||
title: true,
|
||||
lokasi: true,
|
||||
purpose: true,
|
||||
benefit: true,
|
||||
createdAt: true,
|
||||
report: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ProjectCollaborationMaster_Industri: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.projectCollaboration_RoomChat.count({
|
||||
where: {
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nPage: _.ceil(nCount / takeData),
|
||||
};
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get data collaboration group",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data collaboration group >>", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Error get data collaboration group",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
141
src/app/api/admin/collaboration/status/publish/route.ts
Normal file
141
src/app/api/admin/collaboration/status/publish/route.ts
Normal file
@@ -0,0 +1,141 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const page = searchParams.get("page");
|
||||
const takeData = 10;
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.projectCollaboration.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
isActive: true,
|
||||
isReject: false,
|
||||
Author: {
|
||||
active: true,
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
createdAt: true,
|
||||
isActive: true,
|
||||
title: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
projectCollaborationMaster_IndustriId: true,
|
||||
ProjectCollaborationMaster_Industri: true,
|
||||
ProjectCollaboration_Partisipasi: {
|
||||
where: {
|
||||
User: {
|
||||
active: true,
|
||||
},
|
||||
},
|
||||
// select: {
|
||||
// User: {
|
||||
// select: {
|
||||
// id: true,
|
||||
// username: true,
|
||||
// Profile: true,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const data = await prisma.projectCollaboration.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
isActive: true,
|
||||
isReject: false,
|
||||
Author: {
|
||||
active: true,
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
createdAt: true,
|
||||
isActive: true,
|
||||
title: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
projectCollaborationMaster_IndustriId: true,
|
||||
ProjectCollaborationMaster_Industri: true,
|
||||
ProjectCollaboration_Partisipasi: {
|
||||
where: {
|
||||
User: {
|
||||
active: true,
|
||||
},
|
||||
},
|
||||
// select: {
|
||||
// User: {
|
||||
// select: {
|
||||
// id: true,
|
||||
// username: true,
|
||||
// Profile: true,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.projectCollaboration.count({
|
||||
where: {
|
||||
isActive: true,
|
||||
isReject: false,
|
||||
Author: {
|
||||
active: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nPage: _.ceil(nCount / takeData),
|
||||
};
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get data collaboration dashboard",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data collaboration dashboard >>", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Error get data collaboration dashboard",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
143
src/app/api/admin/collaboration/status/reject/route.ts
Normal file
143
src/app/api/admin/collaboration/status/reject/route.ts
Normal file
@@ -0,0 +1,143 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
|
||||
const { searchParams } = new URL(request.url);
|
||||
const page = searchParams.get("page");
|
||||
const takeData = 10;
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.projectCollaboration.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
isActive: false,
|
||||
isReject: true,
|
||||
Author: {
|
||||
active: true,
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
createdAt: true,
|
||||
isActive: true,
|
||||
title: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
projectCollaborationMaster_IndustriId: true,
|
||||
ProjectCollaborationMaster_Industri: true,
|
||||
ProjectCollaboration_Partisipasi: {
|
||||
where: {
|
||||
User: {
|
||||
active: true,
|
||||
},
|
||||
},
|
||||
// select: {
|
||||
// User: {
|
||||
// select: {
|
||||
// id: true,
|
||||
// username: true,
|
||||
// Profile: true,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const data = await prisma.projectCollaboration.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
isActive: false,
|
||||
isReject: true,
|
||||
Author: {
|
||||
active: true,
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
createdAt: true,
|
||||
isActive: true,
|
||||
title: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
projectCollaborationMaster_IndustriId: true,
|
||||
ProjectCollaborationMaster_Industri: true,
|
||||
ProjectCollaboration_Partisipasi: {
|
||||
where: {
|
||||
User: {
|
||||
active: true,
|
||||
},
|
||||
},
|
||||
// select: {
|
||||
// User: {
|
||||
// select: {
|
||||
// id: true,
|
||||
// username: true,
|
||||
// Profile: true,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.projectCollaboration.count({
|
||||
where: {
|
||||
isActive: false,
|
||||
isReject: true,
|
||||
Author: {
|
||||
active: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nPage: _.ceil(nCount / takeData),
|
||||
}
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success get data collaboration dashboard",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data collaboration dashboard >>", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get data collaboration dashboard",
|
||||
reason: (error as Error).message
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
84
src/app/api/admin/developer/route.ts
Normal file
84
src/app/api/admin/developer/route.ts
Normal file
@@ -0,0 +1,84 @@
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
try {
|
||||
let fixData;
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get("search");
|
||||
const page = searchParams.get("page");
|
||||
const dataTake = 10;
|
||||
const dataSkip = Number(page) * dataTake - dataTake;
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.user.findMany({
|
||||
orderBy: {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
masterUserRoleId: "2",
|
||||
username: {
|
||||
contains: search || "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const data = await prisma.user.findMany({
|
||||
skip: dataSkip,
|
||||
take: dataTake,
|
||||
orderBy: {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
masterUserRoleId: "2",
|
||||
username: {
|
||||
contains: search || "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.user.count({
|
||||
where: {
|
||||
masterUserRoleId: "2",
|
||||
username: {
|
||||
contains: search || "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nPage: _.ceil(nCount / dataTake),
|
||||
};
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get data",
|
||||
data: fixData,
|
||||
},
|
||||
{
|
||||
status: 200,
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Error get data admin", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Internal Server Error",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{
|
||||
status: 500,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
29
src/app/api/admin/donasi/[id]/count/route.ts
Normal file
29
src/app/api/admin/donasi/[id]/count/route.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import prisma from "@/lib/prisma";
|
||||
export async function GET(
|
||||
req: Request,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
const { id } = params;
|
||||
try {
|
||||
const data = await prisma.donasi_Invoice.count({
|
||||
where: {
|
||||
donasiId: id,
|
||||
donasiMaster_StatusInvoiceId: "1",
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Data berhasil diambil",
|
||||
data: data,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error get count donasi ", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get count donasi",
|
||||
reason: (error as Error).message,
|
||||
});
|
||||
}
|
||||
}
|
||||
111
src/app/api/admin/donasi/[id]/donatur/route.ts
Normal file
111
src/app/api/admin/donasi/[id]/donatur/route.ts
Normal file
@@ -0,0 +1,111 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(req: Request,
|
||||
{ params }: { params: { id: string } }) {
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
const { id } = params;
|
||||
const { searchParams } = new URL(req.url);
|
||||
const page = searchParams.get("page");
|
||||
const status = searchParams.get("status");
|
||||
const takeData = 10
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.donasi_Invoice.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
donasiId: id,
|
||||
active: true,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
nominal: true,
|
||||
createdAt: true,
|
||||
Author: true,
|
||||
DonasiMaster_Bank: true,
|
||||
DonasiMaster_StatusInvoice: true,
|
||||
donasiMaster_StatusInvoiceId: true,
|
||||
imagesId: true,
|
||||
imageId: true,
|
||||
|
||||
},
|
||||
})
|
||||
} else {
|
||||
const fixStatus = _.startCase(status ? status : "");
|
||||
const data = await prisma.donasi_Invoice.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
|
||||
donasiId: id,
|
||||
active: true,
|
||||
DonasiMaster_StatusInvoice: {
|
||||
name: {
|
||||
contains: fixStatus,
|
||||
mode: "insensitive",
|
||||
}
|
||||
}
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
nominal: true,
|
||||
createdAt: true,
|
||||
Author: true,
|
||||
DonasiMaster_Bank: true,
|
||||
DonasiMaster_StatusInvoice: true,
|
||||
donasiMaster_StatusInvoiceId: true,
|
||||
imagesId: true,
|
||||
imageId: true,
|
||||
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
const nCount = await prisma.donasi_Invoice.count({
|
||||
where: {
|
||||
donasiId: id,
|
||||
active: true,
|
||||
DonasiMaster_StatusInvoice: {
|
||||
name: {
|
||||
contains: fixStatus,
|
||||
mode: "insensitive",
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nPage: _.ceil(nCount / takeData)
|
||||
}
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
)
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data donatur >>", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get data donatur",
|
||||
reason: (error as Error).message
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
64
src/app/api/admin/donasi/[id]/pencairan/route.ts
Normal file
64
src/app/api/admin/donasi/[id]/pencairan/route.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import prisma from "@/lib/prisma";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
export async function GET(
|
||||
req: Request,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
|
||||
let fixData;
|
||||
const donasiId = params.id;
|
||||
const { searchParams } = new URL(req.url);
|
||||
const page = searchParams.get("page");
|
||||
const takeData = 10
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
try {
|
||||
if (!page) {
|
||||
fixData = await prisma.donasi_PencairanDana.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
donasiId: donasiId,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const data = await prisma.donasi_PencairanDana.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
donasiId: donasiId,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.donasi_PencairanDana.count({
|
||||
where: {
|
||||
donasiId: donasiId,
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nPage: _.ceil(nCount / takeData),
|
||||
};
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Data berhasil diambil",
|
||||
data: fixData,
|
||||
});
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get pencairan donasi >>", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get pencairan donasi",
|
||||
reason: (error as Error).message,
|
||||
});
|
||||
}
|
||||
}
|
||||
57
src/app/api/admin/donasi/[id]/route.ts
Normal file
57
src/app/api/admin/donasi/[id]/route.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
export async function GET(req: Request, { params }: { params: { id: string } }) {
|
||||
|
||||
try {
|
||||
const { id } = params;
|
||||
const donasiId = id;
|
||||
const data = await prisma.donasi.findUnique({
|
||||
where: {
|
||||
id: donasiId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
target: true,
|
||||
active: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
publishTime: true,
|
||||
catatan: true,
|
||||
progres: true,
|
||||
terkumpul: true,
|
||||
authorId: true,
|
||||
namaBank: true,
|
||||
rekening: true,
|
||||
totalPencairan: true,
|
||||
akumulasiPencairan: true,
|
||||
imagesId: true,
|
||||
donasiMaster_KategoriId: true,
|
||||
donasiMaster_DurasiId: true,
|
||||
donasiMaster_StatusDonasiId: true,
|
||||
Author: true,
|
||||
imageDonasi: true,
|
||||
CeritaDonasi: true,
|
||||
DonasiMaster_Ketegori: true,
|
||||
DonasiMaster_Durasi: true,
|
||||
DonasiMaster_Status: true,
|
||||
imageId: true,
|
||||
}
|
||||
})
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Data Donasi Berhasil Diambil",
|
||||
data: data,
|
||||
}, { status: 200 });
|
||||
} catch (error) {
|
||||
backendLogger.error("Error Get Data Donasi >>", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get detail Investasi",
|
||||
reason: (error as Error).message,
|
||||
}, { status: 500 });
|
||||
}
|
||||
}
|
||||
38
src/app/api/admin/donasi/dashboard/[name]/route.ts
Normal file
38
src/app/api/admin/donasi/dashboard/[name]/route.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request, { params }: {
|
||||
params: { name: string }
|
||||
}) {
|
||||
|
||||
const { name } = params;
|
||||
try {
|
||||
let fixData;
|
||||
const fixStatus = _.startCase(name);
|
||||
fixData = await prisma.donasi.count({
|
||||
where: {
|
||||
DonasiMaster_Status: {
|
||||
name: fixStatus
|
||||
},
|
||||
}
|
||||
});
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success get data donasi dashboard",
|
||||
data: fixData
|
||||
},
|
||||
{ status: 200 }
|
||||
)
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data donasi dashboard >>", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Failed to get data donasi dashboard",
|
||||
reason: (error as Error).message
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
25
src/app/api/admin/donasi/dashboard/kategori/route.ts
Normal file
25
src/app/api/admin/donasi/dashboard/kategori/route.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { prisma } from "@/lib";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const fixData = await prisma.donasiMaster_Kategori.count({});
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get data donasi dashboard",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "gagal mendapatkan data donasi dashboard",
|
||||
error: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
34
src/app/api/admin/donasi/kategori/route.ts
Normal file
34
src/app/api/admin/donasi/kategori/route.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const method = request.method;
|
||||
try {
|
||||
const data = await prisma.donasiMaster_Kategori.findMany({
|
||||
orderBy: {
|
||||
createdAt: 'asc'
|
||||
},
|
||||
where: {
|
||||
|
||||
active: true
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success get kategori",
|
||||
data: data
|
||||
})
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get kategori", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Failed get kategori",
|
||||
reason: (error as Error).message
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
122
src/app/api/admin/donasi/status/[name]/route.ts
Normal file
122
src/app/api/admin/donasi/status/[name]/route.ts
Normal file
@@ -0,0 +1,122 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request,
|
||||
{ params }: { params: { name: string } }) {
|
||||
|
||||
const { name } = params;
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get("search");
|
||||
const page = searchParams.get("page");
|
||||
const takeData = 10;
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
const fixStatus = _.startCase(name);
|
||||
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.donasi.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
DonasiMaster_Status: {
|
||||
name: fixStatus,
|
||||
},
|
||||
active: true,
|
||||
title: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
target: true,
|
||||
authorId: true,
|
||||
terkumpul: true,
|
||||
imageDonasi: true,
|
||||
DonasiMaster_Ketegori: true,
|
||||
DonasiMaster_Durasi: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
} else {
|
||||
const data = await prisma.donasi.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
DonasiMaster_Status: {
|
||||
name: fixStatus,
|
||||
},
|
||||
active: true,
|
||||
title: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
target: true,
|
||||
authorId: true,
|
||||
terkumpul: true,
|
||||
imageDonasi: true,
|
||||
DonasiMaster_Ketegori: true,
|
||||
DonasiMaster_Durasi: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const nCount = await prisma.donasi.count({
|
||||
where: {
|
||||
active: true,
|
||||
DonasiMaster_Status: {
|
||||
name: fixStatus
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nCount: _.ceil(nCount / takeData)
|
||||
}
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success",
|
||||
data: fixData
|
||||
},
|
||||
{ status: 200 }
|
||||
)
|
||||
|
||||
} catch (error) {
|
||||
backendLogger.error("Error geta data table donasi event dashboard>>", error)
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Failed get data table donasi dashboard",
|
||||
reason: (error as Error).message
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
100
src/app/api/admin/event/[id]/peserta/route.ts
Normal file
100
src/app/api/admin/event/[id]/peserta/route.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
export async function GET(request: Request,
|
||||
{ params }: { params: { id: string } }) {
|
||||
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get('search');
|
||||
const page = searchParams.get('page');
|
||||
const takeData = 10;
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
const { id } = params;
|
||||
const eventId = id
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.event_Peserta.findMany({
|
||||
|
||||
where: {
|
||||
eventId: eventId,
|
||||
User: {
|
||||
username: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
select: {
|
||||
isPresent: true,
|
||||
User: {
|
||||
include: {
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const data = await prisma.event_Peserta.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
where: {
|
||||
eventId: eventId,
|
||||
User: {
|
||||
username: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
}
|
||||
}
|
||||
},
|
||||
select: {
|
||||
isPresent: true,
|
||||
User: {
|
||||
include: {
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.event_Peserta.count({
|
||||
where: {
|
||||
eventId: eventId,
|
||||
User: {
|
||||
username: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nPage: _.ceil(nCount / takeData),
|
||||
};
|
||||
}
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success get data event detail",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
)
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data event detail >>", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get data event detail",
|
||||
reason: (error as Error).message
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
55
src/app/api/admin/event/[id]/route.ts
Normal file
55
src/app/api/admin/event/[id]/route.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
export async function GET(
|
||||
req: Request,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
try {
|
||||
const { id } = params;
|
||||
const data = await prisma.event.findUnique({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
username: true,
|
||||
nomor: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
alamat: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
EventMaster_TipeAcara: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
EventMaster_Status: true,
|
||||
},
|
||||
});
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get data event detail",
|
||||
data: data,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data event detail >>", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Error get data event detail",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
44
src/app/api/admin/event/dashboard/[name]/route.ts
Normal file
44
src/app/api/admin/event/dashboard/[name]/route.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: { name: string } }
|
||||
) {
|
||||
|
||||
const { name } = params;
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
const fixStatus = _.startCase(name);
|
||||
fixData = await prisma.event.count({
|
||||
where: {
|
||||
EventMaster_Status: {
|
||||
name: fixStatus,
|
||||
},
|
||||
isArsip: false,
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get data event dashboard",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data event dashboard >>", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Failed to get data",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
37
src/app/api/admin/event/dashboard/riwayat/route.ts
Normal file
37
src/app/api/admin/event/dashboard/riwayat/route.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
try {
|
||||
let fixData;
|
||||
fixData = await prisma.event.count({
|
||||
where: {
|
||||
EventMaster_Status: {
|
||||
name: "Publish",
|
||||
},
|
||||
isArsip: true,
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get data riwayat event dashboard",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data riwayat event dashboard >>", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Failed to get data",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
33
src/app/api/admin/event/dashboard/tipe-acara/route.ts
Normal file
33
src/app/api/admin/event/dashboard/tipe-acara/route.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const fixData = await prisma.eventMaster_TipeAcara.count({
|
||||
where: {
|
||||
active: true,
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get data riwayat event dashboard",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data riwayat event dashboard >>", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Failed to get data",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
192
src/app/api/admin/event/riwayat/route.ts
Normal file
192
src/app/api/admin/event/riwayat/route.ts
Normal file
@@ -0,0 +1,192 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get("search");
|
||||
const page = searchParams.get("page");
|
||||
const takeData = 10;
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
|
||||
if (!page && !search) {
|
||||
fixData = await prisma.event.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
EventMaster_Status: {
|
||||
name: "Publish",
|
||||
},
|
||||
isArsip: true,
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
EventMaster_Status: true,
|
||||
EventMaster_TipeAcara: true,
|
||||
},
|
||||
});
|
||||
} else if (!page && search) {
|
||||
fixData = await prisma.event.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
EventMaster_Status: {
|
||||
name: "Publish",
|
||||
},
|
||||
isArsip: true,
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
EventMaster_Status: true,
|
||||
EventMaster_TipeAcara: true,
|
||||
},
|
||||
});
|
||||
} else if (page && !search) {
|
||||
const data = await prisma.event.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
EventMaster_Status: {
|
||||
name: "Publish",
|
||||
},
|
||||
isArsip: true,
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
EventMaster_Status: true,
|
||||
EventMaster_TipeAcara: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.event.count({
|
||||
where: {
|
||||
active: true,
|
||||
isArsip: true,
|
||||
EventMaster_Status: {
|
||||
name: "Publish",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nPage: _.ceil(nCount / takeData),
|
||||
};
|
||||
} else if (page && search) {
|
||||
const data = await prisma.event.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
EventMaster_Status: {
|
||||
name: "Publish",
|
||||
},
|
||||
isArsip: true,
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
EventMaster_Status: true,
|
||||
EventMaster_TipeAcara: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.event.count({
|
||||
where: {
|
||||
active: true,
|
||||
isArsip: true,
|
||||
EventMaster_Status: {
|
||||
name: "Publish",
|
||||
},
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data,
|
||||
nPage: _.ceil(nCount / takeData),
|
||||
};
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get data riwayat event",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data riwayat event >>", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Error get data riwayat event",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
153
src/app/api/admin/event/status/[name]/route.ts
Normal file
153
src/app/api/admin/event/status/[name]/route.ts
Normal file
@@ -0,0 +1,153 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: { name: string } }
|
||||
) {
|
||||
const { name } = params;
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get("search");
|
||||
const page = searchParams.get("page");
|
||||
const takeData = 10;
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
const fixStatus = _.startCase(name);
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.event.findMany({
|
||||
orderBy: {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
active: true,
|
||||
isArsip: false,
|
||||
EventMaster_Status: {
|
||||
name: fixStatus,
|
||||
},
|
||||
title: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
EventMaster_Status: true,
|
||||
EventMaster_TipeAcara: true,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
if (fixStatus === "Publish") {
|
||||
const getAllData = await prisma.event.findMany({
|
||||
where: {
|
||||
active: true,
|
||||
EventMaster_Status: {
|
||||
name: fixStatus,
|
||||
},
|
||||
isArsip: false,
|
||||
},
|
||||
});
|
||||
|
||||
for (let i of getAllData) {
|
||||
if (moment(i.tanggalSelesai).diff(moment(), "minutes") < 0) {
|
||||
await prisma.event.update({
|
||||
where: {
|
||||
id: i.id,
|
||||
},
|
||||
data: {
|
||||
isArsip: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const data = await prisma.event.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
tanggal: "asc",
|
||||
},
|
||||
where: {
|
||||
active: true,
|
||||
isArsip: false,
|
||||
EventMaster_Status: {
|
||||
name: fixStatus,
|
||||
},
|
||||
title: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
EventMaster_Status: true,
|
||||
EventMaster_TipeAcara: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.event.count({
|
||||
where: {
|
||||
active: true,
|
||||
isArsip: false,
|
||||
EventMaster_Status: {
|
||||
name: fixStatus,
|
||||
},
|
||||
title: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nPage: _.ceil(nCount / takeData),
|
||||
};
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: `Success get data table event ${name}`,
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data table event dashboard >>", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Failed get data table event dashboard",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
102
src/app/api/admin/forum/[id]/komentar/route.ts
Normal file
102
src/app/api/admin/forum/[id]/komentar/route.ts
Normal file
@@ -0,0 +1,102 @@
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get("search");
|
||||
const page = searchParams.get("page");
|
||||
const takeData = 10;
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
const { id } = params;
|
||||
const postingId = id;
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.forum_Komentar.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
forum_PostingId: postingId,
|
||||
isActive: true,
|
||||
komentar: {
|
||||
contains: search ?? "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Forum_ReportKomentar: true,
|
||||
Author: {
|
||||
select: {
|
||||
username: true
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const data = await prisma.forum_Komentar.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
forum_PostingId: postingId,
|
||||
isActive: true,
|
||||
komentar: {
|
||||
contains: search ?? "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Forum_ReportKomentar: true,
|
||||
Author: {
|
||||
select: {
|
||||
username: true
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.forum_Komentar.count({
|
||||
where: {
|
||||
forum_PostingId: postingId,
|
||||
isActive: true,
|
||||
komentar: {
|
||||
contains: search ?? "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nPage: _.ceil(nCount / takeData),
|
||||
};
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Berhasil mendapatkan data komentar",
|
||||
data: fixData,
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("Error get data komentar", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
status: false,
|
||||
message: "Gagal mendapatkan data komentar",
|
||||
error: error || (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
109
src/app/api/admin/forum/[id]/report-komentar/route.ts
Normal file
109
src/app/api/admin/forum/[id]/report-komentar/route.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get("search");
|
||||
const page = searchParams.get("page");
|
||||
const takeData = 10;
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
const { id } = params;
|
||||
const komentarId = id;
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.forum_ReportKomentar.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
forum_KomentarId: komentarId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
isActive: true,
|
||||
createdAt: true,
|
||||
deskripsi: true,
|
||||
ForumMaster_KategoriReport: true,
|
||||
User: {
|
||||
select: {
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const data = await prisma.forum_ReportKomentar.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
forum_KomentarId: komentarId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
isActive: true,
|
||||
createdAt: true,
|
||||
deskripsi: true,
|
||||
ForumMaster_KategoriReport: true,
|
||||
User: {
|
||||
select: {
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.forum_ReportKomentar.count({
|
||||
where: {
|
||||
forum_KomentarId: komentarId,
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nPage: _.ceil(nCount / takeData),
|
||||
};
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get detail data report komentar",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get detail data report komentar >>", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Error get detail data report komentar",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
113
src/app/api/admin/forum/[id]/report-posting/route.ts
Normal file
113
src/app/api/admin/forum/[id]/report-posting/route.ts
Normal file
@@ -0,0 +1,113 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request,
|
||||
{ params }: { params: { id: string } }) {
|
||||
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get('search');
|
||||
const page = searchParams.get('page');
|
||||
const takeData = 10;
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
const { id } = params;
|
||||
const postingId = id
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.forum_ReportPosting.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
forum_PostingId: postingId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
deskripsi: true,
|
||||
createdAt: true,
|
||||
User: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ForumMaster_KategoriReport: {
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
deskripsi: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const data = await prisma.forum_ReportPosting.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
forum_PostingId: postingId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
deskripsi: true,
|
||||
createdAt: true,
|
||||
User: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ForumMaster_KategoriReport: {
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
deskripsi: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
const nCount = await prisma.forum_ReportPosting.count({
|
||||
where: {
|
||||
forum_PostingId: postingId,
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nPage: _.ceil(nCount / takeData),
|
||||
};
|
||||
}
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success get data forum report posting",
|
||||
data: fixData
|
||||
},
|
||||
{ status: 200 }
|
||||
)
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data forum report posting >>", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get data forum report posting",
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
65
src/app/api/admin/forum/[id]/route.ts
Normal file
65
src/app/api/admin/forum/[id]/route.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import prisma from "@/lib/prisma";
|
||||
import _ from "lodash";
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
try {
|
||||
const { id } = params;
|
||||
const data = await prisma.forum_Posting.findFirst({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
diskusi: true,
|
||||
ForumMaster_StatusPosting: {
|
||||
select: {
|
||||
id: true,
|
||||
status: true,
|
||||
},
|
||||
},
|
||||
authorId: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Forum_Komentar: {
|
||||
where: {
|
||||
isActive: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const result = {
|
||||
..._.omit(data, "Forum_Komentar"),
|
||||
Forum_Komentar: data?.Forum_Komentar.length,
|
||||
};
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success get data",
|
||||
data: result,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error get data forum", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Error get data forum",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
32
src/app/api/admin/forum/dashboard/publish/route.ts
Normal file
32
src/app/api/admin/forum/dashboard/publish/route.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const fixData = await prisma.forum_Posting.count({
|
||||
where: {
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get data forum dashboard",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data forum dashboard", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Error get data forum dashboard",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
31
src/app/api/admin/forum/dashboard/report_komentar/route.ts
Normal file
31
src/app/api/admin/forum/dashboard/report_komentar/route.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
fixData = await prisma.forum_ReportKomentar.count({
|
||||
where: {
|
||||
isActive: true,
|
||||
}
|
||||
})
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success get data forum dashboard",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data forum dashboard", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get data forum dashboard",
|
||||
reason: (error as Error).message
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
30
src/app/api/admin/forum/dashboard/report_posting/route.ts
Normal file
30
src/app/api/admin/forum/dashboard/report_posting/route.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
try {
|
||||
let fixData;
|
||||
fixData = await prisma.forum_ReportPosting.count({
|
||||
where: {
|
||||
isActive: true,
|
||||
}
|
||||
})
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success get data forum dashboard",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data forum dashboard", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get data forum dashboard",
|
||||
reason: (error as Error).message
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
45
src/app/api/admin/forum/komentar/[id]/route.ts
Normal file
45
src/app/api/admin/forum/komentar/[id]/route.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
try {
|
||||
const { id } = params;
|
||||
const data = await prisma.forum_Komentar.findFirst({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
isActive: true,
|
||||
authorId: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
},
|
||||
},
|
||||
komentar: true,
|
||||
forum_PostingId: true,
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success get data komentar",
|
||||
data: data,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error get data komentar", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Error get data komentar",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
122
src/app/api/admin/forum/komentar/route.ts
Normal file
122
src/app/api/admin/forum/komentar/route.ts
Normal file
@@ -0,0 +1,122 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get("search");
|
||||
const page = searchParams.get("page");
|
||||
const takeData = 10;
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.forum_ReportKomentar.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
Forum_Komentar: {
|
||||
isActive: true,
|
||||
komentar: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
},
|
||||
include: {
|
||||
ForumMaster_KategoriReport: true,
|
||||
User: {
|
||||
select: {
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Forum_Komentar: {
|
||||
select: {
|
||||
id: true,
|
||||
komentar: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const data = await prisma.forum_ReportKomentar.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
Forum_Komentar: {
|
||||
isActive: true,
|
||||
komentar: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
},
|
||||
include: {
|
||||
ForumMaster_KategoriReport: true,
|
||||
User: {
|
||||
select: {
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Forum_Komentar: {
|
||||
select: {
|
||||
id: true,
|
||||
komentar: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
const nCount = await prisma.forum_ReportKomentar.count({
|
||||
where: {
|
||||
Forum_Komentar: {
|
||||
isActive: true,
|
||||
komentar: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nCount: _.ceil(nCount / takeData),
|
||||
};
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get data forum komentar",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data forum komentar", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get data forum komentar",
|
||||
reason: (error as Error).message,
|
||||
});
|
||||
}
|
||||
}
|
||||
153
src/app/api/admin/forum/posting/route.ts
Normal file
153
src/app/api/admin/forum/posting/route.ts
Normal file
@@ -0,0 +1,153 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get("search");
|
||||
const page = searchParams.get("page");
|
||||
const takeData = 10;
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.forum_ReportPosting.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
Forum_Posting: {
|
||||
isActive: true,
|
||||
diskusi: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
deskripsi: true,
|
||||
createdAt: true,
|
||||
User: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ForumMaster_KategoriReport: {
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
deskripsi: true,
|
||||
},
|
||||
},
|
||||
Forum_Posting: {
|
||||
select: {
|
||||
diskusi: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const data = await prisma.forum_ReportPosting.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
Forum_Posting: {
|
||||
isActive: true,
|
||||
diskusi: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
isActive: true,
|
||||
createdAt: true,
|
||||
deskripsi: true,
|
||||
forumMaster_KategoriReportId: true,
|
||||
ForumMaster_KategoriReport: {
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
deskripsi: true,
|
||||
},
|
||||
},
|
||||
|
||||
forum_PostingId: true,
|
||||
Forum_Posting: {
|
||||
select: {
|
||||
id: true,
|
||||
diskusi: true,
|
||||
ForumMaster_StatusPosting: {
|
||||
select: {
|
||||
id: true,
|
||||
status: true,
|
||||
},
|
||||
},
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
userId: true,
|
||||
User: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.forum_ReportPosting.count({
|
||||
where: {
|
||||
Forum_Posting: {
|
||||
isActive: true,
|
||||
diskusi: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nCount: _.ceil(nCount / takeData),
|
||||
};
|
||||
}
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get data forum posting",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data forum posting >>", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Error get data forum posting",
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
119
src/app/api/admin/forum/publish/route.ts
Normal file
119
src/app/api/admin/forum/publish/route.ts
Normal file
@@ -0,0 +1,119 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get("search");
|
||||
const page = searchParams.get("page");
|
||||
const takeData = 10;
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.forum_Posting.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
isActive: true,
|
||||
diskusi: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
diskusi: true,
|
||||
isActive: true,
|
||||
createdAt: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
Forum_ReportPosting: true,
|
||||
Forum_Komentar: {
|
||||
where: {
|
||||
isActive: true,
|
||||
},
|
||||
},
|
||||
ForumMaster_StatusPosting: true,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const data = await prisma.forum_Posting.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
isActive: true,
|
||||
diskusi: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
diskusi: true,
|
||||
isActive: true,
|
||||
createdAt: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
Forum_ReportPosting: true,
|
||||
Forum_Komentar: {
|
||||
where: {
|
||||
isActive: true,
|
||||
},
|
||||
},
|
||||
ForumMaster_StatusPosting: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.forum_Posting.count({
|
||||
where: {
|
||||
isActive: true,
|
||||
diskusi: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nCount: _.ceil(nCount / takeData),
|
||||
};
|
||||
}
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get data table forum",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data table forum", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Error get data table forum",
|
||||
reason: error as Error,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
80
src/app/api/admin/investasi/[id]/detail/route.ts
Normal file
80
src/app/api/admin/investasi/[id]/detail/route.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(req: Request,
|
||||
{ params }: { params: { id: string } }) {
|
||||
|
||||
|
||||
|
||||
try {
|
||||
const { id } = params;
|
||||
const investasiId = id;
|
||||
const data = await prisma.investasi.findUnique({
|
||||
where: {
|
||||
id: investasiId,
|
||||
},
|
||||
select: {
|
||||
imageId: true,
|
||||
prospektusFileId: true,
|
||||
id: true,
|
||||
author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
nomor: true,
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
title: true,
|
||||
authorId: true,
|
||||
hargaLembar: true,
|
||||
targetDana: true,
|
||||
totalLembar: true,
|
||||
sisaLembar: true,
|
||||
lembarTerbeli: true,
|
||||
progress: true,
|
||||
roi: true,
|
||||
active: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
catatan: true,
|
||||
imagesId: true,
|
||||
MasterStatusInvestasi: true,
|
||||
BeritaInvestasi: true,
|
||||
DokumenInvestasi: true,
|
||||
ProspektusInvestasi: true,
|
||||
MasterPembagianDeviden: true,
|
||||
MasterPencarianInvestor: true,
|
||||
MasterPeriodeDeviden: true,
|
||||
MasterProgresInvestasi: true,
|
||||
masterStatusInvestasiId: true,
|
||||
Investasi_Invoice: {
|
||||
where: {
|
||||
statusInvoiceId: "1",
|
||||
},
|
||||
},
|
||||
countDown: true,
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success get detail investasi",
|
||||
data: data,
|
||||
},
|
||||
{ status: 200 }
|
||||
)
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get detail investasi", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get detail investasi",
|
||||
reason: (error as Error).message
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
41
src/app/api/admin/investasi/[id]/detail_transaksi/route.ts
Normal file
41
src/app/api/admin/investasi/[id]/detail_transaksi/route.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import prisma from "@/lib/prisma";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
export async function GET(req: Request,
|
||||
{ params }: { params: { id: string } }) {
|
||||
try {
|
||||
let fixData;
|
||||
const { id } = params
|
||||
const data = await prisma.investasi_Invoice.findUnique({
|
||||
where: {
|
||||
id: id
|
||||
},
|
||||
include: {
|
||||
Author: true,
|
||||
Images: true,
|
||||
StatusInvoice: true,
|
||||
MasterBank: true,
|
||||
}
|
||||
})
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
}
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success get data detail transaksi",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
)
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data detail transaksi", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get data detail transaksi",
|
||||
reason: (error as Error).message
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
99
src/app/api/admin/investasi/[id]/transaksi/route.ts
Normal file
99
src/app/api/admin/investasi/[id]/transaksi/route.ts
Normal file
@@ -0,0 +1,99 @@
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
try {
|
||||
let fixData;
|
||||
const { id } = params;
|
||||
const { searchParams } = new URL(request.url);
|
||||
const page = searchParams.get("page");
|
||||
const status = searchParams.get("status");
|
||||
const takeData = 10
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.investasi_Invoice.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
investasiId: id,
|
||||
isActive: true,
|
||||
},
|
||||
include: {
|
||||
Author: true,
|
||||
Images: true,
|
||||
StatusInvoice: true,
|
||||
MasterBank: true,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const fixStatus = _.startCase(status ? status : "");
|
||||
|
||||
const data = await prisma.investasi_Invoice.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
investasiId: id,
|
||||
isActive: true,
|
||||
StatusInvoice: {
|
||||
name: {
|
||||
contains: fixStatus,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: true,
|
||||
Images: true,
|
||||
StatusInvoice: true,
|
||||
MasterBank: true,
|
||||
},
|
||||
});
|
||||
const nCount = await prisma.investasi_Invoice.count({
|
||||
where: {
|
||||
investasiId: id,
|
||||
isActive: true,
|
||||
StatusInvoice: {
|
||||
name: {
|
||||
contains: fixStatus,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nPage: _.ceil(nCount / takeData),
|
||||
};
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get status transaksi",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Eror get status transaksi", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Error get status transaksi",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
36
src/app/api/admin/investasi/dashboard/[name]/route.ts
Normal file
36
src/app/api/admin/investasi/dashboard/[name]/route.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request, { params }: { params: { name: string } }) {
|
||||
|
||||
const { name } = params;
|
||||
try {
|
||||
let fixData;
|
||||
const fixStatus = _.startCase(name);
|
||||
fixData = await prisma.investasi.count({
|
||||
where: {
|
||||
MasterStatusInvestasi: {
|
||||
name: fixStatus
|
||||
},
|
||||
}
|
||||
})
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success get data investasi dashboard",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
)
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data investasi dashboard >>", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get data investasi dashboard",
|
||||
reason: (error as Error).message
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
138
src/app/api/admin/investasi/status/[name]/route.ts
Normal file
138
src/app/api/admin/investasi/status/[name]/route.ts
Normal file
@@ -0,0 +1,138 @@
|
||||
import { prisma } from "@/lib";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{
|
||||
params,
|
||||
}: {
|
||||
params: { name: string };
|
||||
}
|
||||
) {
|
||||
const method = request.method;
|
||||
if (method !== "GET") {
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Method not allowed",
|
||||
},
|
||||
{ status: 405 }
|
||||
);
|
||||
}
|
||||
|
||||
const { name } = params;
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get("search");
|
||||
const page = searchParams.get("page");
|
||||
const takeData = 10;
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
const fixStatus = _.startCase(name);
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.investasi.findMany({
|
||||
orderBy: {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
active: true,
|
||||
MasterStatusInvestasi: {
|
||||
name: fixStatus,
|
||||
},
|
||||
title: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
MasterStatusInvestasi: true,
|
||||
BeritaInvestasi: true,
|
||||
DokumenInvestasi: true,
|
||||
ProspektusInvestasi: true,
|
||||
MasterPembagianDeviden: true,
|
||||
MasterPencarianInvestor: true,
|
||||
MasterPeriodeDeviden: true,
|
||||
author: true,
|
||||
Investasi_Invoice: {
|
||||
where: {
|
||||
statusInvoiceId: "2",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const data = await prisma.investasi.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
active: true,
|
||||
MasterStatusInvestasi: {
|
||||
name: fixStatus,
|
||||
},
|
||||
title: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
MasterStatusInvestasi: true,
|
||||
BeritaInvestasi: true,
|
||||
DokumenInvestasi: true,
|
||||
ProspektusInvestasi: true,
|
||||
MasterPembagianDeviden: true,
|
||||
MasterPencarianInvestor: true,
|
||||
MasterPeriodeDeviden: true,
|
||||
author: true,
|
||||
Investasi_Invoice: {
|
||||
where: {
|
||||
statusInvoiceId: "2",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.investasi.count({
|
||||
where: {
|
||||
active: true,
|
||||
MasterStatusInvestasi: {
|
||||
name: fixStatus,
|
||||
},
|
||||
title: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nPage: _.ceil(nCount / takeData),
|
||||
};
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Failed",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
53
src/app/api/admin/job/[id]/route.ts
Normal file
53
src/app/api/admin/job/[id]/route.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
export { GET };
|
||||
|
||||
async function GET(request: Request, { params }: { params: { id: string } }) {
|
||||
try {
|
||||
const { id } = params;
|
||||
const data = await prisma.job.findUnique({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
username: true,
|
||||
nomor: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
alamat: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
MasterStatus: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get data job-vacancy",
|
||||
data: data,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data job-vacancy", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Error get data job-vacancy",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
40
src/app/api/admin/job/dashboard/[status]/route.ts
Normal file
40
src/app/api/admin/job/dashboard/[status]/route.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request, { params }: {
|
||||
params: { status: string }
|
||||
}) {
|
||||
|
||||
const { status } = params;
|
||||
try {
|
||||
let fixData;
|
||||
const fixStatus = _.startCase(status);
|
||||
fixData = await prisma.job.count({
|
||||
where: {
|
||||
MasterStatus: {
|
||||
name: fixStatus,
|
||||
},
|
||||
isArsip: false,
|
||||
}
|
||||
});
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success get data job-vacancy dashboard",
|
||||
data: fixData
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data job-vacancy dashboard", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get data job-vacancy dashboard",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
35
src/app/api/admin/job/dashboard/arsip/route.ts
Normal file
35
src/app/api/admin/job/dashboard/arsip/route.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const method = request.method;
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
fixData = await prisma.job.count({
|
||||
where: {
|
||||
MasterStatus: {
|
||||
name: "Publish"
|
||||
},
|
||||
isArsip: true
|
||||
}
|
||||
})
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success get data job-vacancy dashboard",
|
||||
data: fixData
|
||||
},
|
||||
{ status: 200 }
|
||||
)
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data job-vacancy dashboard", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get data job-vacancy dashboard",
|
||||
reason: (error as Error).message
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
116
src/app/api/admin/job/status/[name]/route.ts
Normal file
116
src/app/api/admin/job/status/[name]/route.ts
Normal file
@@ -0,0 +1,116 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{
|
||||
params,
|
||||
}: {
|
||||
params: { name: string };
|
||||
}
|
||||
) {
|
||||
const method = request.method;
|
||||
if (method !== "GET") {
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Method not allowed",
|
||||
},
|
||||
{ status: 405 }
|
||||
);
|
||||
}
|
||||
const { name } = params;
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get("search");
|
||||
const page = searchParams.get("page");
|
||||
const takeData = 10
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
const fixStatus = _.startCase(name);
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.job.findMany({
|
||||
orderBy: {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
isActive: true,
|
||||
isArsip: false,
|
||||
MasterStatus: {
|
||||
name: fixStatus,
|
||||
},
|
||||
title: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: true,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const data = await prisma.job.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
isActive: true,
|
||||
isArsip: false,
|
||||
MasterStatus: {
|
||||
name: fixStatus,
|
||||
},
|
||||
title: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.job.count({
|
||||
where: {
|
||||
isActive: true,
|
||||
isArsip: false,
|
||||
MasterStatus: {
|
||||
name: fixStatus,
|
||||
},
|
||||
title: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nPage: _.ceil(nCount / takeData),
|
||||
};
|
||||
}
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Data found",
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Eror get data", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Data not found",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
29
src/app/api/admin/main_dashboard/portofolio/route.ts
Normal file
29
src/app/api/admin/main_dashboard/portofolio/route.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
try {
|
||||
const data = await prisma.portofolio.count({
|
||||
where: {
|
||||
active: true
|
||||
}
|
||||
});
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Data portofolio",
|
||||
data: data
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error Get Count Portofolio Main Dashboard")
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error Get Count Portofolio Main Dashboard",
|
||||
data: null
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
35
src/app/api/admin/main_dashboard/user/route.ts
Normal file
35
src/app/api/admin/main_dashboard/user/route.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const method = request.method;
|
||||
|
||||
try {
|
||||
const data = await prisma.user.count({
|
||||
where: {
|
||||
active: true
|
||||
},
|
||||
|
||||
|
||||
})
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Data user",
|
||||
data: data
|
||||
},
|
||||
{ status: 200 }
|
||||
)
|
||||
} catch (error) {
|
||||
backendLogger.error("Error Get Count User Main Dashboard")
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Gagal mendapatkan data",
|
||||
reason: (error as Error).message
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
32
src/app/api/admin/master/bank/route.ts
Normal file
32
src/app/api/admin/master/bank/route.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@/lib";
|
||||
|
||||
export { GET };
|
||||
|
||||
async function GET(request: Request) {
|
||||
try {
|
||||
const data = await prisma.masterBank.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(
|
||||
{ success: true, message: "Berhasil mendapatkan data", data: data },
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(
|
||||
"Error Get Master Bank >>",
|
||||
error || (error as Error).message
|
||||
);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "API Error Get Master Bank ",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
32
src/app/api/admin/master/bidang-bisnis/route.ts
Normal file
32
src/app/api/admin/master/bidang-bisnis/route.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@/lib";
|
||||
|
||||
export { GET };
|
||||
|
||||
async function GET(request: Request) {
|
||||
try {
|
||||
const data = await prisma.masterBidangBisnis.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(
|
||||
{ success: true, message: "Berhasil mendapatkan data", data: data },
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(
|
||||
"Error Get Master Bidang Bisnis >>",
|
||||
error || (error as Error).message
|
||||
);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "API Error Get Master Bidang Bisnis ",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
106
src/app/api/admin/notifikasi/[id]/route.ts
Normal file
106
src/app/api/admin/notifikasi/[id]/route.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
export { GET, POST };
|
||||
async function GET(request: Request, { params }: { params: { id: string } }) {
|
||||
try {
|
||||
let fixData;
|
||||
const { id } = params;
|
||||
const userLoginId = id;
|
||||
|
||||
if (!id) {
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "ID not provided" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
const { searchParams } = new URL(request.url);
|
||||
const page = searchParams.get("page");
|
||||
const takeData = 10;
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.notifikasi.findMany({
|
||||
orderBy: [
|
||||
{
|
||||
isRead: "asc",
|
||||
},
|
||||
{
|
||||
createdAt: "desc",
|
||||
},
|
||||
],
|
||||
where: {
|
||||
adminId: userLoginId,
|
||||
userRoleId: "2",
|
||||
},
|
||||
});
|
||||
} else {
|
||||
fixData = await prisma.notifikasi.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: [
|
||||
{
|
||||
isRead: "asc",
|
||||
},
|
||||
{
|
||||
createdAt: "desc",
|
||||
},
|
||||
],
|
||||
where: {
|
||||
adminId: id,
|
||||
userRoleId: "2",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Data fetched successfully",
|
||||
data: fixData,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error fetching notifications:", error);
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Failed to fetch notifications" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function POST(request: Request, { params }: { params: { id: string } }) {
|
||||
try {
|
||||
const { id } = params;
|
||||
const userLoginId = id;
|
||||
|
||||
if (!id) {
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "ID not provided" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
const data = await request.json();
|
||||
|
||||
const updatedData = await prisma.notifikasi.updateMany({
|
||||
where: {
|
||||
adminId: userLoginId,
|
||||
},
|
||||
data: {
|
||||
isRead: data.isRead,
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Notification updated successfully",
|
||||
data: updatedData,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error updating notification:", error);
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Failed to update notification" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
46
src/app/api/admin/notifikasi/count/route.tsx
Normal file
46
src/app/api/admin/notifikasi/count/route.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@/lib";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const method = request.method;
|
||||
if (method !== "GET") {
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Method not allowed" },
|
||||
{ status: 405 }
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const userId = searchParams.get("id");
|
||||
|
||||
const data = await prisma.notifikasi.count({
|
||||
where: {
|
||||
adminId: userId,
|
||||
userRoleId: "2",
|
||||
isRead: false,
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Data fetched successfully",
|
||||
data: data,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Error get count notifikasi", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Failed to get count notifikasi",
|
||||
data: null,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import adminNotifikasi_getByUserId from "@/app_modules/admin/notifikasi/fun/get/get_notifikasi_by_user_id";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
|
||||
|
||||
return NextResponse.json({ success: true });
|
||||
}
|
||||
39
src/app/api/admin/sticker/[id]/activation/route.ts
Normal file
39
src/app/api/admin/sticker/[id]/activation/route.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@/lib";
|
||||
|
||||
export { PUT };
|
||||
|
||||
async function PUT(request: Request, { params }: { params: { id: string } }) {
|
||||
const method = request.method;
|
||||
if (method !== "PUT") {
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Method not allowed" },
|
||||
{ status: 405 }
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
const { id } = params;
|
||||
const data = await request.json();
|
||||
|
||||
const sticker = await prisma.sticker.update({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
data: {
|
||||
isActive: data.isActive,
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(
|
||||
{ success: true, message: "Success update data sticker", data: sticker },
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Error update data sticker", error);
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Error update data sticker" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
139
src/app/api/admin/sticker/[id]/route.ts
Normal file
139
src/app/api/admin/sticker/[id]/route.ts
Normal file
@@ -0,0 +1,139 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@/lib";
|
||||
|
||||
export { GET, PUT, DELETE };
|
||||
|
||||
async function GET(request: Request, { params }: { params: { id: string } }) {
|
||||
const method = request.method;
|
||||
if (method !== "GET") {
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Method not allowed" },
|
||||
{ status: 405 }
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
const { id } = params;
|
||||
|
||||
const sticker = await prisma.sticker.findUnique({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
include: {
|
||||
MasterEmotions: true,
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(
|
||||
{ success: true, message: "Success get data sticker", data: sticker },
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Error get data sticker", error);
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Error get data sticker" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function PUT(request: Request, { params }: { params: { id: string } }) {
|
||||
const method = request.method;
|
||||
if (method !== "PUT") {
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Method not allowed" },
|
||||
{ status: 405 }
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
const { id } = params;
|
||||
const data = await request.json();
|
||||
|
||||
if (data.fileId) {
|
||||
const updatedDataWithFile = await prisma.sticker.update({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
data: {
|
||||
fileId: data.fileId,
|
||||
MasterEmotions: {
|
||||
set: data.emotions.map((value: string) => ({ value })), // ✅ replace relasi
|
||||
},
|
||||
jenisKelamin: data.jenisKelamin,
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Sticker updated successfully",
|
||||
data: updatedDataWithFile,
|
||||
});
|
||||
}
|
||||
|
||||
const updatedDataWithoutFile = await prisma.sticker.update({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
data: {
|
||||
MasterEmotions: {
|
||||
set: data.emotions.map((value: string) => ({ value })), // ✅ replace relasi
|
||||
},
|
||||
jenisKelamin: data.jenisKelamin,
|
||||
},
|
||||
});
|
||||
|
||||
if (!updatedDataWithoutFile) {
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Failed to update sticker" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Sticker updated successfully",
|
||||
data: updatedDataWithoutFile,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error updating sticker:", error);
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Failed to update sticker" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function DELETE(
|
||||
request: Request,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
const method = request.method;
|
||||
if (method !== "DELETE") {
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Method not allowed" },
|
||||
{ status: 405 }
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
const { id } = params;
|
||||
|
||||
const sticker = await prisma.sticker.delete({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(
|
||||
{ success: true, message: "Success delete sticker", data: sticker },
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Error delete sticker", error);
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Error delete sticker" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
113
src/app/api/admin/sticker/route.ts
Normal file
113
src/app/api/admin/sticker/route.ts
Normal file
@@ -0,0 +1,113 @@
|
||||
import { prisma } from "@/lib";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export { GET, POST };
|
||||
|
||||
interface IPostSticker {
|
||||
fileId: string;
|
||||
emotions: string[];
|
||||
gender: "Laki-laki" | "Perempuan" | null;
|
||||
}
|
||||
|
||||
async function POST(request: Request) {
|
||||
const method = request.method;
|
||||
if (method !== "POST") {
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Method not allowed" },
|
||||
{ status: 405 }
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
const { fileId, emotions, gender } = await request.json();
|
||||
|
||||
const newStiker = await prisma.sticker.create({
|
||||
data: {
|
||||
fileId,
|
||||
MasterEmotions: {
|
||||
connect: emotions.map((value: string) => ({ value })), // id = number[]
|
||||
},
|
||||
jenisKelamin: gender,
|
||||
},
|
||||
});
|
||||
|
||||
if (!newStiker) {
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Gagal membuat stiker" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{ success: true, message: "Berhasil membuat stiker" },
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Error create sticker", error);
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Failed to create sticker" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function GET(request: Request) {
|
||||
const method = request.method;
|
||||
if (method !== "GET") {
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Method not allowed" },
|
||||
{ status: 405 }
|
||||
);
|
||||
}
|
||||
|
||||
let fixData;
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get("search");
|
||||
const page = searchParams.get("page");
|
||||
const dataTake = 10;
|
||||
const dataSkip = Number(page) * dataTake - dataTake;
|
||||
|
||||
try {
|
||||
if (!page) {
|
||||
fixData = await prisma.sticker.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
include: {
|
||||
MasterEmotions: true,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const data = await prisma.sticker.findMany({
|
||||
skip: dataSkip,
|
||||
take: dataTake,
|
||||
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
include: {
|
||||
MasterEmotions: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.sticker.count({});
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nPage: _.ceil(nCount / dataTake),
|
||||
};
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{ success: true, message: "Success get data sticker", data: fixData },
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Error get data sticker", error);
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Error get data sticker" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
75
src/app/api/admin/user/route.ts
Normal file
75
src/app/api/admin/user/route.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
try {
|
||||
let fixData;
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get("search");
|
||||
const page = searchParams.get("page");
|
||||
const takeData = 10;
|
||||
const skipData = Number(page) * takeData - takeData;
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.user.findMany({
|
||||
orderBy: {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
masterUserRoleId: "1",
|
||||
username: {
|
||||
contains: search || "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const getData = await prisma.user.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
orderBy: {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
masterUserRoleId: "1",
|
||||
username: {
|
||||
contains: search || "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.user.count({
|
||||
where: {
|
||||
masterUserRoleId: "1",
|
||||
username: {
|
||||
contains: search || "",
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
fixData = {
|
||||
data: getData,
|
||||
nPage: _.ceil(nCount / takeData),
|
||||
};
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Success get data",
|
||||
data: fixData,
|
||||
},
|
||||
{
|
||||
status: 200,
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Internal Server Error" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
67
src/app/api/admin/vote/[id]/kontributor/route.ts
Normal file
67
src/app/api/admin/vote/[id]/kontributor/route.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@/lib";
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
try {
|
||||
const { id } = params;
|
||||
|
||||
// Validasi ID
|
||||
if (!id) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "ID is required",
|
||||
},
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
const data = await prisma.voting_Kontributor.findMany({
|
||||
where: {
|
||||
votingId: id,
|
||||
},
|
||||
select: {
|
||||
Voting_DaftarNamaVote: true,
|
||||
Author: {
|
||||
select: {
|
||||
username: true,
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Penanganan data tidak ditemukan
|
||||
if (!data) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Voting data not found",
|
||||
},
|
||||
{ status: 404 }
|
||||
);
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
data: data,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error fetching voting data >>", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Error fetching voting data",
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
63
src/app/api/admin/vote/[id]/route.tsx
Normal file
63
src/app/api/admin/vote/[id]/route.tsx
Normal file
@@ -0,0 +1,63 @@
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@/lib";
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
try {
|
||||
const { id } = params;
|
||||
|
||||
// Validasi ID
|
||||
if (!id) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "ID is required",
|
||||
},
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
const fixData = await prisma.voting.findUnique({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
include: {
|
||||
Author: true,
|
||||
Voting_Status: true,
|
||||
Voting_DaftarNamaVote: true,
|
||||
},
|
||||
});
|
||||
|
||||
// Penanganan data tidak ditemukan
|
||||
if (!fixData) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Voting data not found",
|
||||
},
|
||||
{ status: 404 }
|
||||
);
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
data: fixData,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error fetching voting data >>", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Error fetching voting data",
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user