Skip to content

Commit

Permalink
refactor(api): get rid of superficial operations in create media route
Browse files Browse the repository at this point in the history
  • Loading branch information
ascariandrea committed Jan 7, 2024
1 parent 7c15bbc commit 20a6115
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions services/api/src/routes/media/createMedia.route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { toMediaIO } from "./media.io.js";
import { MediaEntity } from "#entities/Media.entity.js";
import { extractMP4Extra } from "#flows/media/extra/extractMP4Extra.js";
import { createThumbnail } from "#flows/media/thumbnails/createThumbnail.flow.js";
import { toControllerError } from "#io/ControllerError.js";
import { type RouteContext } from "#routes/route.types.js";
import { authenticationHandler } from "#utils/authenticationHandler.js";
import { ensureUserExists } from "#utils/user.utils.js";
Expand All @@ -27,12 +26,11 @@ export const MakeCreateMediaRoute = (r: Router, ctx: RouteContext): void => {
TE.bind("location", () => {
return pipe(
parseURL(body.location),
ctx.logger.info.logInPipe(`Parsed url %O`),
fp.E.mapLeft(toControllerError),
fp.E.fold(
() => TE.right(body.location),
(r) => TE.right(r.location),
() => body.location,
(r) => r.location,
),
TE.right,
);
}),
TE.bind("media", ({ location }) =>
Expand Down

0 comments on commit 20a6115

Please sign in to comment.