File tree Expand file tree Collapse file tree 1 file changed +24
-6
lines changed
Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -280,9 +280,18 @@ export const getChildFolders = Effect.fn(function* (
280280 color : folders . color ,
281281 parentId : folders . parentId ,
282282 organizationId : folders . organizationId ,
283- videoCount : sql < number > `(
284- SELECT COUNT(*) FROM videos WHERE videos.folderId = folders.id
285- )` ,
283+ videoCount :
284+ root . variant === "space"
285+ ? sql < number > `(
286+ SELECT COUNT(*)
287+ FROM space_videos
288+ WHERE space_videos.folderId = folders.id
289+ AND space_videos.spaceId = ${ root . spaceId }
290+ )`
291+ : sql < number > `(
292+ SELECT COUNT(*)
293+ FROM videos WHERE videos.folderId = folders.id
294+ )` ,
286295 } )
287296 . from ( folders )
288297 . where (
@@ -318,9 +327,18 @@ export const getAllFolders = Effect.fn(function* (
318327 color : folders . color ,
319328 parentId : folders . parentId ,
320329 organizationId : folders . organizationId ,
321- videoCount : sql < number > `(
322- SELECT COUNT(*) FROM videos WHERE videos.folderId = folders.id
323- )` ,
330+ videoCount :
331+ root . variant === "space"
332+ ? sql < number > `(
333+ SELECT COUNT(*)
334+ FROM space_videos
335+ WHERE space_videos.folderId = folders.id
336+ AND space_videos.spaceId = ${ root . spaceId }
337+ )`
338+ : sql < number > `(
339+ SELECT COUNT(*)
340+ FROM videos WHERE videos.folderId = folders.id
341+ )` ,
324342 } )
325343 . from ( folders )
326344 . where (
You can’t perform that action at this time.
0 commit comments