Skip to content

Commit

Permalink
wip: progress
Browse files Browse the repository at this point in the history
  • Loading branch information
rschlaefli committed Nov 3, 2022
1 parent 0a8c80e commit 0957b3d
Show file tree
Hide file tree
Showing 12 changed files with 429 additions and 92 deletions.
57 changes: 48 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@
"start": "next start"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "6.2.0",
"@fortawesome/free-regular-svg-icons": "6.2.0",
"@fortawesome/free-solid-svg-icons": "6.2.0",
"@fortawesome/react-fontawesome": "0.2.0",
"@next-auth/prisma-adapter": "1.0.5",
"@next/font": "13.0.1",
"@prisma/client": "4.5.0",
"@uzh-bf/design-system": "0.0.66",
"date-fns": "2.29.3",
"formik": "2.2.9",
"graphql": "16.6.0",
"graphql-scalars": "1.20.0",
"graphql-yoga": "3.0.0-next.8",
"jsonwebtoken": "8.5.1",
"next": "13.0.1",
Expand Down
7 changes: 3 additions & 4 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,11 @@ model Account {
model User {
id String @id @default(uuid())
name String?
email String? @unique
name String
email String @unique
emailVerified DateTime?
image String?
matriculationNumber String?
personalCV String?
transcriptOfRecords String?
role String @default("STUDENT")
Expand Down Expand Up @@ -106,6 +104,7 @@ model Proposal {
description String
language String?
plannedStartAt DateTime?
studyLevel String
attachments ProposalAttachment[]
Expand Down
49 changes: 38 additions & 11 deletions prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,48 +44,75 @@ async function seed(prisma: PrismaClient) {
where: { email: '[email protected]' },
create: {
email: '[email protected]',
name: 'Roland Schläfli',
role: 'SUPERVISOR',
},
update: {
role: 'SUPERVISOR',
},
update: {},
})

await prisma.proposal.upsert({
where: { id: '3ef84a3b-cff0-4350-b760-4c5bb3b3c98f' },
create: {
id: '3ef84a3b-cff0-4350-b760-4c5bb3b3c98f',
title: 'Student Proposal',
description: 'This is a student proposal',
language: 'German',
plannedStartAt: new Date(),
studyLevel: 'Master Thesis (30 ECTS)',
topicAreas: {
create: {
name: 'Sustainable Finance',
},
},
status: {
connect: { key: ProposalStatus.OPEN },
},
type: {
connect: { key: ProposalType.STUDENT },
},
ownedBy: {
create: {
user: {
connect: { id: user.id },
},
},
},
},
update: {},
})

await prisma.proposal.upsert({
where: { id: '33a9a1b7-cad7-46e7-8b72-cfcbdbaa60d6' },
create: {
id: '33a9a1b7-cad7-46e7-8b72-cfcbdbaa60d6',
title: 'Supervisor Proposal',
description: 'This is a supervisor proposal',
language: 'English',
studyLevel: 'Bachelor Thesis (18 ECTS)',
topicAreas: {
create: {
name: 'Banking',
},
},
status: {
connect: { key: ProposalStatus.OPEN },
},
type: {
connect: { key: ProposalType.SUPERVISOR },
},
supervisedBy: {
connectOrCreate: {
where: {
proposalId_userId: {
proposalId: '33a9a1b7-cad7-46e7-8b72-cfcbdbaa60d6',
userId: user.id,
},
create: {
user: {
connect: { id: user.id },
},
create: {
user: {
connect: { id: user.id },
},
},
},
ownedBy: {
create: {
user: {
connect: { id: user.id },
},
},
},
Expand Down
52 changes: 44 additions & 8 deletions src/graphql/generated/nexus-typegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,31 @@
*/





import type { core } from "nexus"
declare global {
interface NexusGenCustomInputMethods<TypeName extends string> {
/**
* The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
*/
json<FieldName extends string>(fieldName: FieldName, opts?: core.CommonInputFieldConfig<TypeName, FieldName>): void // "JSONObject";
/**
* A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.
*/
date<FieldName extends string>(fieldName: FieldName, opts?: core.CommonInputFieldConfig<TypeName, FieldName>): void // "DateTime";
}
}
declare global {
interface NexusGenCustomOutputMethods<TypeName extends string> {
/**
* The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
*/
json<FieldName extends string>(fieldName: FieldName, ...opts: core.ScalarOutSpread<TypeName, FieldName>): void // "JSONObject";
/**
* A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.
*/
date<FieldName extends string>(fieldName: FieldName, ...opts: core.ScalarOutSpread<TypeName, FieldName>): void // "DateTime";
}
}


declare global {
Expand All @@ -27,15 +49,21 @@ export interface NexusGenScalars {
Float: number
Boolean: boolean
ID: string
DateTime: any
File: any
JSONObject: any
}

export interface NexusGenObjects {
Proposal: { // root type
description: string; // String!
id: string; // String!
ownedBy: NexusGenRootTypes['User'][]; // [User!]!
language: string; // String!
ownedBy: NexusGenRootTypes['User']; // User!
plannedStartAt?: NexusGenScalars['DateTime'] | null; // DateTime
statusKey: NexusGenEnums['ProposalStatus']; // ProposalStatus!
studyLevel: string; // String!
supervisedBy?: NexusGenRootTypes['User'] | null; // User
title: string; // String!
topicAreas: NexusGenRootTypes['TopicArea'][]; // [TopicArea!]!
typeKey: NexusGenEnums['ProposalType']; // ProposalType!
Expand All @@ -47,7 +75,7 @@ export interface NexusGenObjects {
}
User: { // root type
email: string; // String!
id: number; // Int!
id: string; // String!
name: string; // String!
role: string; // String!
}
Expand All @@ -67,8 +95,12 @@ export interface NexusGenFieldTypes {
Proposal: { // field return type
description: string; // String!
id: string; // String!
ownedBy: NexusGenRootTypes['User'][]; // [User!]!
language: string; // String!
ownedBy: NexusGenRootTypes['User']; // User!
plannedStartAt: NexusGenScalars['DateTime'] | null; // DateTime
statusKey: NexusGenEnums['ProposalStatus']; // ProposalStatus!
studyLevel: string; // String!
supervisedBy: NexusGenRootTypes['User'] | null; // User
title: string; // String!
topicAreas: NexusGenRootTypes['TopicArea'][]; // [TopicArea!]!
typeKey: NexusGenEnums['ProposalType']; // ProposalType!
Expand All @@ -82,7 +114,7 @@ export interface NexusGenFieldTypes {
}
User: { // field return type
email: string; // String!
id: number; // Int!
id: string; // String!
name: string; // String!
role: string; // String!
}
Expand All @@ -92,8 +124,12 @@ export interface NexusGenFieldTypeNames {
Proposal: { // field return type name
description: 'String'
id: 'String'
language: 'String'
ownedBy: 'User'
plannedStartAt: 'DateTime'
statusKey: 'ProposalStatus'
studyLevel: 'String'
supervisedBy: 'User'
title: 'String'
topicAreas: 'TopicArea'
typeKey: 'ProposalType'
Expand All @@ -107,7 +143,7 @@ export interface NexusGenFieldTypeNames {
}
User: { // field return type name
email: 'String'
id: 'Int'
id: 'String'
name: 'String'
role: 'String'
}
Expand Down
Loading

0 comments on commit 0957b3d

Please sign in to comment.