working on bookmark editing

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-03-13 14:50:12 +01:00
parent b71fd4492c
commit 2d6b017352
13 changed files with 283 additions and 26 deletions

View File

@@ -218,10 +218,16 @@ CREATE TABLE IF NOT EXISTS {0} (
@Override
public void deleteEntity(String module, long entityId) {
deleteEntity(module,entityId,-1);
}
@Override
public void deleteEntity(String module, long entityId, long userId) {
try {
Query.delete().from(TABLE_TAGS)
.where(MODULE,iEqual(module)).where(ENTITY_ID,equal(entityId))
.execute(db);
var query = Query.delete().from(TABLE_TAGS)
.where(MODULE,iEqual(module)).where(ENTITY_ID,equal(entityId));
if (userId>0) query.where(USER_ID,equal(userId));
query.execute(db);
} catch (SQLException e){
throw failedToDropObject(Translatable.t("{module}.{id}", MODULE,module, ID,entityId)).causedBy(e);
}

View File

@@ -13,6 +13,8 @@ public interface TagDB {
void deleteEntity(String module, long entityId);
void deleteEntity(String module, long entityId, long userId);
Map<String, List<Long>> getUses(String tag, long id);
Collection<Tuple<String, Long>> list(long userId);

View File

@@ -134,6 +134,11 @@ public class TagModule extends BaseHandler implements TagService {
return sendContent(ex,tuples.map(t -> Map.of(TAG,t.a,COUNT,t.b)));
}
@Override
public void deleteEntity(String module, long entityId, long userId) {
tagDb.deleteEntity(module,entityId,userId);
}
@Override
public void save(String module, long entityId, Collection<Long> userIds, Collection<String> tags) {
tagDb.save(userIds,module,entityId,tags);