Skip to content

Commit

Permalink
feat: added operation mutations and drive queries
Browse files Browse the repository at this point in the history
  • Loading branch information
froid1911 committed Jan 8, 2024
1 parent 9335e8d commit eaf4692
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 210 deletions.
67 changes: 3 additions & 64 deletions api/src/generated/nexus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ export interface NexusGenInputs {
targetName?: string | null; // String
targetParentFolder?: string | null; // ID
}
CreateDocumentInput: { // input type
documentType: string; // String!
id: string; // ID!
}
DeleteNodeInput: { // input type
id: string; // ID!
}
Expand Down Expand Up @@ -137,12 +133,6 @@ export interface NexusGenObjects {
count: number; // Int!
message: string; // String!
}
DocumentDriveState: { // root type
icon?: string | null; // String
id: string; // ID!
name: string; // String!
remoteUrl?: string | null; // String
}
Mutation: {};
Query: {};
Session: { // root type
Expand All @@ -167,13 +157,12 @@ export interface NexusGenObjects {
}

export interface NexusGenInterfaces {
Document: any;
}

export interface NexusGenUnions {
}

export type NexusGenRootTypes = NexusGenInterfaces & NexusGenObjects
export type NexusGenRootTypes = NexusGenObjects

export type NexusGenAllTypes = NexusGenRootTypes & NexusGenScalars

Expand All @@ -197,19 +186,12 @@ export interface NexusGenFieldTypes {
count: number; // Int!
message: string; // String!
}
DocumentDriveState: { // field return type
icon: string | null; // String
id: string; // ID!
name: string; // String!
remoteUrl: string | null; // String
}
Mutation: { // field return type
addDrive: boolean | null; // Boolean
addFile: boolean | null; // Boolean
addFolder: boolean | null; // Boolean
copyNode: boolean | null; // Boolean
createChallenge: NexusGenRootTypes['Challenge'] | null; // Challenge
createDocument: boolean | null; // Boolean
createSession: NexusGenRootTypes['SessionOutput'] | null; // SessionOutput
deleteDrive: boolean | null; // Boolean
deleteNode: boolean | null; // Boolean
Expand All @@ -226,9 +208,6 @@ export interface NexusGenFieldTypes {
coreUnit: NexusGenRootTypes['CoreUnit'] | null; // CoreUnit
coreUnits: Array<NexusGenRootTypes['CoreUnit'] | null> | null; // [CoreUnit]
countUsers: NexusGenRootTypes['Counter'] | null; // Counter
document: NexusGenRootTypes['Document'] | null; // Document
documents: Array<string | null> | null; // [String]
drive: NexusGenRootTypes['DocumentDriveState'] | null; // DocumentDriveState
drives: Array<string | null> | null; // [String]
me: NexusGenRootTypes['User'] | null; // User
sessions: Array<NexusGenRootTypes['Session'] | null> | null; // [Session]
Expand All @@ -252,14 +231,6 @@ export interface NexusGenFieldTypes {
address: string; // String!
createdAt: NexusGenScalars['Date']; // Date!
}
Document: { // field return type
created: string; // String!
documentType: string; // String!
id: string; // String!
lastModified: string; // String!
name: string; // String!
revision: string; // String!
}
}

export interface NexusGenFieldTypeNames {
Expand All @@ -282,19 +253,12 @@ export interface NexusGenFieldTypeNames {
count: 'Int'
message: 'String'
}
DocumentDriveState: { // field return type name
icon: 'String'
id: 'ID'
name: 'String'
remoteUrl: 'String'
}
Mutation: { // field return type name
addDrive: 'Boolean'
addFile: 'Boolean'
addFolder: 'Boolean'
copyNode: 'Boolean'
createChallenge: 'Challenge'
createDocument: 'Boolean'
createSession: 'SessionOutput'
deleteDrive: 'Boolean'
deleteNode: 'Boolean'
Expand All @@ -311,9 +275,6 @@ export interface NexusGenFieldTypeNames {
coreUnit: 'CoreUnit'
coreUnits: 'CoreUnit'
countUsers: 'Counter'
document: 'Document'
documents: 'String'
drive: 'DocumentDriveState'
drives: 'String'
me: 'User'
sessions: 'Session'
Expand All @@ -337,14 +298,6 @@ export interface NexusGenFieldTypeNames {
address: 'String'
createdAt: 'Date'
}
Document: { // field return type name
created: 'String'
documentType: 'String'
id: 'String'
lastModified: 'String'
name: 'String'
revision: 'String'
}
}

export interface NexusGenArgTypes {
Expand All @@ -368,10 +321,6 @@ export interface NexusGenArgTypes {
createChallenge: { // args
address: string; // String!
}
createDocument: { // args
driveId: string; // String!
input: NexusGenInputs['CreateDocumentInput']; // CreateDocumentInput!
}
createSession: { // args
session: NexusGenInputs['SessionInput']; // SessionInput!
}
Expand Down Expand Up @@ -421,16 +370,6 @@ export interface NexusGenArgTypes {
countUsers: { // args
message: string; // String!
}
document: { // args
drive: string; // String!
id: string; // String!
}
documents: { // args
drive: string; // String!
}
drive: { // args
id: string; // String!
}
}
}

Expand All @@ -446,15 +385,15 @@ export type NexusGenInputNames = keyof NexusGenInputs;

export type NexusGenEnumNames = never;

export type NexusGenInterfaceNames = keyof NexusGenInterfaces;
export type NexusGenInterfaceNames = never;

export type NexusGenScalarNames = keyof NexusGenScalars;

export type NexusGenUnionNames = never;

export type NexusGenObjectsUsingAbstractStrategyIsTypeOf = never;

export type NexusGenAbstractsUsingStrategyResolveType = "Document";
export type NexusGenAbstractsUsingStrategyResolveType = never;

export type NexusGenFeaturesConfig = {
abstractTypeStrategies: {
Expand Down
25 changes: 0 additions & 25 deletions api/src/generated/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -44,39 +44,18 @@ type Counter {
message: String!
}

input CreateDocumentInput {
documentType: String!
id: ID!
}

"""Date custom scalar type"""
scalar Date

input DeleteNodeInput {
id: ID!
}

interface Document {
created: String!
documentType: String!
id: String!
lastModified: String!
name: String!
revision: String!
}

input DocumentDriveLocalStateInput {
availableOffline: Boolean!
sharingType: String
}

type DocumentDriveState {
icon: String
id: ID!
name: String!
remoteUrl: String
}

input DocumentDriveStateInput {
icon: String
id: ID!
Expand All @@ -95,7 +74,6 @@ type Mutation {
addFolder(drive: String!, operation: AddFolderInput!): Boolean
copyNode(drive: String!, operation: CopyNodeInput!): Boolean
createChallenge(address: String!): Challenge
createDocument(driveId: String!, input: CreateDocumentInput!): Boolean
createSession(session: SessionInput!): SessionOutput
deleteDrive(id: String!): Boolean
deleteNode(drive: String!, operation: DeleteNodeInput!): Boolean
Expand All @@ -113,9 +91,6 @@ type Query {
coreUnit(id: String): CoreUnit
coreUnits: [CoreUnit]
countUsers(message: String!): Counter
document(drive: String!, id: String!): Document
documents(drive: String!): [String]
drive(id: String!): DocumentDriveState
drives: [String]
me: User
sessions: [Session]
Expand Down
87 changes: 32 additions & 55 deletions api/src/modules/DocumentDrive/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@ export const DocumentDriveLocalState = objectType({
t.nonNull.boolean('availableOffline');
},
});
export const DocumentDriveState = objectType({
name: 'DocumentDriveState',
definition(t) {
t.nonNull.id('id');
t.nonNull.string('name');
// t.nonNull.list.nonNull.field('nodes', { type: UnionNode });
t.string('icon');
t.string('remoteUrl');
},
});

export const DocumentDriveLocalStateInput = inputObjectType({
name: 'DocumentDriveLocalStateInput',
Expand All @@ -35,26 +25,6 @@ export const DocumentDriveStateInput = inputObjectType({
},
});

export const FileNode = objectType({
name: 'FileNode',
definition(t) {
t.nonNull.string('id');
t.nonNull.string('name');
t.nonNull.string('kind');
t.nonNull.string('documentType');
t.string('parentFolder');
},
});
export const FolderNode = objectType({
name: 'FolderNode',
definition(t) {
t.nonNull.string('id');
t.nonNull.string('name');
t.nonNull.string('kind');
t.string('parentFolder');
},
});

export const AddFileInput = inputObjectType({
name: 'AddFileInput',
definition(t) {
Expand Down Expand Up @@ -139,40 +109,47 @@ export const UpdateNodeInput = inputObjectType({
},
});

export const UnionNode = unionType({
name: 'Node',
resolveType(node) {
return node.kind === 'file' ? 'FileNode' : 'FolderNode';
},
export const FileNode = objectType({
name: 'FileNode',
definition(t) {
t.members(FolderNode, FileNode);
t.nonNull.string('id');
t.nonNull.string('name');
t.nonNull.string('kind');
t.nonNull.string('documentType');
t.string('parentFolder');
},
});

export const CreateDocumentInput = inputObjectType({
name: 'CreateDocumentInput',
export const FolderNode = objectType({
name: 'FolderNode',
definition(t) {
t.nonNull.id('id');
t.nonNull.string('documentType');
t.nonNull.string('id');
t.nonNull.string('name');
t.nonNull.string('kind');
t.string('parentFolder');
},
});

export const Document = interfaceType({
name: 'Document',
resolveType: (document) => {
switch (document.documentType) {
case 'document-drive':
return 'DocumentDriveDocument';
default:
return null;
export const Node = unionType({
name: 'Node',
resolveType(node) {
if (node.kind === 'folder') {
return FolderNode;
}

return FileNode;
},
definition(t) {
t.nonNull.string('id', { resolve: (doc) => doc.id });
t.nonNull.string('name', { resolve: (doc) => doc.name });
t.nonNull.string('documentType', { resolve: (doc) => doc.documentType });
t.nonNull.string('lastModified', { resolve: (doc) => doc.lastModified });
t.nonNull.string('revision', { resolve: (doc) => doc.revision });
t.nonNull.string('created', { resolve: (doc) => doc.created });
t.members(FileNode, FolderNode);
},
});

export const DocumentDriveState = objectType({
name: 'DocumentDriveState',
definition(t) {
t.nonNull.id('id');
t.nonNull.string('name');
t.nonNull.list.field('nodes', { type: Node });
t.string('icon');
t.string('remoteUrl');
},
});
15 changes: 0 additions & 15 deletions api/src/modules/DocumentDrive/mutations.ts

This file was deleted.

13 changes: 0 additions & 13 deletions api/src/modules/DocumentDrive/mutations/createDocument.ts

This file was deleted.

1 change: 0 additions & 1 deletion api/src/modules/DocumentDrive/mutations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export * from './addFile';
export * from './addFolder';
export * from './addDrive';
export * from './copyNode';
export * from './createDocument';
export * from './deleteDrive';
export * from './deleteNode';
export * from './moveNode';
Expand Down
Loading

0 comments on commit eaf4692

Please sign in to comment.