Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
chore: save commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jspark2000 committed Mar 7, 2024
1 parent 907b74c commit e1fe7cc
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 49 deletions.
20 changes: 10 additions & 10 deletions backend/app/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ const bootstrap = async () => {
app.useGlobalPipes(new ValidationPipe())
app.use(cookieParser())
app.setGlobalPrefix('api')
app.enableCors({
origin:
process.env.NODE_ENV === 'production'
? process.env.VERCEL_HOSTNAME
: 'http://localhost:5173',
credentials: true,
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS',
allowedHeaders: ['*'],
exposedHeaders: ['Content-Type', 'Authorization']
})

if (process.env.NODE_ENV !== 'production') {
app.enableCors({
origin: 'http://localhost:5173',
credentials: true,
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS',
allowedHeaders: ['*'],
exposedHeaders: ['Content-Type', 'Authorization']
})
}

await app.listen(4000)
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ CREATE TABLE "user" (
"last_password_changed" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"last_login" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"status" "AccountStatus" NOT NULL DEFAULT 'Verifying',
"profile_image_url" TEXT,

CONSTRAINT "user_pkey" PRIMARY KEY ("id")
);
Expand Down Expand Up @@ -76,6 +77,7 @@ CREATE TABLE "attendance" (
-- CreateTable
CREATE TABLE "schedule" (
"id" SERIAL NOT NULL,
"survey_group_id" INTEGER NOT NULL,
"name" VARCHAR(64) NOT NULL,
"date" TIMESTAMP(3) NOT NULL,
"type" "ScheduleType" NOT NULL DEFAULT 'Exercise',
Expand Down Expand Up @@ -175,6 +177,9 @@ ALTER TABLE "attendance" ADD CONSTRAINT "attendance_schedule_id_fkey" FOREIGN KE
-- AddForeignKey
ALTER TABLE "attendance" ADD CONSTRAINT "attendance_roster_id_fkey" FOREIGN KEY ("roster_id") REFERENCES "roster"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "schedule" ADD CONSTRAINT "schedule_survey_group_id_fkey" FOREIGN KEY ("survey_group_id") REFERENCES "surveyGroup"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "surveyTarget" ADD CONSTRAINT "surveyTarget_roster_id_fkey" FOREIGN KEY ("roster_id") REFERENCES "roster"("id") ON DELETE CASCADE ON UPDATE CASCADE;

Expand Down
29 changes: 16 additions & 13 deletions backend/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ model User {
Rosters Roster[]
Storages Storage[]
Posts Post[]
Comment Comment[]
Comments Comment[]
@@map("user")
}
Expand All @@ -100,7 +100,7 @@ model Roster {
Storage Storage? @relation(fields: [profileImageId], references: [id], onDelete: SetNull)
User User? @relation(fields: [userId], references: [id], onDelete: SetNull)
Attendance Attendance[]
Attendances Attendance[]
SurveyTargets SurveyTarget[]
@@map("roster")
Expand All @@ -122,12 +122,14 @@ model Attendance {
}

model Schedule {
id Int @id @default(autoincrement())
name String @db.VarChar(64)
date DateTime
type ScheduleType @default(Exercise)
description String @db.Text
id Int @id @default(autoincrement())
surveyGroupId Int @map("survey_group_id")
name String @db.VarChar(64)
date DateTime
type ScheduleType @default(Exercise)
description String @db.Text
SurveyGroup SurveyGroup @relation(fields: [surveyGroupId], references: [id], onDelete: Cascade)
Attendances Attendance[]
@@map("schedule")
Expand All @@ -140,7 +142,8 @@ model SurveyGroup {
endedAt DateTime @map("ended_at")
required Boolean @default(true)
SurveyTarget SurveyTarget[]
SurveyTargets SurveyTarget[]
Schedules Schedule[]
@@map("surveyGroup")
}
Expand Down Expand Up @@ -193,10 +196,10 @@ model Comment {
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
Post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
User User @relation(fields: [userId], references: [id], onDelete: Cascade)
Parent Comment? @relation("SubComments", fields: [parentId], references: [id], onDelete: Cascade)
Children Comment[] @relation("SubComments")
Post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
User User @relation(fields: [userId], references: [id], onDelete: Cascade)
Parent Comment? @relation("SubComments", fields: [parentId], references: [id], onDelete: Cascade)
Childrens Comment[] @relation("SubComments")
@@map("comment")
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/console/account/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { calculateTotalPages } from '@/lib/utils'
import { PAGINATION_LIMIT_DEFAULT } from '@/lib/vars'
import UserListTable from './_component/UserListTable'

export default async function Account({
export default async function AccountPage({
searchParams
}: {
searchParams?: {
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/app/console/roster/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default async function RosterPage() {
return (
<main className="mx-auto flex w-full flex-grow flex-col items-center justify-center">
<div className="mt-4 w-full px-4 text-left sm:px-6">
<h1 className="text-base font-bold sm:text-xl">부원명단</h1>
</div>
<div className="flex w-full flex-grow flex-col gap-5 py-4 sm:px-6"></div>
</main>
)
}
45 changes: 22 additions & 23 deletions frontend/src/components/ConsoleSidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
'use client'

import { getCurrentUserProfile } from '@/lib/actions'
import { auth } from '@/lib/auth'
import fetcher from '@/lib/fetcher'
import type { UserProfile } from '@/lib/types/user'
import { Dialog, Transition } from '@headlessui/react'
import {
ArrowRightStartOnRectangleIcon,
Bars3Icon,
CalendarIcon,
ChartPieIcon,
EnvelopeIcon,
FireIcon,
HomeIcon,
LinkIcon,
PencilIcon,
UserIcon,
UsersIcon,
XMarkIcon
Expand All @@ -32,24 +26,29 @@ const navigation = [
icon: HomeIcon,
role: 'User'
},
// {
// name: '건의사항',
// href: '/console/appeal',
// icon: EnvelopeIcon,
// role: 'User'
// },
// {
// name: '로스터연결',
// href: '/console/roster',
// icon: LinkIcon,
// role: 'User'
// },
{
name: '건의사항',
href: '/console/appeal',
icon: EnvelopeIcon,
role: 'User'
},
{
name: '로스터연결',
name: '부원관리',
href: '/console/roster',
icon: LinkIcon,
role: 'User'
icon: UsersIcon,
role: 'Manager'
},
{ name: '부원관리', href: '#', icon: UsersIcon, role: 'Manager' },
{ name: '시합관리', href: '#', icon: FireIcon, role: 'Manager' },
{ name: '일정관리', href: '#', icon: CalendarIcon, role: 'Manager' },
{ name: '계정관리', href: '/console/account', icon: UserIcon, role: 'Admin' },
{ name: '출석변경', href: '#', icon: PencilIcon, role: 'Admin' },
{ name: '출석통계', href: '#', icon: ChartPieIcon, role: 'Admin' }
// { name: '시합관리', href: '#', icon: FireIcon, role: 'Manager' },
// { name: '일정관리', href: '#', icon: CalendarIcon, role: 'Manager' },
{ name: '계정관리', href: '/console/account', icon: UserIcon, role: 'Admin' }
// { name: '출석변경', href: '#', icon: PencilIcon, role: 'Admin' },
// { name: '출석통계', href: '#', icon: ChartPieIcon, role: 'Admin' }
]

export default function ConsoleSidebar() {
Expand Down Expand Up @@ -97,7 +96,7 @@ export default function ConsoleSidebar() {

useEffect(() => {
const getProfile = async () => {
const profile = await getCurrentUserProfile()
const profile = await fetcher.get<UserProfile>('/user')
setProfile(profile)
}

Expand Down

0 comments on commit e1fe7cc

Please sign in to comment.