First unchecked draft for tags

This commit is contained in:
araemer 2026-02-21 08:28:15 +01:00
parent f936e84168
commit 70b132dc6f
51 changed files with 494 additions and 69 deletions

View file

@ -0,0 +1,24 @@
import { AbstractRepository } from "./AbstractRepository.js";
import { TagEntity } from "../entities/TagEntity.js";
/**
* Repository for TagEntity.
* The AbstractRepository already provides findById, findAll, create, update,
* and delete. Tag-specific queries can be added here as needed.
*/
export class TagRepository extends AbstractRepository<TagEntity> {
constructor() {
super(TagEntity);
}
/**
* Looks up a tag by its description (case-insensitive).
* Useful for detecting duplicates before creating a new tag.
*/
async findByDescription(description: string): Promise<TagEntity | null> {
return this.repo
.createQueryBuilder("tag")
.where("LOWER(tag.description) = LOWER(:description)", { description })
.getOne();
}
}