Skip to content

Commit dfa398d

Browse files
authored
Merge pull request #210 from ahsanzizan/main
Major fixes in organisasi segment
2 parents dbb4c1c + 1e5a3e7 commit dfa398d

File tree

26 files changed

+170
-268
lines changed

26 files changed

+170
-268
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
Warnings:
3+
4+
- Added the required column `image_description` to the `Organisasi` table without a default value. This is not possible if the table is not empty.
5+
6+
*/
7+
-- AlterTable
8+
ALTER TABLE `Organisasi` ADD COLUMN `image_description` VARCHAR(191) NOT NULL;

prisma/schema.prisma

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -196,21 +196,22 @@ model Period_Year {
196196
}
197197

198198
model Organisasi {
199-
id String @id @default(uuid()) @map("suborgan_id") @db.Char(36)
200-
period_id String
201-
period Period_Year @relation(fields: [period_id], references: [id])
202-
organisasi Organisasi_Type
203-
organisasi_name String @map("organisasi_name")
204-
logo String
205-
description String @db.LongText
206-
vision String
207-
mission String
208-
image String
209-
companion String
210-
structure String @db.LongText
211-
contact String
212-
created_at DateTime @default(now())
213-
updated_at DateTime @updatedAt
199+
id String @id @default(uuid()) @map("suborgan_id") @db.Char(36)
200+
period_id String
201+
period Period_Year @relation(fields: [period_id], references: [id])
202+
organisasi Organisasi_Type
203+
organisasi_name String @map("organisasi_name")
204+
logo String
205+
description String @db.LongText
206+
vision String
207+
mission String
208+
image String
209+
image_description String
210+
companion String
211+
structure String @db.LongText
212+
contact String
213+
created_at DateTime @default(now())
214+
updated_at DateTime @updatedAt
214215
215216
@@unique([organisasi, period_id])
216217
@@map("Organisasi")

src/actions/organisasi.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export async function suborganCreate(data: FormData) {
3030
const companion = data.get("companion") as string;
3131
const structure = data.get("structure") as string;
3232
const contact = data.get("contact") as string;
33+
const imageDescription = data.get("image_description") as string;
3334

3435
const image = data.get("image") as File;
3536
const logo = data.get("logo") as File;
@@ -55,6 +56,7 @@ export async function suborganCreate(data: FormData) {
5556
structure: structure,
5657
contact: contact,
5758
period: period,
59+
image_description: imageDescription,
5860
});
5961
} catch (e) {
6062
console.log(e);

src/app/(admin)/admin/organisasi/[slug]/[period]/page.tsx

Whitespace-only changes.
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
1+
import { Organisasi_Type } from "@prisma/client";
2+
3+
import { findOrganisasi } from "@/utils/database/organisasi.query";
4+
import { findLatestPeriod } from "@/utils/database/period.query";
5+
16
export default async function Edit({
27
params,
38
}: {
49
params: { organisasi: string };
510
}) {
6-
console.log(params);
11+
const latestPeriod = await findLatestPeriod();
12+
const organisasi = await findOrganisasi({
13+
organisasi_period_id: {
14+
period_id: latestPeriod.id,
15+
organisasi: params.organisasi as Organisasi_Type,
16+
},
17+
});
18+
19+
console.log(organisasi);
20+
721
return <></>;
822
}

src/app/(admin)/admin/organisasi/create/page.tsx

Whitespace-only changes.
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { H1 } from "@/app/_components/global/Text";
22

3-
export default function SubOrgan() {
4-
return <H1>Sub-organ</H1>;
3+
export default function SuborAdmin() {
4+
return (
5+
<>
6+
<H1>TOLONG DISLICE</H1>
7+
</>
8+
);
59
}

src/app/(admin)/admin/sub-organ/[slug]/page.tsx

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/app/(admin)/admin/sub-organ/page.tsx

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Organisasi_Type } from "@prisma/client";
2+
import { notFound } from "next/navigation";
3+
4+
import { findOrganisasi } from "@/utils/database/organisasi.query";
5+
import { findPeriod } from "@/utils/database/period.query";
6+
7+
export default async function OrganisasiByPeriod({
8+
param,
9+
}: {
10+
param: { slug: string; period: string };
11+
}) {
12+
const period = await findPeriod(param.period);
13+
if (!period) return notFound();
14+
15+
const organisasi = await findOrganisasi({
16+
organisasi_period_id: {
17+
organisasi: param.slug.toUpperCase() as Organisasi_Type,
18+
period_id: period.id,
19+
},
20+
});
21+
console.log(organisasi);
22+
23+
return <></>;
24+
}

0 commit comments

Comments
 (0)