-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(api): filter media for 'empty thumbnail'
- Loading branch information
1 parent
bfa00d4
commit be188c9
Showing
7 changed files
with
66 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
services/api/src/flows/admin/media/getMediaAdminStats.flow.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { fp, pipe } from "@liexp/core/lib/fp/index.js"; | ||
import { sequenceS } from "fp-ts/lib/Apply.js"; | ||
import { IsNull } from "typeorm"; | ||
import { MediaEntity } from "#entities/Media.entity.js"; | ||
import { type TEFlow } from "#flows/flow.types.js"; | ||
import { getOrphanMediaFlow } from "#flows/media/getOrphanMedia.flow.js"; | ||
import { getTempMediaCountFlow } from "#flows/media/getTempMediaCount.flow.js"; | ||
|
||
export const getMediaWithoutThumbnailsFlow: TEFlow<[], MediaEntity[]> = | ||
(ctx) => () => { | ||
return pipe( | ||
ctx.db.find(MediaEntity, { | ||
where: { | ||
thumbnail: IsNull(), | ||
}, | ||
}), | ||
); | ||
}; | ||
|
||
export const getMediaAdminStatsFlow: TEFlow<[], any> = (ctx) => () => { | ||
return pipe( | ||
sequenceS(fp.TE.ApplicativePar)({ | ||
orphans: getOrphanMediaFlow(ctx)(), | ||
temp: getTempMediaCountFlow(ctx)(), | ||
noThumbnails: getMediaWithoutThumbnailsFlow(ctx)(), | ||
}), | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters