Skip to content

Commit

Permalink
wip: continued
Browse files Browse the repository at this point in the history
  • Loading branch information
rschlaefli committed Nov 2, 2022
1 parent 92506a1 commit 0a8c80e
Show file tree
Hide file tree
Showing 12 changed files with 445 additions and 75 deletions.
18 changes: 18 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@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-yoga": "3.0.0-next.8",
Expand Down
31 changes: 22 additions & 9 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ model Account {
model User {
id String @id @default(uuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
name String?
email String? @unique
emailVerified DateTime?
image String?
matriculationNumber String?
personalCV String?
transcriptOfRecords String?
role String @default("STUDENT")
Expand All @@ -64,6 +67,7 @@ model User {
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
ownedProposals UserProposalOwnership[]
assignedProposals UserProposalAssignment[]
supervisedProposals UserProposalSupervision[]
appliedFor UserProposalApplication[]
Expand Down Expand Up @@ -98,11 +102,10 @@ model ProposalAttachment {
model Proposal {
id String @id @unique @default(uuid())
title String
description String
title String
description String
language String?
plannedStartAt DateTime?
plannedEndAt DateTime?
attachments ProposalAttachment[]
Expand All @@ -115,12 +118,12 @@ model Proposal {
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
ownedBy UserProposalOwnership[]
assignedTo UserProposalAssignment[]
supervisedBy UserProposalSupervision[]
applications UserProposalApplication[]
receivedFeedbacks UserProposalFeedback[]
// TODO: student selects one or multiple topic areas?
// TODO: BW can reassign topic areas?
topicAreas TopicArea[]
}
Expand Down Expand Up @@ -158,6 +161,16 @@ model UserProposalApplication {
@@unique([proposalId, userId])
}

model UserProposalOwnership {
proposal Proposal @relation(fields: [proposalId], references: [id])
proposalId String
user User @relation(fields: [userId], references: [id])
userId String
@@unique([proposalId, userId])
}

model UserProposalFeedback {
proposal Proposal @relation(fields: [proposalId], references: [id])
proposalId String
Expand Down
36 changes: 36 additions & 0 deletions src/graphql/generated/nexus-typegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,23 @@ export interface NexusGenObjects {
Proposal: { // root type
description: string; // String!
id: string; // String!
ownedBy: NexusGenRootTypes['User'][]; // [User!]!
statusKey: NexusGenEnums['ProposalStatus']; // ProposalStatus!
title: string; // String!
topicAreas: NexusGenRootTypes['TopicArea'][]; // [TopicArea!]!
typeKey: NexusGenEnums['ProposalType']; // ProposalType!
}
Query: {};
TopicArea: { // root type
id?: string | null; // String
name?: string | null; // String
}
User: { // root type
email: string; // String!
id: number; // Int!
name: string; // String!
role: string; // String!
}
}

export interface NexusGenInterfaces {
Expand All @@ -55,26 +67,50 @@ export interface NexusGenFieldTypes {
Proposal: { // field return type
description: string; // String!
id: string; // String!
ownedBy: NexusGenRootTypes['User'][]; // [User!]!
statusKey: NexusGenEnums['ProposalStatus']; // ProposalStatus!
title: string; // String!
topicAreas: NexusGenRootTypes['TopicArea'][]; // [TopicArea!]!
typeKey: NexusGenEnums['ProposalType']; // ProposalType!
}
Query: { // field return type
proposals: NexusGenRootTypes['Proposal'][]; // [Proposal!]!
}
TopicArea: { // field return type
id: string | null; // String
name: string | null; // String
}
User: { // field return type
email: string; // String!
id: number; // Int!
name: string; // String!
role: string; // String!
}
}

export interface NexusGenFieldTypeNames {
Proposal: { // field return type name
description: 'String'
id: 'String'
ownedBy: 'User'
statusKey: 'ProposalStatus'
title: 'String'
topicAreas: 'TopicArea'
typeKey: 'ProposalType'
}
Query: { // field return type name
proposals: 'Proposal'
}
TopicArea: { // field return type name
id: 'String'
name: 'String'
}
User: { // field return type name
email: 'String'
id: 'Int'
name: 'String'
role: 'String'
}
}

export interface NexusGenArgTypes {
Expand Down
44 changes: 42 additions & 2 deletions src/graphql/generated/ops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ export type Proposal = {
__typename?: 'Proposal';
description: Scalars['String'];
id: Scalars['String'];
ownedBy: Array<User>;
statusKey: ProposalStatus;
title: Scalars['String'];
topicAreas: Array<TopicArea>;
typeKey: ProposalType;
};

Expand All @@ -44,10 +46,24 @@ export type Query = {
proposals: Array<Proposal>;
};

export type TopicArea = {
__typename?: 'TopicArea';
id?: Maybe<Scalars['String']>;
name?: Maybe<Scalars['String']>;
};

export type User = {
__typename?: 'User';
email: Scalars['String'];
id: Scalars['Int'];
name: Scalars['String'];
role: Scalars['String'];
};

export type ProposalsQueryVariables = Exact<{ [key: string]: never; }>;


export type ProposalsQuery = { __typename?: 'Query', proposals: Array<{ __typename?: 'Proposal', id: string, title: string, description: string, typeKey: ProposalType, statusKey: ProposalStatus }> };
export type ProposalsQuery = { __typename?: 'Query', proposals: Array<{ __typename?: 'Proposal', id: string, title: string, description: string, typeKey: ProposalType, statusKey: ProposalStatus, topicAreas: Array<{ __typename?: 'TopicArea', id?: string | null, name?: string | null }>, ownedBy: Array<{ __typename?: 'User', id: number, name: string, role: string }> }> };



Expand Down Expand Up @@ -120,20 +136,26 @@ export type DirectiveResolverFn<TResult = {}, TParent = {}, TContext = {}, TArgs
export type ResolversTypes = {
Boolean: ResolverTypeWrapper<Scalars['Boolean']>;
File: ResolverTypeWrapper<Scalars['File']>;
Int: ResolverTypeWrapper<Scalars['Int']>;
Proposal: ResolverTypeWrapper<Proposal>;
ProposalStatus: ProposalStatus;
ProposalType: ProposalType;
Query: ResolverTypeWrapper<{}>;
String: ResolverTypeWrapper<Scalars['String']>;
TopicArea: ResolverTypeWrapper<TopicArea>;
User: ResolverTypeWrapper<User>;
};

/** Mapping between all available schema types and the resolvers parents */
export type ResolversParentTypes = {
Boolean: Scalars['Boolean'];
File: Scalars['File'];
Int: Scalars['Int'];
Proposal: Proposal;
Query: {};
String: Scalars['String'];
TopicArea: TopicArea;
User: User;
};

export interface FileScalarConfig extends GraphQLScalarTypeConfig<ResolversTypes['File'], any> {
Expand All @@ -143,8 +165,10 @@ export interface FileScalarConfig extends GraphQLScalarTypeConfig<ResolversTypes
export type ProposalResolvers<ContextType = any, ParentType extends ResolversParentTypes['Proposal'] = ResolversParentTypes['Proposal']> = {
description?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
id?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
ownedBy?: Resolver<Array<ResolversTypes['User']>, ParentType, ContextType>;
statusKey?: Resolver<ResolversTypes['ProposalStatus'], ParentType, ContextType>;
title?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
topicAreas?: Resolver<Array<ResolversTypes['TopicArea']>, ParentType, ContextType>;
typeKey?: Resolver<ResolversTypes['ProposalType'], ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};
Expand All @@ -153,15 +177,31 @@ export type QueryResolvers<ContextType = any, ParentType extends ResolversParent
proposals?: Resolver<Array<ResolversTypes['Proposal']>, ParentType, ContextType>;
};

export type TopicAreaResolvers<ContextType = any, ParentType extends ResolversParentTypes['TopicArea'] = ResolversParentTypes['TopicArea']> = {
id?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
name?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};

export type UserResolvers<ContextType = any, ParentType extends ResolversParentTypes['User'] = ResolversParentTypes['User']> = {
email?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
id?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
name?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
role?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};

export type Resolvers<ContextType = any> = {
File?: GraphQLScalarType;
Proposal?: ProposalResolvers<ContextType>;
Query?: QueryResolvers<ContextType>;
TopicArea?: TopicAreaResolvers<ContextType>;
User?: UserResolvers<ContextType>;
};



export const ProposalsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Proposals"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"proposals"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"typeKey"}},{"kind":"Field","name":{"kind":"Name","value":"statusKey"}}]}}]}}]} as unknown as DocumentNode<ProposalsQuery, ProposalsQueryVariables>;
export const ProposalsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Proposals"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"proposals"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"typeKey"}},{"kind":"Field","name":{"kind":"Name","value":"statusKey"}},{"kind":"Field","name":{"kind":"Name","value":"topicAreas"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"ownedBy"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"role"}}]}}]}}]}}]} as unknown as DocumentNode<ProposalsQuery, ProposalsQueryVariables>;

export interface PossibleTypesResultData {
possibleTypes: {
Expand Down
14 changes: 14 additions & 0 deletions src/graphql/generated/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ scalar File
type Proposal {
description: String!
id: String!
ownedBy: [User!]!
statusKey: ProposalStatus!
title: String!
topicAreas: [TopicArea!]!
typeKey: ProposalType!
}

Expand All @@ -29,4 +31,16 @@ enum ProposalType {

type Query {
proposals: [Proposal!]!
}

type TopicArea {
id: String
name: String
}

type User {
email: String!
id: Int!
name: String!
role: String!
}
Loading

0 comments on commit 0a8c80e

Please sign in to comment.