Skip to content

Commit

Permalink
feat(storage): file aliases (#1096)
Browse files Browse the repository at this point in the history
* feat: add alias logic in files
refactor: reduce duplicate code

* feat: append suffix on name conflict

* refactor: consider file extensions

* refactor: check if name is uuid

* Revert "refactor: check if name is uuid"

This reverts commit fadb026.
  • Loading branch information
ChrisPdgn authored Jul 29, 2024
1 parent 3e2792c commit bf3f63f
Show file tree
Hide file tree
Showing 11 changed files with 305 additions and 418 deletions.
12 changes: 10 additions & 2 deletions libraries/grpc-sdk/src/modules/storage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ export class Storage extends ConduitModule<typeof StorageDefinition> {
}

createFile(
name: string,
name: string | undefined,
data: string,
folder?: string,
container?: string,
mimeType?: string,
isPublic: boolean = false,
userId?: string,
scope?: string,
alias?: string,
): Promise<FileResponse> {
return this.client!.createFile({
name,
Expand All @@ -48,6 +49,7 @@ export class Storage extends ConduitModule<typeof StorageDefinition> {
container,
userId,
scope,
alias,
});
}

Expand All @@ -60,6 +62,7 @@ export class Storage extends ConduitModule<typeof StorageDefinition> {
mimeType?: string,
userId?: string,
scope?: string,
alias?: string,
): Promise<FileResponse> {
return this.client!.updateFile({
name,
Expand All @@ -70,6 +73,7 @@ export class Storage extends ConduitModule<typeof StorageDefinition> {
container,
userId,
scope,
alias,
});
}

Expand All @@ -78,14 +82,15 @@ export class Storage extends ConduitModule<typeof StorageDefinition> {
}

createFileByUrl(
name: string,
name: string | undefined,
folder?: string,
container?: string,
mimeType?: string,
size?: number,
isPublic: boolean = false,
userId?: string,
scope?: string,
alias?: string,
) {
return this.client!.createFileByUrl({
name,
Expand All @@ -96,6 +101,7 @@ export class Storage extends ConduitModule<typeof StorageDefinition> {
isPublic,
userId,
scope,
alias,
});
}

Expand All @@ -108,6 +114,7 @@ export class Storage extends ConduitModule<typeof StorageDefinition> {
size?: number,
userId?: string,
scope?: string,
alias?: string,
) {
return this.client!.updateFileByUrl({
id,
Expand All @@ -118,6 +125,7 @@ export class Storage extends ConduitModule<typeof StorageDefinition> {
size,
userId,
scope,
alias,
});
}
}
Loading

0 comments on commit bf3f63f

Please sign in to comment.