implemented deleting of notes
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user