• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ckapps / overckd / 13656842746

31 May 2023 01:52PM UTC coverage: 20.328%. First build
13656842746

push

github

web-flow
Merge pull request #17 from ckapps/chore/update-deps

Chore/update deps

32 of 288 branches covered (11.11%)

Branch coverage included in aggregate %.

32 of 270 new or added lines in 73 files covered. (11.85%)

464 of 2152 relevant lines covered (21.56%)

0.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/packages/server/src/route/api/recipe/recipe.effects.ts
NEW
1
import { useContext } from '@marblejs/core';
×
NEW
2
import { combineRoutes, HttpStatus, r } from '@marblejs/http';
×
3
import { EventBusClientToken } from '@marblejs/messaging';
×
4
import { requestValidator$ } from '@marblejs/middleware-io';
×
5
import { GetRecipeByNameEvent, RecipeNameDto } from '@overckd/domain-rx';
×
NEW
6
import { pipe } from 'fp-ts/function';
×
NEW
7
import { map, mergeMap } from 'rxjs/operators';
×
8

9
// ----------------------------------------------------------------------------
10
// Validators
11
// ----------------------------------------------------------------------------
12
/**
13
 * Validates request: `GET` byId
14
 */
15
const validateGetByNameRequest = requestValidator$({
×
16
  params: RecipeNameDto,
17
});
18

19
// ----------------------------------------------------------------------------
20
// Effects
21
// ----------------------------------------------------------------------------
22
/**
23
 * `GET` all recipes
24
 */
25
// export const getRecipes$ = r.pipe(
26
//   r.matchPath('/'),
27
//   r.matchType('GET'),
28
//   r.useEffect((req$, ctx) => {
29
//     const eventBusClient = useContext(EventBusClientToken)(ctx.ask);
30

31
//     return req$.pipe(
32
//       mergeMap(req => {
33
//         return pipe(GetAllRecipeCollectionsEvent.create(), eventBusClient.send);
34
//       }),
35
//       map(value => ({ body: value.payload })),
36
//       // mapTo({ status: HttpStatus.OK, b }),
37
//     );
38
//   }),
39
// );
40

41
/**
42
 * `GET` recipe by name
43
 */
44
const getRecipeByName$ = r.pipe(
×
45
  r.matchPath('/:name'),
46
  r.matchType('GET'),
47
  r.useEffect((req$, ctx) => {
48
    const eventBusClient = useContext(EventBusClientToken)(ctx.ask);
×
49

50
    return req$.pipe(
×
51
      validateGetByNameRequest,
NEW
52
      map(x => x.params),
×
53
      mergeMap(params =>
54
        pipe(GetRecipeByNameEvent.create(params), eventBusClient.send),
×
55
      ),
56
      map(value =>
57
        value.payload === undefined
×
58
          ? { status: HttpStatus.NOT_FOUND }
×
59
          : { body: value.payload },
60
      ),
61
    );
62
  }),
63
);
64

65
// ----------------------------------------------------------------------------
66
// routes
67
// ----------------------------------------------------------------------------
68
/**
69
 * Combined routes for recipes
70
 */
71
export const recipes$ = combineRoutes('/recipes', [getRecipeByName$]);
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc