fix(server): clear activity when asset is removed from album (#19019)

This commit is contained in:
SGT
2025-07-10 14:37:56 -03:00
committed by GitHub
parent ed4c7817e7
commit 55fe67dd20
3 changed files with 61 additions and 0 deletions
@@ -1,4 +1,5 @@
import { UpdatedAtTrigger, UpdateIdColumn } from 'src/decorators';
import { AlbumAssetTable } from 'src/schema/tables/album-asset.table';
import { AlbumTable } from 'src/schema/tables/album.table';
import { AssetTable } from 'src/schema/tables/asset.table';
import { UserTable } from 'src/schema/tables/user.table';
@@ -7,6 +8,7 @@ import {
Column,
CreateDateColumn,
ForeignKeyColumn,
ForeignKeyConstraint,
Generated,
Index,
PrimaryGeneratedColumn,
@@ -27,6 +29,14 @@ import {
name: 'CHK_2ab1e70f113f450eb40c1e3ec8',
expression: `("comment" IS NULL AND "isLiked" = true) OR ("comment" IS NOT NULL AND "isLiked" = false)`,
})
@ForeignKeyConstraint({
name: 'fk_activity_album_asset_composite',
columns: ['albumId', 'assetId'],
referenceTable: () => AlbumAssetTable,
referenceColumns: ['albumsId', 'assetsId'],
onUpdate: 'NO ACTION',
onDelete: 'CASCADE',
})
export class ActivityTable {
@PrimaryGeneratedColumn()
id!: Generated<string>;