Skip to content

Commit

Permalink
feat: implement Proposal Application Acceptance Workflow (#12)
Browse files Browse the repository at this point in the history
Co-authored-by: Roland Schlaefli <[email protected]>
  • Loading branch information
mxmlnwbr and rschlaefli authored Nov 28, 2023
1 parent b73f12a commit 3cae829
Show file tree
Hide file tree
Showing 8 changed files with 405 additions and 183 deletions.
340 changes: 170 additions & 170 deletions prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async function seed(prisma: PrismaClient) {
)

await new Promise((resolve) =>
rl.question('Please sign-in with Azure AD before continuing...', (ans) => {
rl.question('Please sign-in before continuing...', (ans) => {
rl.close()
resolve(ans)
})
Expand All @@ -87,177 +87,177 @@ async function seed(prisma: PrismaClient) {
},
})

await prisma.proposal.upsert({
where: { id: '3ef84a3b-cff0-4350-b760-4c5bb3b3c98f' },
create: {
id: '3ef84a3b-cff0-4350-b760-4c5bb3b3c98f',
title: 'Effects of Interest Rate on Happiness',
description: 'This is a very interesting topic',
language: '["English"]',
studyLevel: 'Master Thesis (30 ECTS)',
topicArea: {
connect: {
slug: 'sustainable_finance',
},
},
status: {
connect: { key: ProposalStatus.OPEN },
},
type: {
connect: { key: ProposalType.STUDENT },
},
applications: {
create: {
email: '[email protected]',
plannedStartAt: new Date(),
fullName: 'Roland Ferdinand',
matriculationNumber: '12-345-678',
motivation: 'I want to',
},
},
ownedByStudent: '[email protected]',
ownedByUser: {
connect: { email: user.email },
},
receivedFeedbacks: {
create: {
comment: 'Rejected because',
type: {
connect: { key: ProposalFeedbackType.REJECTED_NOT_SCIENTIFIC },
},
reason: ProposalFeedbackType.REJECTED_NOT_SCIENTIFIC,
user: {
connect: { email: user.email },
},
},
},
},
update: {},
})
// await prisma.proposal.upsert({
// where: { id: '3ef84a3b-cff0-4350-b760-4c5bb3b3c98f' },
// create: {
// id: '3ef84a3b-cff0-4350-b760-4c5bb3b3c98f',
// title: 'Effects of Interest Rate on Happiness',
// description: 'This is a very interesting topic',
// language: '["English"]',
// studyLevel: 'Master Thesis (30 ECTS)',
// topicArea: {
// connect: {
// slug: 'sustainable_finance',
// },
// },
// status: {
// connect: { key: ProposalStatus.OPEN },
// },
// type: {
// connect: { key: ProposalType.STUDENT },
// },
// applications: {
// create: {
// email: '[email protected]',
// plannedStartAt: new Date(),
// fullName: 'Roland Ferdinand',
// matriculationNumber: '12-345-678',
// motivation: 'I want to',
// },
// },
// ownedByStudent: '[email protected]',
// ownedByUser: {
// connect: { email: user.email },
// },
// receivedFeedbacks: {
// create: {
// comment: 'Rejected because',
// type: {
// connect: { key: ProposalFeedbackType.REJECTED_NOT_SCIENTIFIC },
// },
// reason: ProposalFeedbackType.REJECTED_NOT_SCIENTIFIC,
// user: {
// connect: { email: user.email },
// },
// },
// },
// },
// update: {},
// })

await prisma.proposal.upsert({
where: { id: '33a9a1b7-cad7-46e7-8b72-cfcbdbaa60d6' },
create: {
id: '33a9a1b7-cad7-46e7-8b72-cfcbdbaa60d6',
title:
'The role of interest rate expectations for the choice between Fixed-Rate Mortgages and Adjustable-Rate Mortgages',
description:
'The role of interest rate expectations for the choice between Fixed-Rate Mortgages and Adjustable-Rate Mortgages',
language: '["English", "German"]',
studyLevel: 'Master Thesis (30 ECTS)',
timeFrame: 'Sometime next year.',
topicArea: {
connect: {
slug: 'banking_and_insurance',
},
},
status: {
connect: { key: ProposalStatus.OPEN },
},
type: {
connect: { key: ProposalType.SUPERVISOR },
},
supervisedBy: {
create: {
supervisor: {
connect: { email: user.email },
},
},
},
ownedByUser: {
connect: { email: user.email },
},
applications: {
create: {
plannedStartAt: new Date(),
email: '[email protected]',
fullName: 'Roland Ferdinand',
matriculationNumber: '12-345-678',
motivation:
'I want to do this topic as I think it is very interesting.',
attachments: {
createMany: {
data: [
{
name: 'CV.pdf',
href: 'https://example.com/cv.pdf',
type: 'application/pdf',
},
{
name: 'Transcript.pdf',
href: 'https://example.com/cv.pdf',
type: 'application/pdf',
},
],
},
},
},
},
},
update: {},
})
// await prisma.proposal.upsert({
// where: { id: '33a9a1b7-cad7-46e7-8b72-cfcbdbaa60d6' },
// create: {
// id: '33a9a1b7-cad7-46e7-8b72-cfcbdbaa60d6',
// title:
// 'The role of interest rate expectations for the choice between Fixed-Rate Mortgages and Adjustable-Rate Mortgages',
// description:
// 'The role of interest rate expectations for the choice between Fixed-Rate Mortgages and Adjustable-Rate Mortgages',
// language: '["English", "German"]',
// studyLevel: 'Master Thesis (30 ECTS)',
// timeFrame: 'Sometime next year.',
// topicArea: {
// connect: {
// slug: 'banking_and_insurance',
// },
// },
// status: {
// connect: { key: ProposalStatus.OPEN },
// },
// type: {
// connect: { key: ProposalType.SUPERVISOR },
// },
// supervisedBy: {
// create: {
// supervisor: {
// connect: { email: user.email },
// },
// },
// },
// ownedByUser: {
// connect: { email: user.email },
// },
// applications: {
// create: {
// plannedStartAt: new Date(),
// email: '[email protected]',
// fullName: 'Roland Ferdinand',
// matriculationNumber: '12-345-678',
// motivation:
// 'I want to do this topic as I think it is very interesting.',
// attachments: {
// createMany: {
// data: [
// {
// name: 'CV.pdf',
// href: 'https://example.com/cv.pdf',
// type: 'application/pdf',
// },
// {
// name: 'Transcript.pdf',
// href: 'https://example.com/cv.pdf',
// type: 'application/pdf',
// },
// ],
// },
// },
// },
// },
// },
// update: {},
// })

await prisma.proposal.upsert({
where: { id: '21140e2e-e630-494a-ab18-374fd11c62c0' },
create: {
id: '21140e2e-e630-494a-ab18-374fd11c62c0',
title:
'Treiber der Inflation in der Schweiz / Inflationsmessung in der Schweiz',
description:
'Treiber der Inflation in der Schweiz / Inflationsmessung in der Schweiz',
language: '["English"]',
studyLevel: 'Master Thesis (30 ECTS)',
timeFrame: '2023',
topicArea: {
connect: {
slug: 'financial_economics',
},
},
status: {
connect: { key: ProposalStatus.OPEN },
},
type: {
connect: { key: ProposalType.SUPERVISOR },
},
supervisedBy: {
create: {
supervisor: {
connect: { email: user.email },
},
},
},
ownedByUser: {
connect: { email: user.email },
},
applications: {
create: {
plannedStartAt: new Date(),
email: '[email protected]',
fullName: 'Roland Ferdinand',
matriculationNumber: '12-345-678',
motivation:
'I want to do this topic as I think it is very interesting.',
attachments: {
createMany: {
data: [
{
name: 'CV.pdf',
href: 'https://example.com/cv.pdf',
type: 'application/pdf',
},
{
name: 'Transcript.pdf',
href: 'https://example.com/cv.pdf',
type: 'application/pdf',
},
],
},
},
},
},
},
update: {},
})
// await prisma.proposal.upsert({
// where: { id: '21140e2e-e630-494a-ab18-374fd11c62c0' },
// create: {
// id: '21140e2e-e630-494a-ab18-374fd11c62c0',
// title:
// 'Treiber der Inflation in der Schweiz / Inflationsmessung in der Schweiz',
// description:
// 'Treiber der Inflation in der Schweiz / Inflationsmessung in der Schweiz',
// language: '["English"]',
// studyLevel: 'Master Thesis (30 ECTS)',
// timeFrame: '2023',
// topicArea: {
// connect: {
// slug: 'financial_economics',
// },
// },
// status: {
// connect: { key: ProposalStatus.OPEN },
// },
// type: {
// connect: { key: ProposalType.SUPERVISOR },
// },
// supervisedBy: {
// create: {
// supervisor: {
// connect: { email: user.email },
// },
// },
// },
// ownedByUser: {
// connect: { email: user.email },
// },
// applications: {
// create: {
// plannedStartAt: new Date(),
// email: '[email protected]',
// fullName: 'Roland Ferdinand',
// matriculationNumber: '12-345-678',
// motivation:
// 'I want to do this topic as I think it is very interesting.',
// attachments: {
// createMany: {
// data: [
// {
// name: 'CV.pdf',
// href: 'https://example.com/cv.pdf',
// type: 'application/pdf',
// },
// {
// name: 'Transcript.pdf',
// href: 'https://example.com/cv.pdf',
// type: 'application/pdf',
// },
// ],
// },
// },
// },
// },
// },
// update: {},
// })
}

seed(prismaClient)
Expand Down
10 changes: 9 additions & 1 deletion src/components/ApplicationDetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ import { add, format, parseISO } from 'date-fns'
import { useState } from 'react'
import { ApplicationDetails } from 'src/types/app'

function ApplicationDetailsModal({ row }: { row: ApplicationDetails }) {
function ApplicationDetailsModal({
row,
isModalOpen,
setIsModalOpen,
}: {
row: ApplicationDetails
isModalOpen: boolean
setIsModalOpen: (isOpen: boolean) => void
}) {
const FileTypeIconMap: Record<string, IconDefinition> = {
'application/pdf': faFilePdf,
}
Expand Down
Loading

0 comments on commit 3cae829

Please sign in to comment.