260306:1535 20260306:1500 refactor tags
Build and Deploy / deploy (push) Failing after 8m12s

This commit is contained in:
admin
2026-03-06 15:35:41 +07:00
parent 1cb909a796
commit 752df1fe59
10 changed files with 404 additions and 185 deletions
+18 -5
View File
@@ -253,11 +253,21 @@ export class MasterService {
// ... (Tag Logic เดิม คงไว้ตามปกติ) ...
async findAllTags(query?: SearchTagDto) {
const qb = this.tagRepo.createQueryBuilder('tag');
if (query?.search) {
qb.where('tag.tag_name LIKE :search OR tag.description LIKE :search', {
search: `%${query.search}%`,
if (query?.project_id) {
qb.andWhere('tag.project_id = :projectId', {
projectId: query.project_id,
});
}
if (query?.search) {
qb.andWhere(
'(tag.tag_name LIKE :search OR tag.description LIKE :search)',
{
search: `%${query.search}%`,
}
);
}
qb.orderBy('tag.tag_name', 'ASC');
if (query?.page && query?.limit) {
const page = query.page;
@@ -278,8 +288,11 @@ export class MasterService {
return tag;
}
async createTag(dto: CreateTagDto) {
const tag = this.tagRepo.create(dto);
async createTag(dto: CreateTagDto, userId: number) {
const tag = this.tagRepo.create({
...dto,
created_by: userId,
});
return this.tagRepo.save(tag);
}