Skip to content

Commit

Permalink
fix query
Browse files Browse the repository at this point in the history
  • Loading branch information
FredPeal committed Dec 15, 2023
1 parent f6e333e commit b4dcb18
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
5 changes: 3 additions & 2 deletions src/modules/filesystem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
FILESYSTEM,
SystemModuleEntityInput,
WhereCondition,
FILESYSTEM_ATTACH_INPUT
} from '../../types';
import { ATTACH_FILE_MUTATION, DETACH_FILE_MUTATION } from '../../mutations';
import { ENTITY_FILES_QUERY } from '../../queries';
Expand Down Expand Up @@ -49,10 +50,10 @@ export class FileSystem {
query: ENTITY_FILES_QUERY,
variables: { entity, where, first, page },
});
return response.data.entityFiles as FILESYSTEM[];
return response.data.entityFiles.data as FILESYSTEM[];
}

public async attachFile(input: UPLOAD_INTERFACE): Promise<string> {
public async attachFile(input: FILESYSTEM_ATTACH_INPUT): Promise<string> {
const response = await this.client.mutate({
mutation: ATTACH_FILE_MUTATION,
variables: { input: input },
Expand Down
7 changes: 1 addition & 6 deletions src/mutations/filesystem.mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ import { gql } from '@apollo/client/core';

export const ATTACH_FILE_MUTATION = gql`
mutation attachFile($input: FilesystemAttachInput!) {
attachFile(input: $input) {
id
uuid
name
url
}
attachFile(input: $input)
}
`;

Expand Down
10 changes: 6 additions & 4 deletions src/queries/filesystem.query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ export const ENTITY_FILES_QUERY = gql`
$where: QueryEntityFilesWhereWhereConditions
) {
entityFiles(entity: $entity, where: $where) {
id
uuid
name
url
data {
id
uuid
name
url
}
}
}
`;
1 change: 1 addition & 0 deletions src/types/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface FILESYSTEM_ATTACH_INPUT {
filesystem_uuid: string;
field_name: string;
system_module_uuid: string;
entity_uuid: string;
}

export interface FILESYSTEM {
Expand Down

0 comments on commit b4dcb18

Please sign in to comment.