chore: make sql
This commit is contained in:
@@ -279,6 +279,15 @@ where
|
|||||||
"asset_faces"."personId" = $1
|
"asset_faces"."personId" = $1
|
||||||
and "asset_faces"."deletedAt" is null
|
and "asset_faces"."deletedAt" is null
|
||||||
|
|
||||||
|
-- PersonRepository.getAssetPersonByFaceId
|
||||||
|
select
|
||||||
|
"asset_faces"."assetId",
|
||||||
|
"asset_faces"."personId"
|
||||||
|
from
|
||||||
|
"asset_faces"
|
||||||
|
where
|
||||||
|
"asset_faces"."id" = $1
|
||||||
|
|
||||||
-- PersonRepository.getLatestFaceDate
|
-- PersonRepository.getLatestFaceDate
|
||||||
select
|
select
|
||||||
max("asset_job_status"."facesRecognizedAt")::text as "latestDate"
|
max("asset_job_status"."facesRecognizedAt")::text as "latestDate"
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ export class TrashRepository {
|
|||||||
return this.db.selectFrom('assets').select(['id']).where('status', '=', AssetStatus.DELETED).stream();
|
return this.db.selectFrom('assets').select(['id']).where('status', '=', AssetStatus.DELETED).stream();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GenerateSql({ params: [DummyValue.UUID] })
|
|
||||||
getTrashedIds(userId: string): AsyncIterableIterator<{ id: string }> {
|
getTrashedIds(userId: string): AsyncIterableIterator<{ id: string }> {
|
||||||
return this.db
|
return this.db
|
||||||
.selectFrom('assets')
|
.selectFrom('assets')
|
||||||
|
|||||||
@@ -80,7 +80,11 @@ describe(ActivityService.name, () => {
|
|||||||
|
|
||||||
mocks.access.activity.checkCreateAccess.mockResolvedValue(new Set([albumId]));
|
mocks.access.activity.checkCreateAccess.mockResolvedValue(new Set([albumId]));
|
||||||
mocks.activity.create.mockResolvedValue(activity);
|
mocks.activity.create.mockResolvedValue(activity);
|
||||||
mocks.album.getById.mockResolvedValue({ ...albumStub.empty, owner: factory.user({ id: userId }), albumUsers: [] });
|
mocks.album.getById.mockResolvedValue({
|
||||||
|
...albumStub.empty,
|
||||||
|
owner: factory.user({ id: userId }),
|
||||||
|
albumUsers: [],
|
||||||
|
});
|
||||||
|
|
||||||
await sut.create(factory.auth({ user: { id: userId } }), {
|
await sut.create(factory.auth({ user: { id: userId } }), {
|
||||||
albumId,
|
albumId,
|
||||||
@@ -117,7 +121,11 @@ describe(ActivityService.name, () => {
|
|||||||
mocks.access.activity.checkCreateAccess.mockResolvedValue(new Set([albumId]));
|
mocks.access.activity.checkCreateAccess.mockResolvedValue(new Set([albumId]));
|
||||||
mocks.activity.create.mockResolvedValue(activity);
|
mocks.activity.create.mockResolvedValue(activity);
|
||||||
mocks.activity.search.mockResolvedValue([]);
|
mocks.activity.search.mockResolvedValue([]);
|
||||||
mocks.album.getById.mockResolvedValue({ ...albumStub.empty, owner: factory.user({ id: userId }), albumUsers: [] });
|
mocks.album.getById.mockResolvedValue({
|
||||||
|
...albumStub.empty,
|
||||||
|
owner: factory.user({ id: userId }),
|
||||||
|
albumUsers: [],
|
||||||
|
});
|
||||||
|
|
||||||
await sut.create(factory.auth({ user: { id: userId } }), { albumId, assetId, type: ReactionType.LIKE });
|
await sut.create(factory.auth({ user: { id: userId } }), { albumId, assetId, type: ReactionType.LIKE });
|
||||||
|
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ class ActivityManager {
|
|||||||
this.#subscribe = createSubscriber((update) => {
|
this.#subscribe = createSubscriber((update) => {
|
||||||
const unsubscribe = websocketEvents.on('on_activity_change', ({ albumId, assetId }) => {
|
const unsubscribe = websocketEvents.on('on_activity_change', ({ albumId, assetId }) => {
|
||||||
if (this.#albumId === albumId || this.#assetId === assetId) {
|
if (this.#albumId === albumId || this.#assetId === assetId) {
|
||||||
this.#invalidateCache(this.#albumId, this.#assetId);
|
this.#invalidateCache(albumId, this.#assetId);
|
||||||
handlePromiseError(this.refreshActivities(this.#albumId!, this.#assetId));
|
handlePromiseError(this.refreshActivities(albumId, this.#assetId));
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user