feat: add functionality to toggle inbox document source between personal and public scopes
Build and Push Multi-Platform Images / build-and-push (push) Successful in 34s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 34s
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
BadRequestException,
|
||||
ConflictException,
|
||||
Injectable,
|
||||
Logger,
|
||||
@@ -190,4 +191,25 @@ export class InboxService {
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
|
||||
async updateSource(
|
||||
id: string,
|
||||
source: InboxSource,
|
||||
preferredUsername: string | null,
|
||||
): Promise<void> {
|
||||
const { doc } = await this.resolveDocument(id, preferredUsername);
|
||||
|
||||
if (source === 'all') {
|
||||
doc.Source = 'all';
|
||||
doc.OwnerUsername = null;
|
||||
} else {
|
||||
if (!preferredUsername) {
|
||||
throw new BadRequestException('Benutzername erforderlich für persönlichen Scan');
|
||||
}
|
||||
doc.Source = 'user';
|
||||
doc.OwnerUsername = preferredUsername;
|
||||
}
|
||||
|
||||
await this.documentRepo.save(doc);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user