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

ckapps / overckd / 13656842746

31 May 2023 01:52PM CUT 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/tag/tag.effects.ts
NEW
1
import { useContext } from '@marblejs/core';
×
NEW
2
import { HttpStatus, r } from '@marblejs/http';
×
3
import { EventBusClientToken } from '@marblejs/messaging';
×
4
import { requestValidator$, t } from '@marblejs/middleware-io';
×
5
import {
×
6
  CreateTagCommand,
7
  FindTagByQueryEvent,
8
  GetTagByIdEvent,
9
  TagDto,
10
} from '@overckd/domain-rx';
11
import { UriIdQueryDto } from '@overckd/domain-rx/dist/shared/uri.codec';
×
NEW
12
import { pipe } from 'fp-ts/function';
×
NEW
13
import { map, mergeMap } from 'rxjs/operators';
×
14
import { transformFromRequestProperty } from '../../../core/search/transform-from-request-property.operator';
×
15

16
// ----------------------------------------------------------------------------
17
// Validators
18
// ----------------------------------------------------------------------------
19
const FlattenTagByQueryStringDto = t.partial({
×
20
  label: t.string,
21
  page: t.string,
22
  size: t.string,
23
});
24
/**
25
 * Validates request: `GET` find by query
26
 */
27
const validateFindByQueryRequest = requestValidator$({
×
28
  query: FlattenTagByQueryStringDto,
29
});
30

31
/**
32
 * Validates request: `GET` byId
33
 */
34
const validateGetByIdRequest = requestValidator$({
×
35
  params: UriIdQueryDto,
36
});
37

38
/**
39
 * Validates request: `GET` byId
40
 */
41
const validateCreateRequest = requestValidator$({
×
42
  body: TagDto,
43
});
44

45
// ----------------------------------------------------------------------------
46
// Effects
47
// ----------------------------------------------------------------------------
48
/**
49
 * `GET` all recipes
50
 */
51
// export const getRecipes$ = r.pipe(
52
//   r.matchPath('/'),
53
//   r.matchType('GET'),
54
//   r.useEffect((req$, ctx) => {
55
//     const eventBusClient = useContext(EventBusClientToken)(ctx.ask);
56

57
//     return req$.pipe(
58
//       mergeMap(req => {
59
//         return pipe(GetAllRecipeCollectionsEvent.create(), eventBusClient.send);
60
//       }),
61
//       map(value => ({ body: value.payload })),
62
//       // mapTo({ status: HttpStatus.OK, b }),
63
//     );
64
//   }),
65
// );
66

67
/**
68
 * `GET` Query tag
69
 */
70
export const findTagsByQuery$ = r.pipe(
×
71
  r.matchPath('/query'),
72
  r.matchType('GET'),
73
  r.useEffect((req$, ctx) => {
74
    const eventBusClient = useContext(EventBusClientToken)(ctx.ask);
×
75

76
    return req$.pipe(
×
77
      validateFindByQueryRequest,
78
      transformFromRequestProperty('query'),
79
      mergeMap(query =>
80
        pipe(FindTagByQueryEvent.create(query), eventBusClient.send),
×
81
      ),
82
      map(value =>
83
        value.payload === undefined
×
84
          ? { status: HttpStatus.NOT_FOUND }
×
85
          : { body: value.payload },
86
      ),
87
    );
88
  }),
89
);
90

91
/**
92
 * `GET` tag by ID
93
 */
94
export const getTagByUri$ = r.pipe(
×
95
  r.matchPath('/:uri'),
96
  r.matchType('GET'),
97
  r.useEffect((req$, ctx) => {
98
    const eventBusClient = useContext(EventBusClientToken)(ctx.ask);
×
99

100
    return req$.pipe(
×
101
      validateGetByIdRequest,
102
      mergeMap(req => {
103
        const { params } = req;
×
104

105
        return pipe(GetTagByIdEvent.create(params), eventBusClient.send);
×
106
      }),
107
      map(value => ({ body: value.payload })),
×
108
      // mapTo({ status: HttpStatus.OK, b }),
109
    );
110
  }),
111
);
112

113
export const createTag$ = r.pipe(
×
114
  r.matchPath('/'),
115
  r.matchType('POST'),
116
  r.useEffect((req$, ctx) => {
117
    const eventBusClient = useContext(EventBusClientToken)(ctx.ask);
×
118

119
    return req$.pipe(
×
120
      validateCreateRequest,
121
      mergeMap(req => {
122
        const { body } = req;
×
123

124
        return pipe(CreateTagCommand.create(body), eventBusClient.send);
×
125
      }),
126
      map(value => ({ body: value.payload })),
×
127
      // mapTo({ status: HttpStatus.OK, b }),
128
    );
129
  }),
130
);
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