Skip to content

Commit

Permalink
sort alphabetically
Browse files Browse the repository at this point in the history
  • Loading branch information
143mailliw committed Apr 10, 2021
1 parent 4a42e4c commit 08b4b95
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/resolvers/components/files/FileObjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ interface IFilesArgs {
async function files(root: undefined, args: IFilesArgs, context: Context): Promise<IFileObject[]> {
const fileComponent = await Files.findOne({_id: args.componentId});
if(fileComponent && await permissions.checkReadPermission(context.user?.id ?? null, fileComponent.planet)) {
const files = FileObjects.find({componentId: args.componentId, parent: args.parent, type: "file", finishedUploading: true});
const files = FileObjects.find({componentId: args.componentId, parent: args.parent, type: "file", finishedUploading: true}).sort({'name': 1});
return files;
} else {
throw new Error("Not found.");
Expand All @@ -59,7 +59,7 @@ async function files(root: undefined, args: IFilesArgs, context: Context): Promi
async function folders(root: undefined, args: IFilesArgs, context: Context): Promise<IFileObject[]> {
const fileComponent = await Files.findOne({_id: args.componentId});
if(fileComponent && await permissions.checkReadPermission(context.user?.id ?? null, fileComponent.planet)) {
const folders = await FileObjects.find({componentId: args.componentId, parent: args.parent, type: "folder"});
const folders = await FileObjects.find({componentId: args.componentId, parent: args.parent, type: "folder"}).sort({'name': 1});
return folders;
} else {
throw new Error("Not found.");
Expand Down

0 comments on commit 08b4b95

Please sign in to comment.