feat: menambahkan kolom slug dan implement slug di module project
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[slug]` on the table `project` will be added. If there are existing duplicate values, this will fail.
|
||||
- A unique constraint covering the columns `[id_project,slug]` on the table `task` will be added. If there are existing duplicate values, this will fail.
|
||||
- Added the required column `slug` to the `project` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `slug` to the `task` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `project` ADD COLUMN `slug` VARCHAR(255) NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `task` ADD COLUMN `slug` VARCHAR(255) NOT NULL;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `project_slug_key` ON `project`(`slug`);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX `task_slug_idx` ON `task`(`slug`);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `task_id_project_slug_key` ON `task`(`id_project`, `slug`);
|
||||
@@ -205,6 +205,7 @@ model User {
|
||||
model Project {
|
||||
id Int @id @default(autoincrement())
|
||||
id_admin Int //mentor project
|
||||
slug String @unique @db.VarChar(255)
|
||||
project_icon ProjectIcon @default(code)
|
||||
project_name String @db.VarChar(255)
|
||||
description String @db.Text
|
||||
@@ -245,6 +246,7 @@ model ProjectMember {
|
||||
model Task {
|
||||
id Int @id @default(autoincrement())
|
||||
id_project Int
|
||||
slug String @db.VarChar(255)
|
||||
title String @db.VarChar(255)
|
||||
description String @db.Text
|
||||
deadline_at DateTime
|
||||
@@ -255,8 +257,10 @@ model Task {
|
||||
project Project @relation(fields: [id_project], references: [id], map: "task_id_project_foreign")
|
||||
submissions TaskSubmission[]
|
||||
|
||||
@@unique([id_project, slug])
|
||||
@@index([id_project], map: "task_id_project_foreign")
|
||||
@@index([deadline_at])
|
||||
@@index([slug])
|
||||
@@map("task")
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -151,13 +151,13 @@ async function main() {
|
||||
|
||||
// 10. Project
|
||||
const proj1 = await prisma.project.create({
|
||||
data: { id_admin: admin1.id, project_icon: 'code', project_name: 'Internify Platform Dev', description: 'Upgrading the core Internify platform backend and web client.', start_date: new Date('2026-07-15'), end_date: new Date('2026-10-15'), status: 'active' }
|
||||
data: { id_admin: admin1.id, project_icon: 'code', project_name: 'Internify Platform Dev', slug: 'internify-platform-dev', description: 'Upgrading the core Internify platform backend and web client.', start_date: new Date('2026-07-15'), end_date: new Date('2026-10-15'), status: 'active' }
|
||||
});
|
||||
const proj2 = await prisma.project.create({
|
||||
data: { id_admin: admin2.id, project_icon: 'shield', project_name: 'Auth Gateway Module', description: 'Securing API gateway with unified OAuth2 authentication.', start_date: new Date('2026-07-15'), end_date: new Date('2026-10-15'), status: 'active' }
|
||||
data: { id_admin: admin2.id, project_icon: 'shield', project_name: 'Auth Gateway Module', slug: 'auth-gateway-module', description: 'Securing API gateway with unified OAuth2 authentication.', start_date: new Date('2026-07-15'), end_date: new Date('2026-10-15'), status: 'active' }
|
||||
});
|
||||
const proj3 = await prisma.project.create({
|
||||
data: { id_admin: admin1.id, project_icon: 'chart', project_name: 'Recruitment Analytics Dashboard', description: 'Developing analytical charts for recruitment metrics.', start_date: new Date('2026-07-15'), end_date: new Date('2026-10-15'), status: 'active' }
|
||||
data: { id_admin: admin1.id, project_icon: 'chart', project_name: 'Recruitment Analytics Dashboard', slug: 'recruitment-analytics-dashboard', description: 'Developing analytical charts for recruitment metrics.', start_date: new Date('2026-07-15'), end_date: new Date('2026-10-15'), status: 'active' }
|
||||
});
|
||||
|
||||
// 11. LamaranMagang
|
||||
@@ -173,13 +173,13 @@ async function main() {
|
||||
|
||||
// 12. Task
|
||||
const task1 = await prisma.task.create({
|
||||
data: { id_project: proj1.id, title: 'Database Setup', description: 'Setup database schema and write initial seed script.', deadline_at: new Date('2026-08-01'), submission_type: 'url_link' }
|
||||
data: { id_project: proj1.id, title: 'Database Setup', slug: 'database-setup', description: 'Setup database schema and write initial seed script.', deadline_at: new Date('2026-08-01'), submission_type: 'url_link' }
|
||||
});
|
||||
const task2 = await prisma.task.create({
|
||||
data: { id_project: proj1.id, title: 'API Specification', description: 'Draft comprehensive swagger API document.', deadline_at: new Date('2026-08-15'), submission_type: 'file_upload' }
|
||||
data: { id_project: proj1.id, title: 'API Specification', slug: 'api-specification', description: 'Draft comprehensive swagger API document.', deadline_at: new Date('2026-08-15'), submission_type: 'file_upload' }
|
||||
});
|
||||
const task3 = await prisma.task.create({
|
||||
data: { id_project: proj2.id, title: 'Implement JWT Validation', description: 'Setup middleware and keys for JWT validation.', deadline_at: new Date('2026-08-10'), submission_type: 'url_link' }
|
||||
data: { id_project: proj2.id, title: 'Implement JWT Validation', slug: 'implement-jwt-validation', description: 'Setup middleware and keys for JWT validation.', deadline_at: new Date('2026-08-10'), submission_type: 'url_link' }
|
||||
});
|
||||
|
||||
// 13. User
|
||||
|
||||
Reference in New Issue
Block a user