add: delete actions for device + slightly better ui
This commit is contained in:
@@ -381,6 +381,47 @@ export class FileRepository {
|
||||
});
|
||||
}
|
||||
|
||||
listReferencedObjectKeysForUser(
|
||||
fctx: FlowExecCtx,
|
||||
userId: string,
|
||||
): ResultAsync<string[], Err> {
|
||||
return ResultAsync.fromPromise(
|
||||
this.db
|
||||
.select({
|
||||
objectKey: file.objectKey,
|
||||
metadata: file.metadata,
|
||||
})
|
||||
.from(file)
|
||||
.where(eq(file.userId, userId)),
|
||||
(error) =>
|
||||
fileErrors.getFilesFailed(
|
||||
fctx,
|
||||
error instanceof Error ? error.message : String(error),
|
||||
),
|
||||
).map((rows) => {
|
||||
const keys = new Set<string>();
|
||||
|
||||
for (const row of rows) {
|
||||
if (row.objectKey) {
|
||||
keys.add(row.objectKey);
|
||||
}
|
||||
|
||||
const thumbnailKey =
|
||||
row.metadata &&
|
||||
typeof row.metadata === "object" &&
|
||||
"thumbnailKey" in row.metadata
|
||||
? (row.metadata as Record<string, unknown>).thumbnailKey
|
||||
: undefined;
|
||||
|
||||
if (typeof thumbnailKey === "string" && thumbnailKey.length > 0) {
|
||||
keys.add(thumbnailKey);
|
||||
}
|
||||
}
|
||||
|
||||
return [...keys];
|
||||
});
|
||||
}
|
||||
|
||||
updateFileStatus(
|
||||
fctx: FlowExecCtx,
|
||||
fileId: string,
|
||||
|
||||
Reference in New Issue
Block a user