single tag exists, connected to one asset, and is not deleted

This commit is contained in:
Jorge Montejo 2025-10-03 20:46:08 +02:00
parent 0aaaaa17bc
commit b7a08f9531
2 changed files with 29 additions and 3 deletions

View file

@ -53,6 +53,7 @@ import { MemoryTable } from 'src/schema/tables/memory.table';
import { PersonTable } from 'src/schema/tables/person.table';
import { SessionTable } from 'src/schema/tables/session.table';
import { StackTable } from 'src/schema/tables/stack.table';
import { TagAssetTable } from 'src/schema/tables/tag-asset.table';
import { TagTable } from 'src/schema/tables/tag.table';
import { UserTable } from 'src/schema/tables/user.table';
import { BASE_SERVICE_DEPENDENCIES, BaseService } from 'src/services/base.service';
@ -248,6 +249,18 @@ export class MediumTestContext<S extends BaseService = BaseService> {
const result = await this.get(TagRepository).create(tag);
return { tag, result };
}
async newTagAsset(tagBulkAssets: { tagIds: string[], assetIds: string[] }) {
const tagsAssets: Insertable<TagAssetTable>[] = [];
for (const tagsId of tagBulkAssets.tagIds) {
for (const assetsId of tagBulkAssets.assetIds) {
tagsAssets.push({ tagsId, assetsId });
}
}
const result = await this.get(TagRepository).upsertAssetIds(tagsAssets);
return { tagsAssets, result };
}
}
export class SyncTestContext extends MediumTestContext<SyncService> {