Compare commits

...

40 Commits

Author SHA1 Message Date
f06482a159 fix version 2025-12-10 17:31:23 +08:00
7ab25655f2 chore(release): 1.5.26 2025-12-10 17:30:39 +08:00
9d17b442e2 Fix api APP Informastion untuk QC ( Ayu )
Fix:
- modified:   src/app/api/mobile/admin/master/business-field/[id]/route.ts
- modified:   src/app/api/mobile/admin/master/business-field/route.ts

### No Issue
2025-12-10 17:28:59 +08:00
b3410a5804 Fix API Mobile for QC: Ayu
Fix:
- modified:   src/app/api/mobile/admin/forum/route.ts

### No Issue
2025-12-09 17:38:25 +08:00
2cdc57d844 chore(release): 1.5.25 2025-12-09 17:33:33 +08:00
695046583f Fix API untuk QC: Ayu
Fix:
- modified:   src/app/api/mobile/admin/collaboration/[id]/route.ts
- modified:   src/app/api/mobile/collaboration/route.ts
- modified:   src/app/api/mobile/voting/route.ts

### No Issue
2025-12-09 14:31:02 +08:00
6ee0b98f07 Fix Apple Reject
Add:
- prisma/migrations/20251208042529_add_accepted_terms_at/
- prisma/schema.prisma.backup
- src/app/api/mobile/user/[id]/terms-of-app/

Fix:

prisma/schema.prisma
src/app/api/auth/mobile-register/route.ts
src/app/api/mobile/forum/[id]/report-commentar/route.ts
src/app/api/mobile/forum/[id]/report-posting/route.ts

### No Issue
2025-12-08 15:29:12 +08:00
cc78d82ca4 chore(release): 1.5.24 2025-12-08 15:23:52 +08:00
3c2a8b3543 Fix QC Admin ( Inno )
- app.config.js
- app/(application)/(user)/forum/[id]/edit.tsx
- app/(application)/(user)/forum/[id]/index.tsx
- app/(application)/(user)/forum/create.tsx
- ios/HIPMIBadungConnect/Info.plist

### No Issue
2025-12-05 17:12:15 +08:00
276cf9e970 Fix QC Inno:
Fix:
- src/app/api/mobile/investment/[id]/news/route.ts

Add:
- src/app/api/mobile/admin/master/donation/

### No Issue
2025-12-04 17:43:09 +08:00
8ccf722c90 Fix wa server 2025-12-03 16:25:53 +08:00
7ad7b3496a chore(release): 1.5.22 2025-12-03 16:25:52 +08:00
c9c39f319c chore(release): 1.5.21 2025-12-03 14:58:17 +08:00
c976e6beaf Fix reject Apple :
Add:
src/app/api/auth/mobile-login/
        src/app/api/auth/mobile-register/
        src/app/api/auth/mobile-validasi/

Fix:
 modified:   bun.lock
        modified:   package.json
        modified:   src/app/api/mobile/voting/route.ts

### No Issue
2025-12-03 14:58:03 +08:00
4b21084748 Perubahan flow auth:
User ada : Login > Kode OTP > home
User tidak ada : Login > Register > Kote OTP > home

Add:
src/app/api/mobile/auth

### No Issue
2025-12-02 14:06:52 +08:00
3277d8cb19 chore(release): 1.5.20 2025-12-02 14:04:17 +08:00
b951c698c5 QC : Pak jun dan Inno
Fix:
modified:   src/app/api/mobile/portofolio/[id]/route.ts
modified:   src/app/api/mobile/voting/route.ts
modified:   src/bin/seeder/colab/master_industri.json

### No Issue
2025-12-01 17:39:42 +08:00
ad91a48d82 chore(release): 1.5.19 2025-12-01 17:37:19 +08:00
a06036cab7 Fix version 1.5.18 2025-11-28 11:46:41 +08:00
c3d8ccd490 chore(release): 1.5.18 2025-11-28 11:46:04 +08:00
ba6a83f61d Merge pull request 'Push Staging V 1.5.17' (#18) from push-staging/28-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/18
2025-11-28 11:24:15 +08:00
dc05c4ef7e Push Staging
### No Issue
2025-11-28 11:20:42 +08:00
d56a00a92b Merge pull request 'Penambahan fitur open blockir' (#17) from apple-reject/28-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/17
2025-11-28 10:49:04 +08:00
43deddca43 Penambahan fitur open blockir
Add:
- src/app/api/mobile/block-user/[id]/

Fix:
-src/app/api/mobile/block-user/route.ts

### No Issue
2025-11-28 10:48:18 +08:00
1e647c0391 Merge pull request 'Fix Apple Rejected' (#16) from fix-mobile/26-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/16
2025-11-27 12:18:18 +08:00
6f10ff7c3e API mobile forum
### No Issue
2025-11-26 16:16:08 +08:00
09be7739d5 Fix rejected Apple:
Penambahan fitur checklist terms of service dan penambahan database blockuser

Add:
- prisma/migrations/20251124061947_add_terms_of_service_accepted/
- prisma/migrations/20251124081155_add_blocked_user_and_menu_feature/
- prisma/migrations/20251124083155_fix_master_kategori_app_and_delete_menu_feature/
- public/terms-of-service.html
- src/app/api/auth/term-service/

Fix:
- prisma/schema.prisma
- src/app/api/auth/register/route.ts
- src/app/api/auth/validasi/route.ts
- src/app_modules/_global/fun/generate_seeder.ts
- src/bin/seeder/master/master_kategori_app.json
- src/bin/seeder/user_seeder.json
- src/middleware.tsx

### No Issue
2025-11-24 16:44:00 +08:00
38734cda8c chore(release): 1.5.17 2025-11-24 11:48:20 +08:00
94dc780ead Merge pull request 'Fix Rejected Apple' (#15) from fix-mobile/20-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/15
2025-11-20 15:40:50 +08:00
fb9515dfe4 Fix: delete all data user
src/app/api/mobile/user/[id]/route.ts

### No Issue
2025-11-20 15:39:36 +08:00
0b3d4830f9 chore(release): 1.5.16 2025-11-20 15:38:23 +08:00
c710ca60b7 Merge pull request 'Route: Delete Account' (#14) from fix-mobile/19-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/14
2025-11-19 17:49:17 +08:00
94e4b884a7 Fix:
- src/app/api/mobile/donation/route.ts
- src/app/api/mobile/user/[id]/route.ts

### NO Issue
2025-11-19 17:43:37 +08:00
4164092100 Merge pull request 'Delete Account & Support Center fix' (#13) from fix-mobile/18-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/13
2025-11-18 14:04:14 +08:00
fcad857422 Fix:
- src/app/(support)/delete-account/page.tsx
- src/app/(support)/support-center/page.tsx
- src/app/api/helper/support-center/route.ts

### No Issue
2025-11-18 14:02:17 +08:00
32619ee9b3 chore(release): 1.5.15 2025-11-18 14:00:58 +08:00
b118a6425c Merge pull request 'Fix Apple Rejected' (#12) from fix-mobile/17-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/12
2025-11-17 17:48:05 +08:00
09e1f702e1 Merge pull request 'fix-mobile/17-nov-25' (#11) from fix-mobile/17-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/11
2025-11-17 11:30:49 +08:00
ba5620bcc5 Merge pull request 'QRCode Mobile' (#10) from mobile-qrcode/13-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/10
2025-11-13 17:14:03 +08:00
24e6fcd0f7 Merge pull request 'Penambahan akses untuk metode scan QRCode:' (#9) from mobile-access/12-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/9
2025-11-12 16:38:49 +08:00
51 changed files with 3684 additions and 178 deletions

View File

@@ -2,6 +2,33 @@
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. All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
## [1.5.26](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.25...v1.5.26) (2025-12-10)
## [1.5.25](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.24...v1.5.25) (2025-12-09)
## [1.5.24](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.22...v1.5.24) (2025-12-08)
## [1.5.22](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.21...v1.5.22) (2025-12-03)
## [1.5.21](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.20...v1.5.21) (2025-12-03)
## [1.5.20](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.19...v1.5.20) (2025-12-02)
## [1.5.19](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.18...v1.5.19) (2025-12-01)
## [1.5.18](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.17...v1.5.18) (2025-11-28)
## [1.5.17](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.16...v1.5.17) (2025-11-24)
### Bug Fixes
* delete all data user ([fb9515d](https://wibugit.wibudev.com/wibu/hipmi/commit/fb9515dfe465ef07d43460ca4e9bb31705ec48b8))
## [1.5.16](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.15...v1.5.16) (2025-11-20)
## [1.5.15](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.14...v1.5.15) (2025-11-18)
## [1.5.14](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.13...v1.5.14) (2025-11-17) ## [1.5.14](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.13...v1.5.14) (2025-11-17)
## [1.5.13](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.12...v1.5.13) (2025-11-17) ## [1.5.13](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.12...v1.5.13) (2025-11-17)

View File

@@ -41,6 +41,7 @@
"autoprefixer": "10.4.14", "autoprefixer": "10.4.14",
"bufferutil": "^4.0.8", "bufferutil": "^4.0.8",
"bun": "^1.1.38", "bun": "^1.1.38",
"caniuse-lite": "^1.0.30001757",
"colors": "^1.4.0", "colors": "^1.4.0",
"date-fns": "^4.1.0", "date-fns": "^4.1.0",
"dayjs": "^1.11.10", "dayjs": "^1.11.10",
@@ -1388,7 +1389,7 @@
"camelize": ["camelize@1.0.1", "", {}, "sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ=="], "camelize": ["camelize@1.0.1", "", {}, "sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ=="],
"caniuse-lite": ["caniuse-lite@1.0.30001701", "", {}, "sha512-faRs/AW3jA9nTwmJBSO1PQ6L/EOgsB5HMQQq4iCu5zhPgVVgO/pZRHlmatwijZKetFw8/Pr4q6dEN8sJuq8qTw=="], "caniuse-lite": ["caniuse-lite@1.0.30001757", "", {}, "sha512-r0nnL/I28Zi/yjk1el6ilj27tKcdjLsNqAOZr0yVjWPrSQyHgKI2INaEWw21bAQSv2LXRt1XuCS/GomNpWOxsQ=="],
"canvas": ["canvas@3.1.0", "", { "dependencies": { "node-addon-api": "^7.0.0", "prebuild-install": "^7.1.1" } }, "sha512-tTj3CqqukVJ9NgSahykNwtGda7V33VLObwrHfzT0vqJXu7J4d4C/7kQQW3fOEGDfZZoILPut5H00gOjyttPGyg=="], "canvas": ["canvas@3.1.0", "", { "dependencies": { "node-addon-api": "^7.0.0", "prebuild-install": "^7.1.1" } }, "sha512-tTj3CqqukVJ9NgSahykNwtGda7V33VLObwrHfzT0vqJXu7J4d4C/7kQQW3fOEGDfZZoILPut5H00gOjyttPGyg=="],
@@ -3474,6 +3475,8 @@
"ast-types/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], "ast-types/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
"autoprefixer/caniuse-lite": ["caniuse-lite@1.0.30001701", "", {}, "sha512-faRs/AW3jA9nTwmJBSO1PQ6L/EOgsB5HMQQq4iCu5zhPgVVgO/pZRHlmatwijZKetFw8/Pr4q6dEN8sJuq8qTw=="],
"babel-plugin-polyfill-corejs2/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], "babel-plugin-polyfill-corejs2/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
"better-opn/open": ["open@8.4.2", "", { "dependencies": { "define-lazy-prop": "^2.0.0", "is-docker": "^2.1.1", "is-wsl": "^2.2.0" } }, "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ=="], "better-opn/open": ["open@8.4.2", "", { "dependencies": { "define-lazy-prop": "^2.0.0", "is-docker": "^2.1.1", "is-wsl": "^2.2.0" } }, "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ=="],
@@ -3482,6 +3485,8 @@
"blessed-contrib/strip-ansi": ["strip-ansi@3.0.1", "", { "dependencies": { "ansi-regex": "^2.0.0" } }, "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg=="], "blessed-contrib/strip-ansi": ["strip-ansi@3.0.1", "", { "dependencies": { "ansi-regex": "^2.0.0" } }, "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg=="],
"browserslist/caniuse-lite": ["caniuse-lite@1.0.30001701", "", {}, "sha512-faRs/AW3jA9nTwmJBSO1PQ6L/EOgsB5HMQQq4iCu5zhPgVVgO/pZRHlmatwijZKetFw8/Pr4q6dEN8sJuq8qTw=="],
"cacache/glob": ["glob@10.4.5", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg=="], "cacache/glob": ["glob@10.4.5", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg=="],
"caller-callsite/callsites": ["callsites@2.0.0", "", {}, "sha512-ksWePWBloaWPxJYQ8TL0JHvtci6G5QTKwQ95RcWAa/lzoAKuAOflGdAK92hpHXjkwb8zLxoLNUoNYZgVsaJzvQ=="], "caller-callsite/callsites": ["callsites@2.0.0", "", {}, "sha512-ksWePWBloaWPxJYQ8TL0JHvtci6G5QTKwQ95RcWAa/lzoAKuAOflGdAK92hpHXjkwb8zLxoLNUoNYZgVsaJzvQ=="],
@@ -3640,6 +3645,8 @@
"minizlib/minipass": ["minipass@3.3.6", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="], "minizlib/minipass": ["minipass@3.3.6", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="],
"next/caniuse-lite": ["caniuse-lite@1.0.30001701", "", {}, "sha512-faRs/AW3jA9nTwmJBSO1PQ6L/EOgsB5HMQQq4iCu5zhPgVVgO/pZRHlmatwijZKetFw8/Pr4q6dEN8sJuq8qTw=="],
"next/postcss": ["postcss@8.4.31", "", { "dependencies": { "nanoid": "^3.3.6", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" } }, "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ=="], "next/postcss": ["postcss@8.4.31", "", { "dependencies": { "nanoid": "^3.3.6", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" } }, "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ=="],
"next-dev/@mantine/hooks": ["@mantine/hooks@7.17.0", "", { "peerDependencies": { "react": "^18.x || ^19.x" } }, "sha512-vo3K49mLy1nJ8LQNb5KDbJgnX0xwt3Y8JOF3ythjB5LEFMptdLSSgulu64zj+QHtzvffFCsMb05DbTLLpVP/JQ=="], "next-dev/@mantine/hooks": ["@mantine/hooks@7.17.0", "", { "peerDependencies": { "react": "^18.x || ^19.x" } }, "sha512-vo3K49mLy1nJ8LQNb5KDbJgnX0xwt3Y8JOF3ythjB5LEFMptdLSSgulu64zj+QHtzvffFCsMb05DbTLLpVP/JQ=="],
@@ -4074,6 +4081,8 @@
"wibu/next/@swc/helpers": ["@swc/helpers@0.5.5", "", { "dependencies": { "@swc/counter": "^0.1.3", "tslib": "^2.4.0" } }, "sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A=="], "wibu/next/@swc/helpers": ["@swc/helpers@0.5.5", "", { "dependencies": { "@swc/counter": "^0.1.3", "tslib": "^2.4.0" } }, "sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A=="],
"wibu/next/caniuse-lite": ["caniuse-lite@1.0.30001701", "", {}, "sha512-faRs/AW3jA9nTwmJBSO1PQ6L/EOgsB5HMQQq4iCu5zhPgVVgO/pZRHlmatwijZKetFw8/Pr4q6dEN8sJuq8qTw=="],
"wibu/next/postcss": ["postcss@8.4.31", "", { "dependencies": { "nanoid": "^3.3.6", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" } }, "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ=="], "wibu/next/postcss": ["postcss@8.4.31", "", { "dependencies": { "nanoid": "^3.3.6", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" } }, "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ=="],
"wibu/react-dom/scheduler": ["scheduler@0.23.2", "", { "dependencies": { "loose-envify": "^1.1.0" } }, "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ=="], "wibu/react-dom/scheduler": ["scheduler@0.23.2", "", { "dependencies": { "loose-envify": "^1.1.0" } }, "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ=="],

View File

@@ -1,6 +1,6 @@
{ {
"name": "hipmi", "name": "hipmi",
"version": "1.5.14", "version": "1.5.26",
"private": true, "private": true,
"prisma": { "prisma": {
"seed": "bun prisma/seed.ts" "seed": "bun prisma/seed.ts"
@@ -52,6 +52,7 @@
"autoprefixer": "10.4.14", "autoprefixer": "10.4.14",
"bufferutil": "^4.0.8", "bufferutil": "^4.0.8",
"bun": "^1.1.38", "bun": "^1.1.38",
"caniuse-lite": "^1.0.30001757",
"colors": "^1.4.0", "colors": "^1.4.0",
"date-fns": "^4.1.0", "date-fns": "^4.1.0",
"dayjs": "^1.11.10", "dayjs": "^1.11.10",

View File

@@ -0,0 +1,5 @@
-- AlterTable
ALTER TABLE "Donasi_Invoice" ALTER COLUMN "masterBankId" SET DEFAULT 'null';
-- AlterTable
ALTER TABLE "User" ADD COLUMN "termsOfServiceAccepted" BOOLEAN NOT NULL DEFAULT false;

View File

@@ -0,0 +1,35 @@
-- CreateTable
CREATE TABLE "BlockedUser" (
"id" TEXT NOT NULL,
"isActive" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"blockerId" TEXT NOT NULL,
"blockedId" TEXT NOT NULL,
"menuFeatureId" TEXT NOT NULL,
CONSTRAINT "BlockedUser_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "MenuFeature" (
"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,
CONSTRAINT "MenuFeature_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "BlockedUser_blockerId_blockedId_key" ON "BlockedUser"("blockerId", "blockedId");
-- AddForeignKey
ALTER TABLE "BlockedUser" ADD CONSTRAINT "BlockedUser_menuFeatureId_fkey" FOREIGN KEY ("menuFeatureId") REFERENCES "MenuFeature"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "BlockedUser" ADD CONSTRAINT "BlockedUser_blockerId_fkey" FOREIGN KEY ("blockerId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "BlockedUser" ADD CONSTRAINT "BlockedUser_blockedId_fkey" FOREIGN KEY ("blockedId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@@ -0,0 +1,14 @@
/*
Warnings:
- You are about to drop the `MenuFeature` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE "BlockedUser" DROP CONSTRAINT "BlockedUser_menuFeatureId_fkey";
-- DropTable
DROP TABLE "MenuFeature";
-- AddForeignKey
ALTER TABLE "BlockedUser" ADD CONSTRAINT "BlockedUser_menuFeatureId_fkey" FOREIGN KEY ("menuFeatureId") REFERENCES "MasterKategoriApp"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "User" ADD COLUMN "acceptedForumTermsAt" TIMESTAMP(3),
ADD COLUMN "acceptedTermsAt" TIMESTAMP(3);

View File

@@ -49,8 +49,15 @@ model User {
BusinessMaps BusinessMaps[] BusinessMaps BusinessMaps[]
Investasi_Invoice Investasi_Invoice[] Investasi_Invoice Investasi_Invoice[]
EventSponsor EventSponsor[] EventSponsor EventSponsor[]
EventTransaksi EventTransaksi[] EventTransaksi EventTransaksi[]
termsOfServiceAccepted Boolean @default(false)
blockedUsers BlockedUser[] @relation("Blocking")
blockedBy BlockedUser[] @relation("BlockedBy")
acceptedTermsAt DateTime?
acceptedForumTermsAt DateTime?
} }
model MasterUserRole { model MasterUserRole {
@@ -1011,6 +1018,8 @@ model MasterKategoriApp {
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt
name String name String
value String? value String?
blockedUsers BlockedUser[]
} }
// ======================= EVENT ======================= // // ======================= EVENT ======================= //
@@ -1073,3 +1082,20 @@ model Sticker {
MasterEmotions MasterEmotions[] @relation("StikerEmotions") MasterEmotions MasterEmotions[] @relation("StikerEmotions")
} }
model BlockedUser {
id String @id @default(uuid())
isActive Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
blockerId String // ID user yang memblokir
blockedId String // ID user yang diblokir
menuFeatureId String
menuFeature MasterKategoriApp @relation(fields: [menuFeatureId], references: [id])
blocker User @relation("BlockedBy", fields: [blockerId], references: [id])
blocked User @relation("Blocking", fields: [blockedId], references: [id])
@@unique([blockerId, blockedId])
}

1098
prisma/schema.prisma.backup Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,110 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Syarat & Ketentuan - HIPMI Badung Connect</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
line-height: 1.6;
color: #333;
max-width: 800px;
margin: 40px auto;
padding: 0 20px;
}
h1, h2, h3 {
color: #1a365d;
}
ul {
padding-left: 20px;
}
footer {
margin-top: 40px;
font-size: 0.9em;
color: #666;
border-top: 1px solid #eee;
padding-top: 20px;
}
</style>
</head>
<body>
<h1>Syarat & Ketentuan Penggunaan HIPMI Badung Connect</h1>
<p>
Dengan menggunakan aplikasi <strong>HIPMI Badung Connect</strong> (“Aplikasi”), Anda setuju untuk mematuhi dan terikat oleh syarat dan ketentuan berikut. Jika Anda tidak setuju dengan ketentuan ini, harap jangan gunakan Aplikasi.
</p>
<h2>1. Definisi</h2>
<p>
<strong>HIPMI Badung Connect</strong> adalah platform digital resmi untuk anggota Himpunan Pengusaha Muda Indonesia (HIPMI) Kabupaten Badung, yang bertujuan memfasilitasi jaringan, kolaborasi, dan pertumbuhan bisnis para pengusaha muda.
</p>
<h2>2. Larangan Konten Tidak Pantas</h2>
<p>
Anda <strong>dilarang keras</strong> memposting, mengirim, membagikan, atau mengunggah konten apa pun yang mengandung:
</p>
<ul>
<li>Ujaran kebencian, diskriminasi, atau konten SARA (Suku, Agama, Ras, Antar-golongan)</li>
<li>Pornografi, konten seksual eksplisit, atau gambar tidak senonoh</li>
<li>Ancaman, pelecehan, bullying, atau perilaku melecehkan</li>
<li>Informasi palsu, hoaks, spam, atau konten menyesatkan</li>
<li>Konten ilegal, melanggar hukum, atau melanggar hak kekayaan intelektual pihak lain</li>
<li>Promosi narkoba, perjudian, atau aktivitas ilegal lainnya</li>
</ul>
<h2>3. Tanggung Jawab Pengguna</h2>
<p>
Anda bertanggung jawab penuh atas setiap konten yang Anda unggah atau bagikan melalui fitur-fitur berikut:
</p>
<ul>
<li>Profil (bio, foto, portofolio)</li>
<li>Forum diskusi</li>
<li>Chat pribadi atau grup</li>
<li>Lowongan kerja, investasi, dan donasi</li>
</ul>
<p>
Konten yang melanggar ketentuan ini dapat dihapus kapan saja tanpa pemberitahuan.
</p>
<h2>4. Tindakan terhadap Pelanggaran</h2>
<p>
Jika kami menerima laporan atau menemukan konten yang melanggar ketentuan ini, kami akan:
</p>
<ul>
<li>Segera menghapus konten tersebut</li>
<li>Memberikan peringatan atau memblokir akun pengguna</li>
<li>Dalam kasus berat, melaporkan ke pihak berwajib sesuai hukum yang berlaku</li>
</ul>
<p>
Tim kami berkomitmen untuk menanggapi laporan konten tidak pantas <strong>dalam waktu 24 jam</strong>.
</p>
<h2>5. Mekanisme Pelaporan</h2>
<p>
Anda dapat melaporkan konten atau pengguna yang mencurigakan melalui:
</p>
<ul>
<li>Tombol <strong>“Laporkan”</strong> di setiap posting forum atau pesan chat</li>
<li>Tombol <strong>“Blokir Pengguna”</strong> di profil pengguna</li>
</ul>
<p>
Setiap laporan akan ditangani secara rahasia dan segera.
</p>
<h2>6. Perubahan Ketentuan</h2>
<p>
Kami berhak memperbarui Syarat & Ketentuan ini sewaktu-waktu. Versi terbaru akan dipublikasikan di halaman ini dengan tanggal revisi yang diperbarui.
</p>
<h2>7. Kontak</h2>
<p>
Jika Anda memiliki pertanyaan tentang ketentuan ini, silakan hubungi kami di:
<strong>bip.baliinteraktifperkasa@gmail.com</strong>
</p>
<footer>
<p>© 2025 Bali Interaktif Perkasa. All rights reserved.</p>
</footer>
</body>
</html>

View File

@@ -20,6 +20,7 @@ export default function DeleteAccount() {
const [data, setData] = useState({ const [data, setData] = useState({
description: "", description: "",
}); });
const [isLoading, setIsLoading] = useState(false);
useEffect(() => { useEffect(() => {
// Hanya di client, setelah mount // Hanya di client, setelah mount
@@ -31,15 +32,32 @@ export default function DeleteAccount() {
}, []); }, []);
const handlerSubmit = async () => { const handlerSubmit = async () => {
if (!phoneNumber || !data.description) { if (!phoneNumber) {
return notifications.show({ return notifications.show({
title: "Error", title: "Error",
message: "Please fill in description & phone number", message: "Please check your phone number",
color: "red",
});
}
if (!data.description) {
return notifications.show({
title: "Error",
message: "Please fill in description with 'Delete Account'",
color: "red",
});
}
if (data.description !== "Delete Account") {
return notifications.show({
title: "Error",
message: "Please fill in description with 'Delete Account'",
color: "red", color: "red",
}); });
} }
try { try {
setIsLoading(true);
const response = await fetch("/api/helper/delete-account", { const response = await fetch("/api/helper/delete-account", {
method: "POST", method: "POST",
headers: { headers: {
@@ -67,12 +85,14 @@ export default function DeleteAccount() {
if (!result.success) { if (!result.success) {
notifications.show({ notifications.show({
title: "Error", title: "Error",
message: result.error, message: result.error || "Failed to delete account.",
color: "red", color: "red",
}); });
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} finally {
setIsLoading(false);
} }
}; };
@@ -121,7 +141,7 @@ export default function DeleteAccount() {
/> />
</Grid.Col> </Grid.Col>
<Grid.Col span={4}> <Grid.Col span={4}>
<Button onClick={handlerSubmit} w={"100%"}> <Button onClick={handlerSubmit} w={"100%"} loading={isLoading}>
Submit Submit
</Button> </Button>
</Grid.Col> </Grid.Col>

View File

@@ -1,15 +1,15 @@
"use client"; "use client";
import { import {
Box, Box,
Button, Button,
Group, Group,
Paper, Paper,
SimpleGrid, SimpleGrid,
Stack, Stack,
Text, Text,
Textarea, Textarea,
TextInput, TextInput,
Title Title,
} from "@mantine/core"; } from "@mantine/core";
import { notifications } from "@mantine/notifications"; import { notifications } from "@mantine/notifications";
import { IconBrandGmail, IconLocation } from "@tabler/icons-react"; import { IconBrandGmail, IconLocation } from "@tabler/icons-react";
@@ -22,6 +22,7 @@ export default function SupportCenter() {
title: "", title: "",
description: "", description: "",
}); });
const [isLoading, setLoading] = useState(false);
const handleSubmit = async () => { const handleSubmit = async () => {
if (!data.email || !data.title || !data.description) { if (!data.email || !data.title || !data.description) {
@@ -32,35 +33,43 @@ export default function SupportCenter() {
}); });
} }
const response = await fetch("/api/helper/support-center", { try {
method: "POST", setLoading(true);
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
const result = await response.json();
if (result.success) { const response = await fetch("/api/helper/support-center", {
notifications.show({ method: "POST",
title: "Success", headers: {
color: "green", "Content-Type": "application/json",
message: "Message sent successfully.", },
body: JSON.stringify(data),
}); });
const result = await response.json();
setData({ if (result.success) {
email: "", notifications.show({
title: "", title: "Success",
description: "", color: "green",
}); message: "Message sent successfully.",
} });
if (!result.success) { setData({
notifications.show({ email: "",
title: "Error", title: "",
color: "red", description: "",
message: result.error, });
}); }
if (!result.success) {
notifications.show({
title: "Error",
color: "red",
message: result.error || "Failed to send message.",
});
}
} catch (error) {
console.log(error);
} finally {
setLoading(false);
} }
}; };
@@ -177,7 +186,11 @@ export default function SupportCenter() {
}} }}
/> />
<Button color="yellow" onClick={() => handleSubmit()}> <Button
loading={isLoading}
color="yellow"
onClick={() => handleSubmit()}
>
Submit Submit
</Button> </Button>
</Stack> </Stack>

View File

@@ -0,0 +1,82 @@
import { prisma } from "@/lib";
import { randomOTP } from "@/app_modules/auth/fun/rondom_otp";
import { NextResponse } from "next/server";
export async function POST(req: Request) {
try {
const codeOtp = randomOTP();
const body = await req.json();
console.log("[Masuk API]", body);
const { nomor } = body;
const user = await prisma.user.findUnique({
where: {
nomor: nomor,
},
});
console.log(["cek user", user]);
console.log(["cek nomor", nomor]);
if (!user)
return NextResponse.json({
success: false,
message: "User tidak ditemukan",
status: 404,
});
const createOtpId = await prisma.kodeOtp.create({
data: {
nomor: nomor,
otp: codeOtp,
},
});
if (!createOtpId)
return NextResponse.json(
{ success: false, message: "Gagal mengirim kode OTP" },
{ status: 400 }
);
// const msg = `HIPMI - Kode ini bersifat RAHASIA dan JANGAN DI BAGIKAN KEPAADA SIAPAPUN, termasuk anggota ataupun pengurus HIPMI lainnya.\n\n\n> Kode OTP anda: ${codeOtp}.`;
// const encodedMsg = encodeURIComponent(msg);
const msg = `HIPMI%20-%20Kode%20ini%20bersifat%20RAHASIA%20dan%20JANGAN%20DI%20BAGIKAN%20KEPADA%20SIAPAPUN%2C%20termasuk%20anggota%20ataupun%20pengurus%20HIPMI%20lainnya.%20Kode%20OTP%20anda%3A%20${codeOtp}.`;
const res = await fetch(
`https://cld-dkr-prod-wajs-server.wibudev.com/api/wa/code?nom=${nomor}&text=${msg}`,
{
cache: "no-cache",
headers: {
Authorization: `Bearer ${process.env.WA_SERVER_TOKEN}`,
},
}
);
if (res.status !== 200)
return NextResponse.json(
{ success: false, message: "Nomor Whatsapp Tidak Aktif" },
{ status: 400 }
);
const sendWa = await res.text();
console.log("WA Response:", sendWa);
return NextResponse.json(
{
success: true,
message: "Kode verifikasi terkirim",
kodeId: createOtpId.id,
},
{ status: 200 }
);
} catch (error) {
return NextResponse.json(
{
success: false,
message: "Terjadi masalah saat login",
reason: error as Error,
},
{ status: 500 }
);
}
}

View File

@@ -0,0 +1,109 @@
import { sessionCreate } from "@/app/(auth)/_lib/session_create";
import { randomOTP } from "@/app_modules/auth/fun/rondom_otp";
import prisma from "@/lib/prisma";
import { NextResponse } from "next/server";
export async function POST(req: Request) {
if (req.method !== "POST") {
return NextResponse.json(
{ success: false, message: "Method Not Allowed" },
{ status: 405 }
);
}
const { data } = await req.json();
console.log("data >>", data);
const codeOtp = randomOTP();
try {
const cekUsername = await prisma.user.findUnique({
where: {
username: data.username,
},
});
if (cekUsername)
return NextResponse.json({
success: false,
message: "Username sudah digunakan",
});
// ✅ Validasi wajib setuju Terms
if (data.termsOfServiceAccepted !== true) {
return NextResponse.json({
success: false,
message: "You must agree to the Terms of Service",
});
}
const createUser = await prisma.user.create({
data: {
username: data.username,
nomor: data.nomor,
active: false,
termsOfServiceAccepted: data.termsOfServiceAccepted,
acceptedTermsAt: new Date(),
},
});
if (!createUser)
return NextResponse.json(
{ success: false, message: "Gagal Registrasi" },
{ status: 500 }
);
// const token = await sessionCreate({
// sessionKey: process.env.NEXT_PUBLIC_BASE_SESSION_KEY!,
// encodedKey: process.env.NEXT_PUBLIC_BASE_TOKEN_KEY!,
// user: createUser as any,
// });
const createOtpId = await prisma.kodeOtp.create({
data: {
nomor: data.nomor,
otp: codeOtp,
},
});
if (!createOtpId)
return NextResponse.json(
{ success: false, message: "Gagal mengirim kode OTP" },
{ status: 400 }
);
// const msg = `HIPMI - Kode ini bersifat RAHASIA dan JANGAN DI BAGIKAN KEPAADA SIAPAPUN, termasuk anggota ataupun pengurus HIPMI lainnya.\n\n\n> Kode OTP anda: ${codeOtp}.`;
const msg = `HIPMI%20-%20Kode%20ini%20bersifat%20RAHASIA%20dan%20JANGAN%20DI%20BAGIKAN%20KEPADA%20SIAPAPUN%2C%20termasuk%20anggota%20ataupun%20pengurus%20HIPMI%20lainnya.%20Kode%20OTP%20anda%3A%20${codeOtp}.`;
// // const encodedMsg = encodeURIComponent(msg);
const res = await fetch(
`https://wa.wibudev.com/code?nom=${data.nomor}&text=${msg}`,
{ cache: "no-cache" }
);
const sendWa = await res.json();
if (sendWa.status !== "success")
return NextResponse.json(
{ success: false, message: "Nomor Whatsapp Tidak Aktif" },
{ status: 400 }
);
return NextResponse.json(
{
success: true,
message: "Registrasi Berhasil",
// token: token,
kodeId: createOtpId.id,
},
{ status: 201 }
);
} catch (error) {
return NextResponse.json(
{
success: false,
message: "Maaf, Terjadi Keselahan",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}

View File

@@ -0,0 +1,82 @@
import { sessionCreate } from "@/app/(auth)/_lib/session_create";
import prisma from "@/lib/prisma";
import backendLogger from "@/util/backendLogger";
import { NextResponse } from "next/server";
export async function POST(req: Request) {
if (req.method !== "POST") {
return NextResponse.json(
{ success: false, message: "Method Not Allowed" },
{ status: 405 }
);
}
try {
const { nomor } = await req.json();
const dataUser = await prisma.user.findUnique({
where: {
nomor: nomor,
},
select: {
id: true,
nomor: true,
username: true,
active: true,
masterUserRoleId: true,
termsOfServiceAccepted: true,
},
});
if (dataUser == null)
return NextResponse.json(
{ success: false, message: "Nomor Belum Terdaftar" },
{ status: 200 }
);
const token = await sessionCreate({
sessionKey: process.env.NEXT_PUBLIC_BASE_SESSION_KEY!,
encodedKey: process.env.NEXT_PUBLIC_BASE_TOKEN_KEY!,
user: dataUser as any,
});
if (!token) {
return NextResponse.json(
{ success: false, message: "Gagal membuat session" },
{ status: 500 }
);
}
// Buat response dengan token dalam cookie
const response = NextResponse.json(
{
success: true,
message: "Berhasil Login",
roleId: dataUser.masterUserRoleId,
active: dataUser.active,
termsOfServiceAccepted: dataUser.termsOfServiceAccepted,
token: token,
},
{ status: 200 }
);
// Set cookie dengan token yang sudah dipastikan tidak null
response.cookies.set(process.env.NEXT_PUBLIC_BASE_SESSION_KEY!, token, {
path: "/",
sameSite: "lax",
secure: process.env.NODE_ENV === "production",
maxAge: 30 * 24 * 60 * 60, // 30 hari dalam detik (1 bulan)
});
return response;
} catch (error) {
backendLogger.log("API Error or Server Error", error);
return NextResponse.json(
{
success: false,
message: "Maaf, Terjadi Keselahan",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}

View File

@@ -14,6 +14,8 @@ export async function POST(req: Request) {
try { try {
const { data } = await req.json(); const { data } = await req.json();
console.log("data >>", data);
const cekUsername = await prisma.user.findUnique({ const cekUsername = await prisma.user.findUnique({
where: { where: {
username: data.username, username: data.username,
@@ -26,11 +28,20 @@ export async function POST(req: Request) {
message: "Username sudah digunakan", message: "Username sudah digunakan",
}); });
// ✅ Validasi wajib setuju Terms
if (data.termsOfServiceAccepted !== true) {
return NextResponse.json({
success: false,
message: "You must agree to the Terms of Service",
});
}
const createUser = await prisma.user.create({ const createUser = await prisma.user.create({
data: { data: {
username: data.username, username: data.username,
nomor: data.nomor, nomor: data.nomor,
active: false, active: false,
termsOfServiceAccepted: data.termsOfServiceAccepted,
}, },
}); });
@@ -51,7 +62,7 @@ export async function POST(req: Request) {
success: true, success: true,
message: "Registrasi Berhasil, Anda Sedang Login", message: "Registrasi Berhasil, Anda Sedang Login",
token: token, token: token,
// data: createUser, // data: createUser,x
}, },
{ status: 201 } { status: 201 }
); );
@@ -65,7 +76,5 @@ export async function POST(req: Request) {
}, },
{ status: 500 } { status: 500 }
); );
} finally {
await prisma.$disconnect();
} }
} }

View File

@@ -0,0 +1,29 @@
import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
export async function POST(req: Request) {
try {
const { data } = await req.json();
console.log("data >>", data);
const updateTermService = await prisma.user.update({
where: {
id: data.id,
},
data: {
termsOfServiceAccepted: data.termsOfServiceAccepted,
},
});
return NextResponse.json({
success: true,
message: "Berhasil",
});
} catch (error) {
console.log("error >>", error);
return NextResponse.json({
success: false,
message: "Gagal",
});
}
}

View File

@@ -24,6 +24,7 @@ export async function POST(req: Request) {
username: true, username: true,
active: true, active: true,
masterUserRoleId: true, masterUserRoleId: true,
termsOfServiceAccepted: true,
}, },
}); });
@@ -52,6 +53,7 @@ export async function POST(req: Request) {
message: "Berhasil Login", message: "Berhasil Login",
roleId: dataUser.masterUserRoleId, roleId: dataUser.masterUserRoleId,
active: dataUser.active, active: dataUser.active,
termsOfServiceAccepted: dataUser.termsOfServiceAccepted,
token: token, token: token,
}, },
{ status: 200 } { status: 200 }
@@ -76,7 +78,5 @@ export async function POST(req: Request) {
}, },
{ status: 500 } { status: 500 }
); );
} finally {
await prisma.$disconnect();
} }
} }

View File

@@ -18,7 +18,8 @@ export async function POST(req: Request) {
const data = await resend.emails.send({ const data = await resend.emails.send({
from: `${email} <onboarding@resend.dev>`, from: `${email} <onboarding@resend.dev>`,
to: ["bip.baliinteraktifperkasa@gmail.com"], // ganti sesuai email kamu to: ["bagasbanuna02@gmail.com"],
// to: ["bip.baliinteraktifperkasa@gmail.com"],
subject: title, subject: title,
html: ` html: `
<div style="font-family: Arial, sans-serif; font-size: 16px; color: #333;"> <div style="font-family: Arial, sans-serif; font-size: 16px; color: #333;">

View File

@@ -78,6 +78,7 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
select: { select: {
User: { User: {
select: { select: {
nomor: true,
username: true, username: true,
id: true, id: true,
Profile: { Profile: {

View File

@@ -1,5 +1,6 @@
import _ from "lodash"; import _ from "lodash";
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
export { GET }; export { GET };
@@ -12,7 +13,6 @@ async function GET(request: Request) {
const skipData = Number(page) * takeData - takeData; const skipData = Number(page) * takeData - takeData;
console.log("[CATEGORY]", category); console.log("[CATEGORY]", category);
let fixData; let fixData;
try { try {
if (category === "dashboard") { if (category === "dashboard") {

View File

@@ -29,6 +29,11 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
}, },
}, },
}, },
Event: {
select: {
tanggal: true,
},
},
}, },
}); });

View File

@@ -153,6 +153,7 @@ async function GET(request: Request) {
select: { select: {
id: true, id: true,
title: true, title: true,
tanggal: true,
Author: { Author: {
select: { select: {
id: true, id: true,

View File

@@ -1,5 +1,6 @@
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
import { prisma } from "@/lib"; import { prisma } from "@/lib";
import _ from "lodash";
export { GET }; export { GET };
@@ -51,7 +52,7 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
reportComment, reportComment,
}; };
} else if (category === "posting") { } else if (category === "posting") {
fixData = await prisma.forum_Posting.findMany({ const data = await prisma.forum_Posting.findMany({
take: page ? takeData : undefined, take: page ? takeData : undefined,
skip: page ? skipData : undefined, skip: page ? skipData : undefined,
orderBy: { orderBy: {
@@ -75,10 +76,24 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
Profile: true, Profile: true,
}, },
}, },
_count: {
select: {
Forum_ReportPosting: true,
Forum_Komentar: true,
},
},
}, },
}); });
fixData = data.map((item) => ({
..._.omit(item, "_count"),
reportPosting: item._count.Forum_ReportPosting,
komentar: item._count.Forum_Komentar,
}));
console.log("fixData >>", fixData);
} else if (category === "report_posting") { } else if (category === "report_posting") {
fixData = await prisma.forum_ReportPosting.findMany({ const data = await prisma.forum_ReportPosting.findMany({
take: page ? takeData : undefined, take: page ? takeData : undefined,
skip: page ? skipData : undefined, skip: page ? skipData : undefined,
orderBy: { orderBy: {
@@ -123,8 +138,25 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
}, },
}, },
}); });
const filterLatest = (data: any) =>
Object.values(
data.reduce((acc: any, item: any) => {
const key = item.Forum_Posting?.id;
if (!key) return acc;
if (
!acc[key] ||
new Date(item.createdAt) > new Date(acc[key].createdAt)
) {
acc[key] = item;
}
return acc;
}, {})
);
fixData = filterLatest(data);
} else if (category === "report_comment") { } else if (category === "report_comment") {
fixData = await prisma.forum_ReportKomentar.findMany({ const data = await prisma.forum_ReportKomentar.findMany({
take: page ? takeData : undefined, take: page ? takeData : undefined,
skip: page ? skipData : undefined, skip: page ? skipData : undefined,
orderBy: { orderBy: {
@@ -160,6 +192,23 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
}, },
}, },
}); });
const filterLatest = (data: any) =>
Object.values(
data.reduce((acc: any, item: any) => {
const key = item.Forum_Komentar?.id;
if (!key) return acc;
if (
!acc[key] ||
new Date(item.createdAt) > new Date(acc[key].createdAt)
) {
acc[key] = item;
}
return acc;
}, {})
);
fixData = filterLatest(data);
} else { } else {
return NextResponse.json( return NextResponse.json(
{ {
@@ -171,7 +220,6 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
); );
} }
return NextResponse.json( return NextResponse.json(
{ {
success: true, success: true,

View File

@@ -4,19 +4,55 @@ import { prisma } from "@/lib";
export { GET, PUT }; export { GET, PUT };
async function GET(request: Request, { params }: { params: { id: string } }) { async function GET(request: Request, { params }: { params: { id: string } }) {
let fixData;
try { try {
const { id } = params; const { id } = params;
const data = await prisma.masterBidangBisnis.findUnique({ const { searchParams } = new URL(request.url);
where: { const category = searchParams.get("category");
id: id, const subBidangId = searchParams.get("subBidangId");
},
}); if (category === "all") {
const bidang = await prisma.masterBidangBisnis.findUnique({
where: {
id: id,
},
});
const subBidang = await prisma.masterSubBidangBisnis.findMany({
orderBy: {
updatedAt: "desc",
},
where: {
masterBidangBisnisId: id,
},
});
fixData = {
bidang,
subBidang,
};
} else if (category === "bidang") {
const bidang = await prisma.masterBidangBisnis.findUnique({
where: {
id: id,
},
});
fixData = bidang;
} else if (category === "sub-bidang") {
const subBidang = await prisma.masterSubBidangBisnis.findUnique({
where: {
id: subBidangId as any,
},
});
fixData = subBidang;
}
return NextResponse.json({ return NextResponse.json({
status: 200, status: 200,
success: true, success: true,
message: "Berhasil mendapatkan data", message: "Berhasil mendapatkan data",
data: data, data: fixData,
}); });
} catch (error) { } catch (error) {
console.error("Error Get Master Bank >>", error); console.error("Error Get Master Bank >>", error);
@@ -32,17 +68,34 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
async function PUT(request: Request, { params }: { params: { id: string } }) { async function PUT(request: Request, { params }: { params: { id: string } }) {
const { id } = params; const { id } = params;
const { data } = await request.json(); const { data } = await request.json();
const { searchParams } = new URL(request.url);
const category = searchParams.get("category");
console.log("category", category);
console.log("data", data);
try { try {
const updateData = await prisma.masterBidangBisnis.update({ if (category === "bidang") {
where: { const updateData = await prisma.masterBidangBisnis.update({
id: id, where: {
}, id: id,
data: { },
name: data.name, data: {
active: data.active, name: data.name,
}, active: data.active,
}); },
});
} else if (category === "sub-bidang") {
const updateData = await prisma.masterSubBidangBisnis.update({
where: {
id: id,
},
data: {
name: data.name,
isActive: data.isActive,
},
});
}
return NextResponse.json({ return NextResponse.json({
status: 200, status: 200,

View File

@@ -1,5 +1,7 @@
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
import { prisma } from "@/lib"; import { prisma } from "@/lib";
import _ from "lodash";
import { Prisma } from "@prisma/client";
export { GET, POST }; export { GET, POST };
@@ -31,35 +33,186 @@ async function GET(request: Request) {
} }
} }
type BidangInput = {
name: string;
};
type SubBidangInput = {
name: string;
};
type RequestBody = {
data: {
bidang: BidangInput;
subBidang: SubBidangInput[];
};
};
/* ---------------------------
POST handler
- body: { bidang: { name }, subBidang: [{ name }, ...] }
- buat masterBidangBisnis (id incremental dari count + 1)
- generate id untuk tiap subBidang, cek unik, dan createMany via transaction
--------------------------- */
async function POST(request: Request) { async function POST(request: Request) {
const { data } = await request.json();
try { try {
const count = await prisma.masterBidangBisnis.count(); const { data } = (await request.json()) as RequestBody;
const createNewId = count + 1;
const slugName = data.name.toLowerCase().replace(/\s+/g, "_"); if (!data.bidang.name || !Array.isArray(data.subBidang)) {
return NextResponse.json(
{
status: 400,
success: false,
message:
"Invalid payload. Expect { bidang: { name }, subBidang: [] }",
},
{ status: 400 }
);
}
const create = await prisma.masterBidangBisnis.create({ // run in transaction to avoid race conditions
data: { const result = await prisma.$transaction(async (tx) => {
id: createNewId.toString(), // ambil last id numerik dengan cast (Postgres)
name: data.name, const rows = await tx.$queryRaw<{ id: string }[]>`
slug: slugName, SELECT id FROM "MasterBidangBisnis" ORDER BY (id::int) DESC LIMIT 1;
}, `;
const lastId = rows[0]?.id ?? null;
const bidangId = lastId ? String(Number(lastId) + 1) : "1";
const slugName = data.bidang.name.toLowerCase().replace(/\s+/g, "_");
const createdBidang = await tx.masterBidangBisnis.create({
data: {
id: bidangId,
name: data.bidang.name,
slug: slugName,
},
});
// 2) hitung existing sub bidang untuk bidang ini
const existingSubCount = await tx.masterSubBidangBisnis.count({
where: { masterBidangBisnisId: createdBidang.id },
});
// 3) generate unique ids satu-per-satu (cek ke DB via tx)
const subBidangToCreate: {
id: string;
name: string;
masterBidangBisnisId: string;
}[] = [];
for (let i = 0; i < data.subBidang.length; i++) {
const seqNumber = existingSubCount + i + 1; // 1-based
const uniqueId = await generateUniqueSubBidangId(
data.bidang.name,
seqNumber,
tx
);
// push object to array
subBidangToCreate.push({
id: uniqueId,
name: data.subBidang[i].name,
masterBidangBisnisId: createdBidang.id,
});
}
// 4) createMany (batched) -- note: createMany doesn't return created rows
if (subBidangToCreate.length > 0) {
await tx.masterSubBidangBisnis.createMany({
data: subBidangToCreate,
skipDuplicates: false, // kita sudah memastikan unik, so false
});
}
return { createdBidang, subBidang: subBidangToCreate };
}); });
return NextResponse.json({ return NextResponse.json({
status: 200, status: 200,
success: true, success: true,
message: "Berhasil menambahkan data", message: "Berhasil menambahkan bidang dan sub bidang",
data: create, data: result,
}); });
} catch (error) { } catch (error) {
console.error("Error Post Master Business Field >>", error); console.error("Error Post Master Business Field >>", error);
return NextResponse.json({ const msg = error instanceof Error ? error.message : String(error);
status: 500, return NextResponse.json(
success: false, {
message: "API Error Post Data", status: 500,
reason: (error as Error).message, success: false,
}); message: "API Error Post Data",
reason: msg,
},
{ status: 500 }
);
} }
} }
/* ---------------------------
Helper: generate base code
- mengabaikan stop words: 'dan', 'atau', '&'
- ambil dua kata pertama yang tersisa
- ambil 3 huruf pertama tiap kata (jika ada)
--------------------------- */
function generateBaseCode(name: string) {
const stopWords = new Set(["dan", "atau", "&"]);
// keep only letters and spaces, normalize spaces
const cleaned = name
.normalize("NFD")
.replace(/[\u0300-\u036f]/g, "") // remove diacritics
.replace(/[^a-zA-Z\s&]/g, " ")
.replace(/\s+/g, " ")
.trim()
.toLowerCase();
const words = cleaned
.split(" ")
.filter((w) => w.length > 0 && !stopWords.has(w));
const primary = (words[0] ?? "xxx").substring(0, 3).toUpperCase();
const secondary = words[1] ? words[1].substring(0, 3).toUpperCase() : "";
return { primary, secondary };
}
function padNumber(n: number) {
return String(n).padStart(2, "0");
}
/* ---------------------------
generateUniqueSubBidangId
- cek urutan strategi:
1) PRIMARY-<NN>
2) PRIMARY-SECONDARY-<NN> (jika secondary ada)
3) PRIMARYSECONDARY-<NN> (jika secondary ada)
4) fallback: PRIMARY + last4Timestamp -<NN>
- menggunakan tx (Prisma.TransactionClient) untuk cek di DB
--------------------------- */
async function generateUniqueSubBidangId(
bidangName: string,
number: number,
tx: Prisma.TransactionClient
): Promise<string> {
const { primary, secondary } = generateBaseCode(bidangName);
const num = padNumber(number);
const candidates: string[] = [];
candidates.push(`${primary}-${num}`);
if (secondary) candidates.push(`${primary}-${secondary}-${num}`);
if (secondary) candidates.push(`${primary}${secondary}-${num}`);
// final fallback
candidates.push(`${primary}${String(Date.now()).slice(-4)}-${num}`);
for (const id of candidates) {
// findUnique requires unique field; assuming `id` is the PK/unique
const found = await tx.masterSubBidangBisnis.findUnique({
where: { id },
select: { id: true },
});
if (!found) return id;
}
// theoretically unreachable, but return a final deterministic fallback
return `${primary}-${String(Math.floor(Math.random() * 9000) + 1000)}-${num}`;
}

View File

@@ -0,0 +1,69 @@
import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
export { GET, PUT };
async function GET(request: Request, { params }: { params: { id: string } }) {
const { id } = params;
let fixData;
try {
fixData = await prisma.donasiMaster_Kategori.findUnique({
where: {
id: id,
},
select: {
id: true,
name: true,
active: true,
},
});
return NextResponse.json({
success: true,
message: "Master berhasil diambil",
data: fixData,
});
} catch (error) {
console.log("[ERROR]", error);
return NextResponse.json({
success: false,
error: "Gagal mengambil data master",
reason: (error as Error).message,
});
}
}
async function PUT(request: Request, { params }: { params: { id: string } }) {
const { id } = params;
const { data } = await request.json();
console.log("id", id);
console.log("data", data);
try {
const updateData = await prisma.donasiMaster_Kategori.update({
where: {
id: id,
},
data: {
name: data.name,
active: data.active,
},
});
return NextResponse.json({
success: true,
message: "Master berhasil diupdate",
data: updateData,
});
} catch (error) {
console.log("[ERROR]", error);
return NextResponse.json({
success: false,
error: "Gagal mengupdate data master",
reason: (error as Error).message,
});
}
}

View File

@@ -0,0 +1,105 @@
import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
export { GET, POST };
async function GET(request: Request) {
const { searchParams } = new URL(request.url);
// const category = searchParams.get("category");
let fixData;
try {
fixData = await prisma.donasiMaster_Kategori.findMany({
orderBy: {
createdAt: "asc",
},
});
// if (category === "category") {
// fixData = await prisma.donasiMaster_Kategori.findMany({
// orderBy: {
// createdAt: "asc",
// },
// where: {
// active: true,
// },
// });
// } else if (category === "duration") {
// fixData = await prisma.donasiMaster_Durasi.findMany({
// orderBy: {
// createdAt: "asc",
// },
// where: {
// active: true,
// },
// });
// } else {
// const category = await prisma.donasiMaster_Kategori.findMany({
// orderBy: {
// createdAt: "asc",
// },
// where: {
// active: true,
// },
// });
// const duration = await prisma.donasiMaster_Durasi.findMany({
// orderBy: {
// createdAt: "asc",
// },
// where: {
// active: true,
// },
// });
// fixData = {
// category: category,
// duration: duration,
// };
// }
return NextResponse.json({
success: true,
message: "Master berhasil diambil",
data: fixData,
});
} catch (error) {
console.log("[ERROR]", error);
return NextResponse.json({
success: false,
error: "Gagal mengambil data master",
reason: (error as Error).message,
});
}
}
async function POST(request: Request) {
const { data } = await request.json();
console.log("data", data);
try {
const count = await prisma.donasiMaster_Kategori.count();
const createNewId = count + 1;
const createData = await prisma.donasiMaster_Kategori.create({
data: {
id: createNewId.toString(),
name: data.name,
active: data.active,
},
});
return NextResponse.json({
success: true,
message: "Master berhasil ditambahkan",
});
} catch (error) {
console.log("[ERROR]", error);
return NextResponse.json({
success: false,
error: "Gagal menambah data master",
reason: (error as Error).message,
});
}
}

View File

@@ -0,0 +1,82 @@
import { prisma } from "@/lib";
import { randomOTP } from "@/app_modules/auth/fun/rondom_otp";
import { NextResponse } from "next/server";
export async function POST(req: Request) {
if (req.method !== "POST") {
return NextResponse.json(
{ success: false, message: "Method Not Allowed" },
{ status: 405 }
);
}
try {
const codeOtp = randomOTP();
const body = await req.json();
const { nomor } = body;
const user = await prisma.user.findUnique({
where: {
nomor: nomor,
},
});
console.log(["cek user", user]);
console.log(["cek nomor", nomor]);
if (!user)
return NextResponse.json({
success: false,
message: "User tidak ditemukan",
status: 404,
});
const createOtpId = await prisma.kodeOtp.create({
data: {
nomor: nomor,
otp: codeOtp,
},
});
if (!createOtpId)
return NextResponse.json(
{ success: false, message: "Gagal mengirim kode OTP" },
{ status: 400 }
);
// const msg = `HIPMI - Kode ini bersifat RAHASIA dan JANGAN DI BAGIKAN KEPAADA SIAPAPUN, termasuk anggota ataupun pengurus HIPMI lainnya.\n\n\n> Kode OTP anda: ${codeOtp}.`;
const msg = `HIPMI%20-%20Kode%20ini%20bersifat%20RAHASIA%20dan%20JANGAN%20DI%20BAGIKAN%20KEPADA%20SIAPAPUN%2C%20termasuk%20anggota%20ataupun%20pengurus%20HIPMI%20lainnya.%20Kode%20OTP%20anda%3A%20${codeOtp}.`;
// // const encodedMsg = encodeURIComponent(msg);
const res = await fetch(
`https://wa.wibudev.com/code?nom=${nomor}&text=${msg}`,
{ cache: "no-cache" }
);
const sendWa = await res.json();
if (sendWa.status !== "success")
return NextResponse.json(
{ success: false, message: "Nomor Whatsapp Tidak Aktif" },
{ status: 400 }
);
return NextResponse.json(
{
success: true,
message: "Kode verifikasi terkirim",
kodeId: createOtpId.id,
},
{ status: 200 }
);
} catch (error) {
return NextResponse.json(
{
success: false,
message: "Terjadi masalah saat login",
reason: error as Error,
},
{ status: 500 }
);
}
}

View File

@@ -0,0 +1,108 @@
import { sessionCreate } from "@/app/(auth)/_lib/session_create";
import { randomOTP } from "@/app_modules/auth/fun/rondom_otp";
import prisma from "@/lib/prisma";
import { NextResponse } from "next/server";
export async function POST(req: Request) {
if (req.method !== "POST") {
return NextResponse.json(
{ success: false, message: "Method Not Allowed" },
{ status: 405 }
);
}
const { data } = await req.json();
console.log("data >>", data);
const codeOtp = randomOTP();
try {
const cekUsername = await prisma.user.findUnique({
where: {
username: data.username,
},
});
if (cekUsername)
return NextResponse.json({
success: false,
message: "Username sudah digunakan",
});
// ✅ Validasi wajib setuju Terms
if (data.termsOfServiceAccepted !== true) {
return NextResponse.json({
success: false,
message: "You must agree to the Terms of Service",
});
}
const createUser = await prisma.user.create({
data: {
username: data.username,
nomor: data.nomor,
active: false,
termsOfServiceAccepted: data.termsOfServiceAccepted,
},
});
if (!createUser)
return NextResponse.json(
{ success: false, message: "Gagal Registrasi" },
{ status: 500 }
);
// const token = await sessionCreate({
// sessionKey: process.env.NEXT_PUBLIC_BASE_SESSION_KEY!,
// encodedKey: process.env.NEXT_PUBLIC_BASE_TOKEN_KEY!,
// user: createUser as any,
// });
const createOtpId = await prisma.kodeOtp.create({
data: {
nomor: data.nomor,
otp: codeOtp,
},
});
if (!createOtpId)
return NextResponse.json(
{ success: false, message: "Gagal mengirim kode OTP" },
{ status: 400 }
);
// const msg = `HIPMI - Kode ini bersifat RAHASIA dan JANGAN DI BAGIKAN KEPAADA SIAPAPUN, termasuk anggota ataupun pengurus HIPMI lainnya.\n\n\n> Kode OTP anda: ${codeOtp}.`;
const msg = `HIPMI%20-%20Kode%20ini%20bersifat%20RAHASIA%20dan%20JANGAN%20DI%20BAGIKAN%20KEPADA%20SIAPAPUN%2C%20termasuk%20anggota%20ataupun%20pengurus%20HIPMI%20lainnya.%20Kode%20OTP%20anda%3A%20${codeOtp}.`;
// // const encodedMsg = encodeURIComponent(msg);
const res = await fetch(
`https://wa.wibudev.com/code?nom=${data.nomor}&text=${msg}`,
{ cache: "no-cache" }
);
const sendWa = await res.json();
if (sendWa.status !== "success")
return NextResponse.json(
{ success: false, message: "Nomor Whatsapp Tidak Aktif" },
{ status: 400 }
);
return NextResponse.json(
{
success: true,
message: "Registrasi Berhasil",
// token: token,
kodeId: createOtpId.id,
},
{ status: 201 }
);
} catch (error) {
return NextResponse.json(
{
success: false,
message: "Maaf, Terjadi Keselahan",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}

View File

@@ -0,0 +1,82 @@
import { sessionCreate } from "@/app/(auth)/_lib/session_create";
import prisma from "@/lib/prisma";
import backendLogger from "@/util/backendLogger";
import { NextResponse } from "next/server";
export async function POST(req: Request) {
if (req.method !== "POST") {
return NextResponse.json(
{ success: false, message: "Method Not Allowed" },
{ status: 405 }
);
}
try {
const { nomor } = await req.json();
const dataUser = await prisma.user.findUnique({
where: {
nomor: nomor,
},
select: {
id: true,
nomor: true,
username: true,
active: true,
masterUserRoleId: true,
termsOfServiceAccepted: true,
},
});
if (dataUser == null)
return NextResponse.json(
{ success: false, message: "Nomor Belum Terdaftar" },
{ status: 200 }
);
const token = await sessionCreate({
sessionKey: process.env.NEXT_PUBLIC_BASE_SESSION_KEY!,
encodedKey: process.env.NEXT_PUBLIC_BASE_TOKEN_KEY!,
user: dataUser as any,
});
if (!token) {
return NextResponse.json(
{ success: false, message: "Gagal membuat session" },
{ status: 500 }
);
}
// Buat response dengan token dalam cookie
const response = NextResponse.json(
{
success: true,
message: "Berhasil Login",
roleId: dataUser.masterUserRoleId,
active: dataUser.active,
termsOfServiceAccepted: dataUser.termsOfServiceAccepted,
token: token,
},
{ status: 200 }
);
// Set cookie dengan token yang sudah dipastikan tidak null
response.cookies.set(process.env.NEXT_PUBLIC_BASE_SESSION_KEY!, token, {
path: "/",
sameSite: "lax",
secure: process.env.NODE_ENV === "production",
maxAge: 30 * 24 * 60 * 60, // 30 hari dalam detik (1 bulan)
});
return response;
} catch (error) {
backendLogger.log("API Error or Server Error", error);
return NextResponse.json(
{
success: false,
message: "Maaf, Terjadi Keselahan",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}

View File

@@ -0,0 +1,78 @@
import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
export { GET, DELETE };
async function GET(request: Request, { params }: { params: { id: string } }) {
const { id } = params;
console.log("[ID] >>", id);
try {
const data = await prisma.blockedUser.findUnique({
where: {
id: id,
},
select: {
blocked: {
select: {
id: true,
username: true,
Profile: {
select: {
id: true,
imageId: true,
},
},
},
},
menuFeature: {
select: {
name: true,
value: true,
},
},
},
});
return NextResponse.json({
status: 200,
success: true,
message: "success",
data: data,
});
} catch (error) {
console.log("[ERROR GET BLOCK USER] >>", error);
return NextResponse.json({
status: 500,
success: false,
message: "error",
reason: (error as Error).message || error,
});
}
}
async function DELETE(request: Request, { params }: { params: { id: string } }) {
const { id } = params;
console.log("[ID] >>", id);
try {
const data = await prisma.blockedUser.delete({
where: {
id: id,
},
});
return NextResponse.json({
status: 200,
success: true,
message: "success",
data: data,
});
} catch (error) {
console.log("[ERROR DELETE BLOCK USER] >>", error);
return NextResponse.json({
status: 500,
success: false,
message: "error",
reason: (error as Error).message || error,
});
}
}

View File

@@ -0,0 +1,109 @@
import _ from "lodash";
import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
export { POST, GET };
async function POST(request: Request) {
const { data } = await request.json();
console.log("data >>", data);
console.log("menuFeature masuk>>", data.menuFeature);
try {
const nameApp = _.lowerCase(data.menuFeature);
const menuFeature = await prisma.masterKategoriApp.findFirst({
where: { value: nameApp },
select: {
id: true,
},
});
console.log(" fix menuFeature >>", menuFeature);
const blockUser = await prisma.blockedUser.create({
data: {
blockerId: data.blockerId,
blockedId: data.blockedId,
menuFeatureId: menuFeature?.id as any,
},
});
return NextResponse.json({
status: 200,
success: true,
message: "success",
// data: blockUser,
});
} catch (error) {
console.log("[ERROR BLOCK USER] >>", error);
return NextResponse.json({
status: 500,
success: false,
message: "error",
reason: (error as Error).message || error,
});
}
}
async function GET(request: Request) {
const { searchParams } = new URL(request.url);
const id = searchParams.get("id");
const page = Number(searchParams.get("page"));
const search = searchParams.get("search");
const takeData = 10;
const skipData = page * takeData - takeData;
try {
const data = await prisma.blockedUser.findMany({
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
where: {
blockerId: id as any,
menuFeature: {
id: {
contains: search || "",
mode: "insensitive",
},
},
},
select: {
id: true,
blocked: {
select: {
id: true,
username: true,
Profile: {
select: {
id: true,
imageId: true,
},
},
},
},
menuFeature: {
select: {
name: true,
value: true,
},
},
},
});
return NextResponse.json({
status: 200,
success: true,
message: "success",
data: data,
});
} catch (error) {
console.log("[ERROR GET BLOCK USER] >>", error);
return NextResponse.json({
status: 500,
success: false,
message: "error",
reason: (error as Error).message || error,
});
}
}

View File

@@ -113,6 +113,7 @@ async function GET(request: Request) {
Author: { Author: {
select: { select: {
id: true, id: true,
username: true,
Profile: true, Profile: true,
}, },
}, },
@@ -141,6 +142,7 @@ async function GET(request: Request) {
Author: { Author: {
select: { select: {
id: true, id: true,
username: true,
Profile: true, Profile: true,
}, },
}, },

View File

@@ -47,6 +47,8 @@ async function POST(request: Request) {
}, },
}); });
console.log("[DATA DONASI]", dataDonasi);
if (!dataDonasi) if (!dataDonasi)
return NextResponse.json({ return NextResponse.json({
status: 400, status: 400,
@@ -68,6 +70,8 @@ async function POST(request: Request) {
}, },
}); });
console.log("[DATA CERITA]", dataCerita);
if (!dataCerita) if (!dataCerita)
return NextResponse.json({ return NextResponse.json({
status: 400, status: 400,

View File

@@ -11,6 +11,24 @@ async function POST(request: Request, { params }: { params: { id: string } }) {
console.log("[ID]", id); console.log("[ID]", id);
try { try {
const content = await prisma.forum_Komentar.findUnique({
where: {
id: id,
},
});
const reportList = await prisma.forumMaster_KategoriReport.findUnique({
where: {
id: data.categoryId,
},
});
const msg = `Report Komentar: "${content?.komentar}" dengan kategori \n\n\n${reportList?.title} : \n\n${reportList?.deskripsi}`;
const res = await fetch(
`https://cld-dkr-prod-wajs-server.wibudev.com/api/wa/code?nom=6282340374412&text=${msg}`,
{ cache: "no-cache" }
);
if (data.categoryId) { if (data.categoryId) {
fixData = await prisma.forum_ReportKomentar.create({ fixData = await prisma.forum_ReportKomentar.create({
data: { data: {

View File

@@ -11,6 +11,18 @@ async function POST(request: Request, { params }: { params: { id: string } }) {
console.log("[ID]", id); console.log("[ID]", id);
try { try {
const content = await prisma.forum_Posting.findUnique({
where: {
id: id,
},
});
const msg = `Report Postingan: "${content?.diskusi}"`;
const res = await fetch(
`https://cld-dkr-prod-wajs-server.wibudev.com/api/wa/code?nom=6282340374412&text=${msg}`,
{ cache: "no-cache" }
);
if (data.categoryId) { if (data.categoryId) {
fixData = await prisma.forum_ReportPosting.create({ fixData = await prisma.forum_ReportPosting.create({
data: { data: {

View File

@@ -36,11 +36,109 @@ async function GET(request: Request) {
let fixData; let fixData;
const { searchParams } = new URL(request.url); const { searchParams } = new URL(request.url);
const authorId = searchParams.get("authorId"); const authorId = searchParams.get("authorId");
const userLoginId = searchParams.get("userLoginId");
const search = searchParams.get("search"); const search = searchParams.get("search");
const category = searchParams.get("category");
const page = searchParams.get("page");
const takeData = 5;
const skipData = (Number(page) - 1) * takeData;
// console.log("authorId", authorId);
// console.log("userLoginId", userLoginId);
// console.log("search", search);
// console.log("category", category);
console.log("page", page);
try { try {
if (authorId) { if (category === "beranda") {
const blockUserId = await prisma.blockedUser
.findMany({
where: {
blockerId: userLoginId as string,
},
select: {
blockedId: true,
},
})
.then((res) => {
return res.map((item) => item.blockedId);
});
console.log("blockUserId", blockUserId);
const data = await prisma.forum_Posting.findMany({ const data = await prisma.forum_Posting.findMany({
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
orderBy: {
createdAt: "desc",
},
where: {
isActive: true,
diskusi: {
mode: "insensitive",
contains: search || "",
},
authorId: {
notIn: blockUserId,
},
},
select: {
id: true,
diskusi: true,
createdAt: true,
isActive: true,
authorId: true,
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
id: true,
name: true,
imageId: true,
},
},
},
},
Forum_Komentar: {
where: {
isActive: true,
},
},
ForumMaster_StatusPosting: {
select: {
id: true,
status: true,
},
},
forumMaster_StatusPostingId: true,
},
});
const newData = data.map((item) => {
const count = item.Forum_Komentar?.length ?? 0;
return {
..._.omit(item, ["Forum_Komentar"]),
count,
};
});
fixData = newData;
} else if (category === "forumku") {
const count = await prisma.forum_Posting.count({
where: {
isActive: true,
authorId: authorId,
},
})
const data = await prisma.forum_Posting.findMany({
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
orderBy: { orderBy: {
createdAt: "desc", createdAt: "desc",
}, },
@@ -90,62 +188,18 @@ async function GET(request: Request) {
}; };
}); });
fixData = newData; const dataFix = {
data: newData,
count,
}
fixData = dataFix;
} else { } else {
const data = await prisma.forum_Posting.findMany({ return NextResponse.json({
orderBy: { success: false,
createdAt: "desc", message: "Gagal mendapatkan data",
}, reason: "Kategori tidak ditemukan",
where: {
isActive: true,
diskusi: {
mode: "insensitive",
contains: search || "",
},
},
select: {
id: true,
diskusi: true,
createdAt: true,
isActive: true,
authorId: true,
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
id: true,
name: true,
imageId: true,
},
},
},
},
Forum_Komentar: {
where: {
isActive: true,
},
},
ForumMaster_StatusPosting: {
select: {
id: true,
status: true,
},
},
forumMaster_StatusPostingId: true,
},
}); });
const newData = data.map((item) => {
const count = item.Forum_Komentar?.length ?? 0;
return {
..._.omit(item, ["Forum_Komentar"]),
count,
};
});
fixData = newData;
} }
return NextResponse.json({ return NextResponse.json({
@@ -153,7 +207,6 @@ async function GET(request: Request) {
message: "Berhasil mendapatkan data", message: "Berhasil mendapatkan data",
data: fixData, data: fixData,
}); });
} catch (error) { } catch (error) {
console.log("[ERROR]", error); console.log("[ERROR]", error);
return NextResponse.json({ return NextResponse.json({

View File

@@ -24,18 +24,18 @@ async function POST(request: Request, { params }: { params: { id: string } }) {
}); });
fixData = createWithFile; fixData = createWithFile;
} else {
const createWitOutFile = await prisma.beritaInvestasi.create({
data: {
investasiId: id,
title: _.startCase(data.title),
deskripsi: data.deskripsi,
},
});
fixData = createWitOutFile;
} }
const createWitOutFile = await prisma.beritaInvestasi.create({
data: {
investasiId: id,
title: _.startCase(data.title),
deskripsi: data.deskripsi,
},
});
fixData = createWitOutFile;
return NextResponse.json({ return NextResponse.json({
status: 201, status: 201,
success: true, success: true,

View File

@@ -0,0 +1,28 @@
import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
export { GET };
async function GET(request: Request) {
try {
const data = await prisma.masterKategoriApp.findMany({
where: {
isActive: true,
},
});
return NextResponse.json({
status: 200,
success: true,
message: "success",
data: data,
});
} catch (error) {
console.log("[ERROR GET APP CATEGORY] >>", error);
return NextResponse.json({
status: 500,
success: false,
message: "error",
reason: (error as Error).message || error,
});
}
}

View File

@@ -114,7 +114,7 @@ async function DELETE(request: Request, context: { params: { id: string } }) {
}, },
}, },
}, },
}); });
try { try {
if (data?.logoId != null) { if (data?.logoId != null) {
@@ -134,7 +134,7 @@ async function DELETE(request: Request, context: { params: { id: string } }) {
} }
} }
if (data?.BusinessMaps) { if (data?.BusinessMaps !== null) {
const pinId = data?.BusinessMaps?.pinId; const pinId = data?.BusinessMaps?.pinId;
if (pinId) { if (pinId) {
@@ -172,24 +172,23 @@ async function DELETE(request: Request, context: { params: { id: string } }) {
} }
} }
const deletePortoMedsos = await prisma.portofolio_MediaSosial.delete({ const deleteMap = await prisma.businessMaps.delete({
where: { where: {
portofolioId: id, id: data?.BusinessMaps?.id,
}, },
}); });
const deleteMap = await prisma.businessMaps.delete({ const deletePortoMedsos = await prisma.portofolio_MediaSosial.delete({
where: { where: {
portofolioId: id, portofolioId: data?.id,
}, },
}); });
const deletePortofolio = await prisma.portofolio.delete({ const deletePortofolio = await prisma.portofolio.delete({
where: { where: {
id: id, id: data?.id,
}, },
}); });
} catch (error) { } catch (error) {
console.error("Error delete logo", error); console.error("Error delete logo", error);
} }

View File

@@ -32,3 +32,717 @@ export async function GET(
); );
} }
} }
export async function DELETE(
request: Request,
{ params }: { params: { id: string } }
) {
const { id } = params;
console.log("[ID USER", id);
try {
console.log("[START DELETE ALL >>>]");
const checkUser = await prisma.user.findUnique({
where: {
id: id,
},
select: {
// EVENT START
Event: {
select: {
id: true,
},
},
Event_Peserta: {
select: {
id: true,
},
},
// EVENT END
// COLLABORATION START
ProjectCollaboration: {
select: {
id: true,
},
},
ProjectCollaboration_Partisipasi: {
select: {
id: true,
},
},
ProjectCollaboration_RoomChat: {
select: {
id: true,
},
},
ProjectCollaboration_AnggotaRoomChat: {
select: {
id: true,
},
},
ProjectCollaboration_Message: {
select: {
id: true,
},
},
// COLLABORATION END
// VOTING START
Voting: {
select: {
id: true,
Voting_DaftarNamaVote: {
select: {
id: true,
},
},
},
},
Voting_Kontributor: {
select: {
id: true,
},
},
// VOTING END
// JOB START
Job: {
select: {
id: true,
imageId: true,
},
},
// JOB END
// FORUM START
Forum_Posting: {
select: {
id: true,
},
},
Forum_Komentar: {
select: {
id: true,
},
},
Forum_ReportKomentar: {
select: {
id: true,
},
},
Forum_ReportPosting: {
select: {
id: true,
},
},
// FORUM END
// INVITATION START
Investasi: {
select: {
id: true,
prospektusFileId: true,
imageId: true,
BeritaInvestasi: {
select: {
id: true,
imageId: true,
},
},
DokumenInvestasi: {
select: {
id: true,
fileId: true,
},
},
},
},
Investasi_Invoice: {
select: {
id: true,
imageId: true,
},
},
// INVITATION END
// DONATION START
Donasi: {
select: {
id: true,
imageId: true,
CeritaDonasi: {
select: {
id: true,
imageId: true,
},
},
Donasi_Kabar: {
select: {
id: true,
imageId: true,
},
},
Donasi_PencairanDana: {
select: {
id: true,
imageId: true,
},
},
},
},
Donasi_Invoice: {
select: {
id: true,
imageId: true,
},
},
// DONATION END
// PROFILE & PORTOFOLOIO START
Profile: {
select: {
id: true,
Portofolio: {
select: {
id: true,
logoId: true,
BusinessMaps: {
select: {
id: true,
imageId: true,
},
},
Portofolio_MediaSosial: {
select: {
id: true,
},
},
},
},
},
},
// PROFILE & PORTOFOLOIO END
},
});
// =================================================== //
// ================ START DELETE ALL ================= //
// =================================================== //
// EVENT DELETE START
for (let event of checkUser?.Event_Peserta as any) {
const deleteEvent = await prisma.event_Peserta.delete({
where: {
id: event.id,
},
select: {
Event: {
select: {
title: true,
},
},
},
});
console.log(["DELETE EVENT PESERTA", deleteEvent]);
}
for (let event of checkUser?.Event as any) {
const deleteEvent = await prisma.event.delete({
where: {
id: event.id,
},
});
console.log(["DELETE EVENT", deleteEvent]);
}
// EVENT DELETE END
// COLLABORATION START
for (let project of checkUser?.ProjectCollaboration_Partisipasi as any) {
const deleteProject =
await prisma.projectCollaboration_Partisipasi.delete({
where: {
id: project.id,
},
});
console.log(["DELETE PROJECT PARTISIPASI", deleteProject]);
}
for (let project of checkUser?.ProjectCollaboration_RoomChat as any) {
const deleteProject = await prisma.projectCollaboration_RoomChat.delete({
where: {
id: project.id,
},
});
console.log(["DELETE PROJECT ROOMCHAT", deleteProject]);
}
for (let project of checkUser?.ProjectCollaboration_AnggotaRoomChat as any) {
const deleteProject =
await prisma.projectCollaboration_AnggotaRoomChat.delete({
where: {
id: project.id,
},
});
console.log(["DELETE PROJECT ANGGOTA ROOMCHAT", deleteProject]);
}
for (let project of checkUser?.ProjectCollaboration_Message as any) {
const deleteProject = await prisma.projectCollaboration_Message.delete({
where: {
id: project.id,
},
});
console.log(["DELETE PROJECT MESSAGE", deleteProject]);
}
for (let project of checkUser?.ProjectCollaboration as any) {
const deleteProject = await prisma.projectCollaboration.delete({
where: {
id: project.id,
},
});
console.log(["DELETE PROJECT", deleteProject]);
}
// COLLABORATION END
// VOTING START
for (let voting of checkUser?.Voting_Kontributor as any) {
const deleteVotingKontributor = await prisma.voting_Kontributor.delete({
where: {
id: voting.id,
},
});
console.log(["DELETE VOTING KONTRIBUTOR", deleteVotingKontributor]);
}
for (let voting of checkUser?.Voting as any) {
for (let id of voting?.Voting_DaftarNamaVote as any) {
const deleteVotingListName = await prisma.voting_DaftarNamaVote.delete({
where: {
id: id.id,
},
});
console.log(["DELETE VOTING LIST NAME", deleteVotingListName]);
}
const deleteVoting = await prisma.voting.delete({
where: {
id: voting.id,
},
});
console.log(["DELETE VOTING", deleteVoting]);
}
// VOTING END
// JOB START
for (let job of checkUser?.Job as any) {
if (job.imageId) {
const deleteJobImage = await fetch(
`https://wibu-storage.wibudev.com/api/files/${job.imageId}/delete`,
{
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.WS_APIKEY}`,
},
}
);
if (deleteJobImage.ok) {
console.log("Success delete job image");
}
}
const deleteJob = await prisma.job.delete({
where: {
id: job.id,
},
});
console.log(["DELETE JOB", deleteJob]);
}
// JOB END
// FORUM START
for (let forum of checkUser?.Forum_ReportKomentar as any) {
const deleteForum = await prisma.forum_ReportKomentar.delete({
where: {
id: forum.id,
},
});
console.log(["DELETE FORUM REPORT KOMENTAR", deleteForum]);
}
for (let forum of checkUser?.Forum_ReportPosting as any) {
const deleteForum = await prisma.forum_ReportPosting.delete({
where: {
id: forum.id,
},
});
console.log(["DELETE FORUM REPORT POSTING", deleteForum]);
}
for (let forum of checkUser?.Forum_Komentar as any) {
const deleteForum = await prisma.forum_Komentar.delete({
where: {
id: forum.id,
},
});
console.log(["DELETE FORUM KOMENTAR", deleteForum]);
}
for (let forum of checkUser?.Forum_Posting as any) {
const deleteForum = await prisma.forum_Posting.delete({
where: {
id: forum.id,
},
});
console.log(["DELETE FORUM POSTING", deleteForum]);
}
// FORUM END
// INVESTASI START
for (let invoice of checkUser?.Investasi_Invoice as any) {
if (invoice?.imageId) {
const deleteInvoiceImage = await fetch(
`https://wibu-storage.wibudev.com/api/files/${invoice.imageId}/delete`,
{
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.WS_APIKEY}`,
},
}
);
if (deleteInvoiceImage.ok) {
console.log("Success delete invoice image");
}
}
const deleteInvoice = await prisma.investasi_Invoice.delete({
where: {
id: invoice.id,
},
});
console.log(["DELETE INVOICE INVESTASI", deleteInvoice]);
}
for (let investasi of checkUser?.Investasi as any) {
for (let berita of investasi?.BeritaInvestasi as any) {
if (berita?.imageId) {
const deleteBeritaImage = await fetch(
`https://wibu-storage.wibudev.com/api/files/${berita.imageId}/delete`,
{
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.WS_APIKEY}`,
},
}
);
if (deleteBeritaImage.ok) {
console.log("Success delete image berita investasi");
}
}
const deleteBerita = await prisma.beritaInvestasi.delete({
where: {
id: berita.id,
},
});
console.log(["DELETE BERITA INVESTASI", deleteBerita]);
}
for (let dokumen of investasi?.DokumenInvestasi as any) {
if (dokumen?.fileId) {
const deleteDokumenImage = await fetch(
`https://wibu-storage.wibudev.com/api/files/${dokumen.fileId}/delete`,
{
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.WS_APIKEY}`,
},
}
);
if (deleteDokumenImage.ok) {
console.log("Success delete image dokumen investasi");
}
}
const deleteDokumen = await prisma.dokumenInvestasi.delete({
where: {
id: dokumen.id,
},
});
console.log(["DELETE DOKUMEN INVESTASI", deleteDokumen]);
}
if (investasi?.prospektusFileId) {
const deleteProspektusFile = await fetch(
`https://wibu-storage.wibudev.com/api/files/${investasi.prospektusFileId}/delete`,
{
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.WS_APIKEY}`,
},
}
);
if (deleteProspektusFile.ok) {
console.log("Success delete prospektus file investasi");
}
}
if (investasi?.imageId) {
const deleteInvestasiImage = await fetch(
`https://wibu-storage.wibudev.com/api/files/${investasi.imageId}/delete`,
{
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.WS_APIKEY}`,
},
}
);
if (deleteInvestasiImage.ok) {
console.log("Success delete image investasi");
}
}
const deleteInvestasi = await prisma.investasi.delete({
where: {
id: investasi.id,
},
});
console.log(["DELETE INVESTASI", deleteInvestasi]);
}
// INVESTASI END
// DONASI START
for (let donasiInvoice of checkUser?.Donasi_Invoice as any) {
if (donasiInvoice?.imageId) {
const deleteInvoiceImage = await fetch(
`https://wibu-storage.wibudev.com/api/files/${donasiInvoice.imageId}/delete`,
{
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.WS_APIKEY}`,
},
}
);
if (deleteInvoiceImage.ok) {
console.log("Success delete invoice image");
}
}
const deleteInvoice = await prisma.donasi_Invoice.delete({
where: {
id: donasiInvoice.id,
},
});
console.log(["DELETE INVOICE DONASI", deleteInvoice]);
}
for (let donasi of checkUser?.Donasi as any) {
for (let kabar of donasi?.Donasi_Kabar as any) {
if (kabar?.imageId) {
const deleteKabarImage = await fetch(
`https://wibu-storage.wibudev.com/api/files/${kabar.imageId}/delete`,
{
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.WS_APIKEY}`,
},
}
);
if (deleteKabarImage.ok) {
console.log("Success delete kabar image");
}
}
const deleteKabar = await prisma.donasi_Kabar.delete({
where: {
id: kabar.id,
},
});
console.log(["DELETE KABAR DONASI", deleteKabar]);
}
for (let pencairanDana of donasi?.Donasi_PencairanDana as any) {
if (pencairanDana?.imageId) {
const deletePencairanDanaImage = await fetch(
`https://wibu-storage.wibudev.com/api/files/${pencairanDana.imageId}/delete`,
{
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.WS_APIKEY}`,
},
}
);
if (deletePencairanDanaImage.ok) {
console.log("Success delete pencairan dana image");
}
}
const deletePencairanDana = await prisma.donasi_PencairanDana.delete({
where: {
id: pencairanDana.id,
},
});
console.log(["DELETE PENCAIRAN DANA DONASI", deletePencairanDana]);
}
const deleteImageCerita = await fetch(
`https://wibu-storage.wibudev.com/api/files/${donasi?.CeritaDonasi?.imageId}/delete`,
{
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.WS_APIKEY}`,
},
}
);
if (deleteImageCerita.ok) {
console.log("Success delete image cerita donasi");
}
const deleteCerita = await prisma.donasi_Cerita.delete({
where: {
donasiId: donasi.id,
},
});
console.log(["DELETE CERITA DONASI", deleteCerita]);
const deleteImageDonasi = await fetch(
`https://wibu-storage.wibudev.com/api/files/${donasi?.imageId}/delete`,
{
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.WS_APIKEY}`,
},
}
);
if (deleteImageDonasi.ok) {
console.log("Success delete image donasi");
}
const deleteDonasi = await prisma.donasi.delete({
where: {
id: donasi.id,
},
});
console.log(["DELETE DONASI", deleteDonasi]);
}
// DONASI END
// PORTOFOLIO DELETE START
for (const portofolio of checkUser?.Profile?.Portofolio as any) {
if (portofolio?.BusinessMaps?.id) {
const deleteLogo = await fetch(
`https://wibu-storage.wibudev.com/api/files/${portofolio?.BusinessMaps?.imageId}/delete`,
{
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.WS_APIKEY}`,
},
}
);
if (deleteLogo.ok) {
console.log("Success delete logo");
}
const deleteMaps = await prisma.businessMaps.delete({
where: {
id: portofolio?.BusinessMaps?.id,
},
});
console.log(["DELETE MAPS", deleteMaps]);
}
if (portofolio?.Portofolio_MediaSosial?.id) {
const deleteSosialMedia = await prisma.portofolio_MediaSosial.delete({
where: {
portofolioId: portofolio.id,
},
});
console.log(["DELETE SOSIAL MEDIA", deleteSosialMedia]);
}
if (portofolio?.logoId) {
const deleteLogo = await fetch(
`https://wibu-storage.wibudev.com/api/files/${portofolio?.logoId}/delete`,
{
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.WS_APIKEY}`,
},
}
);
if (deleteLogo.ok) {
console.log("Success delete logo");
}
}
const deletePortofolio = await prisma.portofolio.delete({
where: {
id: portofolio.id,
},
});
console.log(["DELETE PORTOFOLIO", deletePortofolio]);
}
const deleteProfile = await prisma.profile.delete({
where: {
userId: id,
},
});
console.log(["DELETE PROFILE", deleteProfile]);
// PORTOFOLIO DELETE END
const deleteUser = await prisma.user.delete({
where: {
id: id,
},
});
console.log(["DELETE USER", deleteUser]);
console.log("[END DELETE ALL >>>]");
return NextResponse.json(
{ success: true, message: "Berhasil menghapus data" },
{ status: 200 }
);
} catch (error) {
console.log(["ERROR DELETE ALL", error]);
return NextResponse.json(
{
success: false,
message: "Error delete data from API ",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}

View File

@@ -0,0 +1,68 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib";
export { POST };
async function POST(request: Request, { params }: { params: { id: string } }) {
const { id } = params;
const { searchParams } = new URL(request.url);
const category = searchParams.get("category");
console.log("[ID USER", id);
console.log("[SEARCH PARAMS", category);
try {
const user = await prisma.user.findUnique({
where: {
id: id,
},
});
if (!user) {
return NextResponse.json(
{
success: false,
message: "User not found",
},
{ status: 404 }
);
}
const updateUser = await prisma.user.update({
where: {
id: id,
},
data: {
acceptedForumTermsAt: new Date(),
},
});
if (!updateUser) {
return NextResponse.json(
{
success: false,
message: "Gagal mengupdate data",
},
{ status: 400 }
);
}
return NextResponse.json(
{
success: true,
message: "Syarat dan Ketentuan berhasil diterima",
},
{ status: 200 }
);
} catch (error) {
return NextResponse.json(
{
success: false,
message: "Error update data from API ",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}

View File

@@ -65,14 +65,23 @@ async function GET(request: Request) {
const search = searchParams.get("search"); const search = searchParams.get("search");
const category = searchParams.get("category"); const category = searchParams.get("category");
const authorId = searchParams.get("authorId"); const authorId = searchParams.get("authorId");
const userLoginId = searchParams.get("userLoginId");
console.log("userLoginId >>", userLoginId);
let fixData; let fixData;
try { try {
if (category === "beranda") { if (category === "beranda") {
fixData = await prisma.voting.findMany({ if (!userLoginId) {
return NextResponse.json(
{ success: false, message: "User ID required" },
{ status: 400 }
);
}
const data = await prisma.voting.findMany({
orderBy: { orderBy: {
updatedAt: "desc", awalVote: "asc",
}, },
where: { where: {
voting_StatusId: "1", voting_StatusId: "1",
@@ -85,6 +94,13 @@ async function GET(request: Request) {
contains: search || "", contains: search || "",
mode: "insensitive", mode: "insensitive",
}, },
NOT: {
Voting_Kontributor: {
some: {
authorId: userLoginId,
},
},
},
}, },
include: { include: {
Voting_DaftarNamaVote: { Voting_DaftarNamaVote: {
@@ -107,6 +123,10 @@ async function GET(request: Request) {
}, },
}, },
}); });
fixData = data;
} else if (category === "contribution") { } else if (category === "contribution") {
const data = await prisma.voting_Kontributor.findMany({ const data = await prisma.voting_Kontributor.findMany({
orderBy: { orderBy: {

View File

@@ -60,12 +60,14 @@ async function seederUser() {
username: i.name, username: i.name,
masterUserRoleId: i.masterUserRoleId, masterUserRoleId: i.masterUserRoleId,
active: i.active, active: i.active,
termsOfServiceAccepted: i.termsOfServiceAccepted,
}, },
update: { update: {
nomor: i.nomor, nomor: i.nomor,
username: i.name, username: i.name,
masterUserRoleId: i.masterUserRoleId, masterUserRoleId: i.masterUserRoleId,
active: i.active, active: i.active,
termsOfServiceAccepted: i.termsOfServiceAccepted,
}, },
}); });
} }
@@ -564,10 +566,12 @@ async function masterKategoriApp() {
create: { create: {
id: a.id, id: a.id,
name: a.name, name: a.name,
value: a.value,
}, },
update: { update: {
id: a.id, id: a.id,
name: a.name, name: a.name,
value: a.value,
}, },
}); });
} }

View File

@@ -1,7 +1,7 @@
[ [
{ {
"id": 1, "id": 1,
"name": "Software Developer" "name": "Software Development"
}, },
{ {
"id": 2, "id": 2,

View File

@@ -1,30 +1,37 @@
[ [
{ {
"id": "1", "id": "1",
"name": "Event" "name": "Event",
"value": "event"
}, },
{ {
"id": "2", "id": "2",
"name": "Job" "name": "Job",
"value": "job"
}, },
{ {
"id": "3", "id": "3",
"name": "Voting" "name": "Voting",
"value": "voting"
}, },
{ {
"id": "4", "id": "4",
"name": "Donasi" "name": "Donasi",
"value": "donasi"
}, },
{ {
"id": "5", "id": "5",
"name": "Investasi" "name": "Investasi",
"value": "investasi"
}, },
{ {
"id": "6", "id": "6",
"name": "Forum" "name": "Forum",
"value": "forum"
}, },
{ {
"id": "7", "id": "7",
"name": "Collaboration" "name": "Collaboration",
"value": "collaboration"
} }
] ]

View File

@@ -1,14 +1,23 @@
[ [
{ {
"name": "bagas_admin", "name": "default_user",
"nomor": "6282340374412", "nomor": "6282340374412",
"masterUserRoleId": "1",
"active": true,
"termsOfServiceAccepted": false
},
{
"name": "admin_911",
"nomor": "6281339158911",
"masterUserRoleId": "3", "masterUserRoleId": "3",
"active": true "active": true,
"termsOfServiceAccepted": false
}, },
{ {
"name": "fahmi_admin", "name": "fahmi_admin",
"nomor": "628123833845", "nomor": "628123833845",
"masterUserRoleId": "2", "masterUserRoleId": "2",
"active": true "active": true,
"termsOfServiceAccepted": false
} }
] ]

View File

@@ -19,6 +19,7 @@ const CONFIG: MiddlewareConfig = {
publicRoutes: [ publicRoutes: [
"/", "/",
"/.well-known/*", "/.well-known/*",
"/terms-of-service.html",
"/privacy-policy.html", "/privacy-policy.html",
"/api/helper/*", "/api/helper/*",
"/api/not-user/*", "/api/not-user/*",

View File

@@ -23,6 +23,6 @@
"@/*": ["./src/*"] "@/*": ["./src/*"]
} }
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/app_modules/investasi/proses_transaksi/view.jsx", "src/app/api/investasi/midtrans/[id]/route.ts", "src/app_modules/job/create/TextEdit.tsx"], "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/app_modules/investasi/proses_transaksi/view.jsx", "src/app/api/investasi/midtrans/[id]/route.ts", "src/app_modules/job/create/TextEdit.tsx", "src/app/api/mobile/forum/[id]/report-comment/route.ts"],
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }

4
types/env.d.ts vendored
View File

@@ -9,7 +9,7 @@ declare namespace NodeJS {
NEXT_PUBLIC_WIBU_REALTIME_TOKEN?: string; NEXT_PUBLIC_WIBU_REALTIME_TOKEN?: string;
NEXT_PUBLIC_BASE_TOKEN_KEY?: string; NEXT_PUBLIC_BASE_TOKEN_KEY?: string;
NEXT_PUBLIC_BASE_SESSION_KEY?: string; NEXT_PUBLIC_BASE_SESSION_KEY?: string;
NEXT_PUBLIC_API_URL?: string; RESEND_APIKEY?: string;
WA_SERVER_TOKEN?: string;
} }
} }