implemented deleting of notes

This commit is contained in:
2025-07-30 20:37:08 +02:00
parent e08bcf17a5
commit 3dab95691b
7 changed files with 43 additions and 13 deletions

View File

@@ -39,12 +39,14 @@ public class TaskModule extends BaseHandler implements TaskService {
private final UserService users;
private final CompanyService companies;
private final TagService tags;
private final NoteService notes;
public TaskModule(Configuration config, ProjectService projectService, TagService tagService) throws UmbrellaException {
public TaskModule(Configuration config, ProjectService projectService, TagService tagService, NoteService noteService) throws UmbrellaException {
var dbFile = config.get(CONFIG_DATABASE).orElseThrow(() -> missingFieldException(CONFIG_DATABASE));
taskDb = new SqliteDb(connect(dbFile));
projects = projectService;
companies = projectService.companyService();
notes = noteService;
tags = tagService;
users = companies.userService();
}
@@ -66,6 +68,7 @@ public class TaskModule extends BaseHandler implements TaskService {
var member = task.members().get(user.id());
if (member == null || !member.mayWrite()) throw forbidden("You are not allowed to delete {0}",task.name());
taskDb.delete(task);
notes.deleteEntity(TASK,taskId);
tags.deleteEntity(TASK,taskId);
return sendContent(ex,Map.of(DELETED,taskId));
}