Skip to content
This repository was archived by the owner on Aug 15, 2023. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4a7776c

Browse files
committedNov 22, 2022
fix(tk:shared): defined metadata filters based on nature type
1 parent cd83de4 commit 4a7776c

File tree

20 files changed

+356
-142
lines changed

20 files changed

+356
-142
lines changed
 

‎packages/shared/src/endpoints/MinimalEndpoint.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ export interface TypeOfEndpointInstance<E extends MinimalEndpointInstance> {
2222
? // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
2323
void
2424
: {
25-
[k in keyof NonNullable<E['Input']>]: NonNullable<
25+
[K in keyof NonNullable<E['Input']>]: NonNullable<
2626
E['Input']
27-
>[k] extends Codec<any, any, any>
28-
? runtimeType<NonNullable<E['Input']>[k]>
27+
>[K] extends Codec<any, any, any>
28+
? runtimeType<NonNullable<E['Input']>[K]>
2929
: never;
3030
};
3131
}
+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
import { APIError, toAPIError } from '@shared/errors/APIError';
2+
import { toValidationError } from '@shared/errors/ValidationError';
3+
import { Metadata } from '@shared/models/Metadata';
4+
import { string2Food } from '@shared/utils/food.utils';
5+
import {
6+
FollowingVideoMetadata,
7+
ForYouMetadata,
8+
NativeMetadata,
9+
ProfileMetadata,
10+
SearchMetadata,
11+
TKMetadata,
12+
} from '@tktrex/shared/models/metadata';
13+
import {
14+
CreatorType,
15+
FollowingType,
16+
ForYouType,
17+
NativeType,
18+
ProfileType,
19+
SearchType,
20+
} from '@tktrex/shared/models/Nature';
21+
import * as E from 'fp-ts/Either';
22+
import { pipe } from 'fp-ts/function';
23+
import {
24+
FollowingVideoMetadataDB,
25+
ForYouVideoMetadataDB,
26+
NativeMetadataDB,
27+
ProfileMetadataDB,
28+
SearchMetadataDB,
29+
TKMetadataDB,
30+
} from '../models/metadata';
31+
32+
type SpecificM<M> = Omit<M, keyof Metadata | '_id' | 'publicKey'>;
33+
34+
export const toTKNativeMetadata = (
35+
{ author, ...m }: SpecificM<NativeMetadataDB>,
36+
meta: Metadata
37+
): NativeMetadata => {
38+
return {
39+
...m,
40+
...meta,
41+
author: author ?? undefined,
42+
};
43+
};
44+
45+
export const toProfileMetadata = (
46+
m: SpecificM<ProfileMetadataDB>,
47+
meta: Metadata
48+
): ProfileMetadata => {
49+
return {
50+
...m,
51+
...meta,
52+
};
53+
};
54+
55+
export const toForYouMetadata = (
56+
{ author, music, hashtags, ...m }: SpecificM<ForYouVideoMetadataDB>,
57+
meta: Metadata
58+
): ForYouMetadata => {
59+
return {
60+
...m,
61+
...meta,
62+
author: author ?? undefined,
63+
music: music ?? undefined,
64+
hashtags: hashtags ?? [],
65+
};
66+
};
67+
68+
export const toSearchMetadata = (
69+
m: SpecificM<SearchMetadataDB>,
70+
meta: Metadata
71+
): SearchMetadata => {
72+
return { ...m, ...meta };
73+
};
74+
75+
export const toFollowingMetadata = (
76+
m: SpecificM<FollowingVideoMetadataDB>,
77+
meta: Metadata
78+
): FollowingVideoMetadata => {
79+
return { ...m, ...meta };
80+
};
81+
82+
export const toTKMetadata = ({
83+
publicKey,
84+
_id,
85+
id,
86+
blang,
87+
href,
88+
savingTime,
89+
clientTime,
90+
experimentId,
91+
researchTag,
92+
...m
93+
}: TKMetadataDB): E.Either<APIError, TKMetadata> => {
94+
const meta: Metadata = {
95+
id: id.substring(0, 10),
96+
blang,
97+
href,
98+
supporter: string2Food(publicKey),
99+
savingTime,
100+
clientTime,
101+
researchTag,
102+
experimentId,
103+
};
104+
105+
return pipe(
106+
E.tryCatch(() => {
107+
const mm: any = m;
108+
switch (m.nature.type) {
109+
case SearchType.value: {
110+
return toSearchMetadata(mm, meta);
111+
}
112+
case ForYouType.value: {
113+
return toForYouMetadata(mm, meta);
114+
}
115+
case FollowingType.value: {
116+
return toFollowingMetadata(mm, meta);
117+
}
118+
case CreatorType.value:
119+
case ProfileType.value: {
120+
return toProfileMetadata(mm, meta);
121+
}
122+
case NativeType.value: {
123+
return toTKNativeMetadata(mm, meta);
124+
}
125+
}
126+
}, toAPIError),
127+
E.chain((e) =>
128+
pipe(
129+
TKMetadata.decode(e),
130+
E.mapLeft((e) => toValidationError(TKMetadata.name, e))
131+
)
132+
)
133+
);
134+
};
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import { ForYouVideoMetadata } from '@tktrex/shared/models/metadata/ForYouMetadata';
1+
import { ForYouMetadata } from '@tktrex/shared/models/metadata/ForYouMetadata';
22
import * as t from 'io-ts';
33

4-
const { supporter, ...metadataBaseProps } = ForYouVideoMetadata.types[0].props;
5-
export const ForYouVideoMetadataDB = t.strict(
4+
const { supporter, ...metadataBaseProps } = ForYouMetadata.types[0].props;
5+
export const ForYouMetadataDB = t.strict(
66
{
77
...metadataBaseProps,
8-
...ForYouVideoMetadata.types[1].type.props,
9-
...ForYouVideoMetadata.types[2].props,
10-
...ForYouVideoMetadata.types[3].props,
8+
...ForYouMetadata.types[1].type.props,
9+
...ForYouMetadata.types[2].props,
10+
...ForYouMetadata.types[3].props,
1111
_id: t.any,
1212
publicKey: t.string,
1313
},
14-
'ForYouVideoMetadataDB'
14+
'ForYouMetadataDB'
1515
);
16-
export type ForYouVideoMetadataDB = t.TypeOf<typeof ForYouVideoMetadataDB>;
16+
export type ForYouMetadataDB = t.TypeOf<typeof ForYouMetadataDB>;
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as t from 'io-ts';
22
import { FollowingVideoMetadataDB } from './FollowingMetadata';
3-
import { ForYouVideoMetadataDB } from './ForYouMetadata';
3+
import { ForYouMetadataDB } from './ForYouMetadata';
44
import { NativeMetadataDB } from './NativeMetadata';
55
import { ProfileMetadataDB } from './ProfileMetadata';
66
import { SearchMetadataDB } from './SearchMetadata';
@@ -9,10 +9,18 @@ export const TKMetadataDB = t.union(
99
[
1010
NativeMetadataDB,
1111
SearchMetadataDB,
12-
ForYouVideoMetadataDB,
12+
ForYouMetadataDB,
1313
FollowingVideoMetadataDB,
1414
ProfileMetadataDB,
1515
],
1616
'MetadataDB'
1717
);
1818
export type TKMetadataDB = t.TypeOf<typeof TKMetadataDB>;
19+
20+
export {
21+
ProfileMetadataDB,
22+
NativeMetadataDB,
23+
SearchMetadataDB,
24+
FollowingVideoMetadataDB,
25+
ForYouMetadataDB as ForYouVideoMetadataDB,
26+
};
+96-33
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,51 @@
1+
import { toAPIError } from '@shared/errors/APIError';
12
import { decodeOrThrowRequest } from '@shared/endpoints/helper';
2-
import * as foodUtils from '@shared/utils/food.utils';
3-
import endpoints, {
4-
ListMetadataResponse,
5-
} from '@tktrex/shared/endpoints/v2/metadata.endpoints';
3+
import endpoints from '@tktrex/shared/endpoints/v2/metadata.endpoints';
64
import createDebug from 'debug';
5+
import * as A from 'fp-ts/Array';
6+
import { pipe } from 'fp-ts/lib/function';
7+
import * as TE from 'fp-ts/TaskEither';
8+
import * as E from 'fp-ts/lib/Either';
9+
import { toTKMetadata } from '../io/metadata.io';
710
import _ from 'lodash';
811
import * as automo from '../lib/automo';
12+
import { throwTE } from '@shared/utils/task.utils';
13+
import { AppError } from '@shared/errors/AppError';
14+
import moment from 'moment';
15+
import CSV from '../lib/CSV';
16+
import { ListMetadataOutput } from '@tktrex/shared/models/http/metadata/output/ListMetadata.output';
17+
import { ListMetadataQuery } from '@tktrex/shared/models/http/metadata/query/ListMetadata.query';
918

1019
const debug = createDebug('routes:public');
1120

1221
// This variables is used as cap in every readLimit below
1322
const PUBLIC_AMOUNT_ELEMS = 100;
1423

15-
const listMetadata = async (
16-
req: any
17-
): Promise<{ json: ListMetadataResponse }> => {
24+
type ListMetadataResponse =
25+
| { json: ListMetadataOutput }
26+
| { headers: any; text: string };
27+
28+
const listMetadata = async (req: any): Promise<ListMetadataResponse> => {
29+
const { query } = decodeOrThrowRequest(
30+
endpoints.ListMetadata,
31+
req
32+
) as any as {
33+
query: ListMetadataQuery;
34+
};
35+
36+
debug('Filter metadata with query %O', query);
37+
1838
const {
19-
query: {
20-
researchTag,
21-
experimentId,
22-
publicKey,
23-
nature,
24-
amount = PUBLIC_AMOUNT_ELEMS,
25-
skip = 0,
26-
},
27-
} = decodeOrThrowRequest(endpoints.ListMetadata, req);
39+
researchTag,
40+
experimentId,
41+
publicKey,
42+
nature,
43+
amount = PUBLIC_AMOUNT_ELEMS,
44+
skip = 0,
45+
format,
46+
} = query;
47+
48+
debug('Filter metadata with query %O', query);
2849

2950
const filter = {} as any;
3051
if (publicKey) {
@@ -36,29 +57,71 @@ const listMetadata = async (
3657
if (researchTag) {
3758
filter.researchTag = researchTag;
3859
}
60+
3961
if (nature) {
4062
filter['nature.type'] = nature;
63+
switch (nature) {
64+
case 'search': {
65+
const { query: q } = query;
66+
if (q) {
67+
filter.query = {
68+
$regex: q,
69+
};
70+
}
71+
break;
72+
}
73+
}
4174
}
4275

4376
debug('Filtering metadata for %O (%d, %d)', filter, amount, skip);
4477

45-
const metadata = await automo
46-
.getMetadataByFilter(filter, {
47-
amount,
48-
skip,
49-
})
50-
.then(({ totals, data }) => ({
51-
totals,
52-
data: data.map(({ publicKey, _id, id, ...m }) => ({
53-
...m,
54-
id: id.substring(0, 10),
55-
supporter: foodUtils.string2Food(publicKey),
56-
})),
57-
}));
58-
59-
debug('Fetched %d evidences of %d', _.size(metadata.data), metadata.totals);
60-
61-
return { json: metadata };
78+
return pipe(
79+
TE.tryCatch(
80+
() =>
81+
automo.getMetadataByFilter(filter, {
82+
amount,
83+
skip,
84+
}),
85+
toAPIError
86+
),
87+
TE.chain(({ totals, data }) => {
88+
debug('Metadata by %O, %d evidences', filter, _.size(data));
89+
return pipe(
90+
data.map(toTKMetadata),
91+
A.sequence(E.Applicative),
92+
E.map((d) => ({ data: d, totals })),
93+
TE.fromEither
94+
);
95+
}),
96+
TE.chain((metadata): TE.TaskEither<AppError, ListMetadataResponse> => {
97+
if (format === 'csv') {
98+
const csv = CSV.produceCSVv1(metadata.data);
99+
let filename = `metadata`;
100+
filename += experimentId ? `-experiment-${experimentId}` : '';
101+
filename += researchTag ? `-research_tag-${researchTag}` : '';
102+
filename += '-' + moment().format('YY-MM-DD') + '.csv';
103+
104+
debug(
105+
'VideoCSV: produced %d bytes, returning %s',
106+
_.size(csv),
107+
filename
108+
);
109+
110+
// if (!_.size(csv)) return { text: 'Error, Zorry: 🤷' };
111+
112+
return TE.right({
113+
headers: {
114+
'Content-Type': 'csv/text',
115+
'Content-Disposition': `attachment; filename=${filename}`,
116+
},
117+
text: csv,
118+
});
119+
}
120+
121+
return TE.right({ json: metadata });
122+
}),
123+
throwTE
124+
);
62125
};
63126

64127
export { listMetadata };

‎platforms/tktrex/backend/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"include": [
2929
"./bin",
3030
"./lib",
31+
"./io",
3132
"./models",
3233
"./routes",
3334
"./test",

‎platforms/tktrex/shared/src/arbitraries/Metadata.arb.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { getArbitrary } from 'fast-check-io-ts';
22
import {
33
SearchMetadata,
4-
ForYouVideoMetadata,
4+
ForYouMetadata,
55
FollowingVideoMetadata,
6-
MetadataBase,
6+
TKMetadataBase,
77
SearchMetadataResult,
88
NativeMetadata,
99
} from '../models/metadata';
@@ -12,7 +12,7 @@ import { fc } from '@shared/test';
1212
import { subDays } from 'date-fns';
1313
import * as t from 'io-ts';
1414

15-
const metadataBaseProps = propsOmitType(MetadataBase, [
15+
const metadataBaseProps = propsOmitType(TKMetadataBase, [
1616
'id',
1717
'clientTime',
1818
'savingTime',
@@ -101,7 +101,7 @@ export const SearchMetaDataArb = (opts: {
101101
* ForYouMetadata arbitrary
102102
*
103103
**/
104-
const forYouMetadataProps = propsOmitType(ForYouVideoMetadata.types[2], []);
104+
const forYouMetadataProps = propsOmitType(ForYouMetadata.types[2], []);
105105

106106
export const ForYouVideoMetaDataArb = getArbitrary(
107107
t.intersection([t.type(metadataBaseProps), t.type(forYouMetadataProps)]),

‎platforms/tktrex/shared/src/endpoints/v2/metadata.endpoints.ts

+3-41
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,7 @@
11
import { DocumentedEndpoint } from '@shared/endpoints';
2-
import { Format } from '@shared/models/common';
32
import * as t from 'io-ts';
4-
import { NumberFromString } from 'io-ts-types/NumberFromString';
5-
import * as apiModel from '../../models';
6-
7-
export const ListMetadataOutput = t.strict(
8-
{
9-
totals: t.strict({
10-
native: t.number,
11-
search: t.number,
12-
foryou: t.number,
13-
profile: t.number,
14-
}),
15-
data: t.array(apiModel.TKMetadata.TKMetadata),
16-
},
17-
'ListMetadataOutput',
18-
);
19-
20-
export const ListMetadataResponse = t.strict(
21-
{
22-
data: t.array(apiModel.TKMetadata.TKMetadata),
23-
totals: t.record(apiModel.Nature.NatureType, t.number),
24-
},
25-
'ListMetadataResponse',
26-
);
27-
export type ListMetadataResponse = t.TypeOf<typeof ListMetadataResponse>;
28-
29-
export const ListMetadataQuery = t.type(
30-
{
31-
publicKey: t.union([t.string, t.undefined]),
32-
nature: t.union([apiModel.Nature.NatureType, t.undefined]),
33-
experimentId: t.union([t.string, t.undefined]),
34-
researchTag: t.union([t.string, t.undefined]),
35-
amount: t.union([NumberFromString, t.number, t.undefined]),
36-
skip: t.union([NumberFromString, t.number, t.undefined]),
37-
format: t.union([Format, t.undefined]),
38-
},
39-
'ListMetadataQuery',
40-
);
41-
42-
export type ListMetadataQuery = t.TypeOf<typeof ListMetadataQuery>;
3+
import { ListMetadataOutput } from '../../models/http/metadata/output/ListMetadata.output';
4+
import { ListMetadataQuery } from '../../models/http/metadata/query/ListMetadata.query';
435

446
const ListMetadata = DocumentedEndpoint({
457
title: 'List metadata by given filters',
@@ -48,7 +10,7 @@ const ListMetadata = DocumentedEndpoint({
4810
Method: 'GET',
4911
getPath: () => '/v2/metadata',
5012
Input: {
51-
Query: ListMetadataQuery,
13+
Query: ListMetadataQuery as any as t.TypeC<any>,
5214
},
5315
Output: ListMetadataOutput,
5416
});

‎platforms/tktrex/shared/src/endpoints/v2/public.endpoints.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { DocumentedEndpoint } from '@shared/endpoints';
2-
import { Format, What } from '@shared/models/common';
32
import { SearchQuery } from '@shared/models/http/SearchQuery';
43
import * as t from 'io-ts';
54
import * as apiModel from '../../models';
5+
import { GetSearchByQueryInputParams } from '../../models/http/Search';
66

77
export const Handshake = DocumentedEndpoint({
88
title: 'Handshake',
@@ -42,10 +42,7 @@ const GetSearchByQuery = DocumentedEndpoint({
4242
Method: 'GET',
4343
getPath: ({ query, format }) => `/v2/public/query/${query}/${format}`,
4444
Input: {
45-
Params: t.type({
46-
query: What,
47-
format: Format,
48-
}),
45+
Params: GetSearchByQueryInputParams,
4946
Query: SearchQuery,
5047
},
5148
Output: apiModel.Public.GetSearchByQueryOutput,

‎platforms/tktrex/shared/src/models/http/Search.ts

+13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
import * as t from 'io-ts';
2+
import { What, Format } from '@shared/models/common';
3+
4+
export const GetSearchByQueryInputParams = t.type(
5+
{
6+
query: What,
7+
format: Format,
8+
},
9+
'GetSearchByQueryInputParams',
10+
);
11+
12+
export type GetSearchByQueryInputParams = t.TypeOf<
13+
typeof GetSearchByQueryInputParams
14+
>;
215

316
export const GetSearchByQueryOutput = t.type(
417
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import * as t from 'io-ts';
2+
import * as TKMetadata from '../../../metadata';
3+
4+
export const ListMetadataOutput = t.strict(
5+
{
6+
totals: t.strict({
7+
native: t.number,
8+
search: t.number,
9+
foryou: t.number,
10+
profile: t.number,
11+
}),
12+
data: t.array(TKMetadata.TKMetadata),
13+
},
14+
'ListMetadataOutput',
15+
);
16+
17+
export type ListMetadataOutput = t.TypeOf<typeof ListMetadataOutput>;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { Format } from '@shared/models/common';
2+
import * as t from 'io-ts';
3+
import { NumberFromString } from 'io-ts-types/NumberFromString';
4+
import * as Nature from '../../../Nature';
5+
6+
export const ListVideoMetadataQuery = t.type(
7+
{
8+
nature: Nature.VideoType,
9+
},
10+
'ListVideoMetadataQuery',
11+
);
12+
13+
export const ListSearchMetadataQuery = t.type(
14+
{
15+
nature: Nature.SearchType,
16+
query: t.union([t.string, t.undefined]),
17+
},
18+
'ListSearchMetadataQuery',
19+
);
20+
21+
export const ListMetadataQuery = t.intersection(
22+
[
23+
t.type({
24+
publicKey: t.union([t.string, t.undefined]),
25+
nature: t.union([Nature.NatureType, t.undefined]),
26+
experimentId: t.union([t.string, t.undefined]),
27+
researchTag: t.union([t.string, t.undefined]),
28+
amount: t.union([NumberFromString, t.number, t.undefined]),
29+
skip: t.union([NumberFromString, t.number, t.undefined]),
30+
format: t.union([Format, t.undefined]),
31+
}),
32+
t.union([ListVideoMetadataQuery, ListSearchMetadataQuery]),
33+
],
34+
'ListMetadataQuery',
35+
);
36+
37+
export type ListMetadataQuery = t.TypeOf<typeof ListMetadataQuery>;

‎platforms/tktrex/shared/src/models/metadata/FollowingMetadata.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import * as t from 'io-ts';
22
import { FollowingN } from '../Nature';
33
import { Author } from './Author';
4-
import { MetadataBase } from './MetadataBase';
4+
import { TKMetadataBase } from './MetadataBase';
55
import { Music } from './Music';
66

77
export const FollowingVideoMetadata = t.intersection(
88
[
9-
MetadataBase,
9+
TKMetadataBase,
1010
FollowingN,
1111
t.type({ nature: FollowingN }),
1212
t.type(
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
import * as t from 'io-ts';
22
import { ForYouN } from '../Nature';
33
import { Author } from './Author';
4-
import { MetadataBase } from './MetadataBase';
4+
import { TKMetadataBase } from './MetadataBase';
55
import { Metrics } from './Metrics';
66
import { Music } from './Music';
77

8-
export const ForYouVideoMetadata = t.intersection(
8+
export const ForYouMetadata = t.intersection(
99
[
10-
MetadataBase,
10+
TKMetadataBase,
1111
ForYouN,
1212
t.type({ nature: ForYouN }),
1313
t.type(
1414
{
1515
// baretext is the smallest part of the description,
1616
// not including the tags
17-
baretext: t.string,
17+
baretext: t.union([t.string, t.undefined]),
1818

1919
// description is the whole text written below the video,
2020
// including the tags
21-
description: t.string,
21+
description: t.union([t.string, t.undefined]),
2222

23-
author: Author,
24-
music: Music,
23+
author: t.union([Author, t.undefined]),
24+
music: t.union([Music, t.undefined]),
2525
// the hashtags, with their leading #
2626
// note: they do not seem to be cleaned at the moment,
2727
// some have trailing whitespace
@@ -31,7 +31,7 @@ export const ForYouVideoMetadata = t.intersection(
3131
'foryou',
3232
),
3333
],
34-
'ForYouVideoMetadata',
34+
'ForYouMetadata',
3535
);
3636

37-
export type ForYouVideoMetadata = t.TypeOf<typeof ForYouVideoMetadata>;
37+
export type ForYouMetadata = t.TypeOf<typeof ForYouMetadata>;
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,12 @@
1+
import { Metadata } from '@shared/models/Metadata';
12
import * as t from 'io-ts';
2-
import { date } from 'io-ts-types/lib/date';
3-
import { DateFromISOString } from 'io-ts-types/lib/DateFromISOString';
43

5-
export const MetadataBase = t.type(
4+
export const TKMetadataBase = t.type(
65
{
7-
id: t.string,
8-
/**
9-
* The href where the evidence has been collected
10-
*/
11-
href: t.string,
12-
/**
13-
* The supporter publicKey
14-
*
15-
* TODO: it may be replaced by the supporter id
16-
*/
17-
supporter: t.string,
6+
...Metadata.type.props,
187
timelineId: t.string,
19-
researchTag: t.union([t.string, t.undefined]),
20-
experimentId: t.union([t.string, t.undefined]),
21-
/**
22-
* DB saving time
23-
*/
24-
clientTime: t.union([date, DateFromISOString]),
25-
savingTime: t.union([date, DateFromISOString]),
268
},
27-
'MetadataBase',
9+
'TKMetadataBase'
2810
);
2911

30-
export type MetadataBase = t.TypeOf<typeof MetadataBase>;
12+
export type TKMetadataBase = t.TypeOf<typeof TKMetadataBase>;

‎platforms/tktrex/shared/src/models/metadata/NativeMetadata.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import * as t from 'io-ts';
22
import { NativeVideoN } from '../Nature';
33
import { Author } from './Author';
4-
import { MetadataBase } from './MetadataBase';
4+
import { TKMetadataBase } from './MetadataBase';
55
import { Metrics } from './Metrics';
66
import { Music } from './Music';
77

88
export const NativeMetadata = t.intersection(
99
[
10-
MetadataBase,
10+
TKMetadataBase,
1111
NativeVideoN,
1212
t.type({ nature: NativeVideoN }, 'NativeMetadataType'),
1313
t.type(

‎platforms/tktrex/shared/src/models/metadata/ProfileMetadata.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as t from 'io-ts';
22
import { NativeVideoN, ProfileN } from '../Nature';
3-
import { MetadataBase } from './MetadataBase';
3+
import { TKMetadataBase } from './MetadataBase';
44

55
export const ProfileResult = t.type(
66
{
@@ -19,7 +19,7 @@ export type ProfileResult = t.TypeOf<typeof ProfileResult>;
1919

2020
export const ProfileMetadata = t.intersection(
2121
[
22-
MetadataBase,
22+
TKMetadataBase,
2323
ProfileN,
2424
t.type({ nature: ProfileN }),
2525
t.type({

‎platforms/tktrex/shared/src/models/metadata/SearchMetadata.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as t from 'io-ts';
22
import { NativeVideoN, Nature, SearchN } from '../Nature';
3-
import { MetadataBase } from './MetadataBase';
3+
import { TKMetadataBase } from './MetadataBase';
44

55
export const ResultLinked = t.type(
66
{ link: Nature, desc: t.string },
@@ -21,7 +21,7 @@ export const SearchMetadataResult = t.type(
2121
);
2222
export const SearchMetadata = t.intersection(
2323
[
24-
MetadataBase,
24+
TKMetadataBase,
2525
SearchN,
2626
t.type({ nature: SearchN }),
2727
t.type(

‎platforms/tktrex/shared/src/models/metadata/index.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import * as t from 'io-ts';
2-
import { MetadataBase } from './MetadataBase';
2+
import { TKMetadataBase } from './MetadataBase';
33
import { FollowingVideoMetadata } from './FollowingMetadata';
4-
import { ForYouVideoMetadata } from './ForYouMetadata';
4+
import { ForYouMetadata } from './ForYouMetadata';
55
import { NativeMetadata } from './NativeMetadata';
66
import { ProfileMetadata } from './ProfileMetadata';
77
import { SearchMetadata, SearchMetadataResult } from './SearchMetadata';
88

99
export const TKMetadata = t.union(
1010
[
11+
ForYouMetadata,
1112
SearchMetadata,
12-
ForYouVideoMetadata,
1313
FollowingVideoMetadata,
1414
NativeMetadata,
1515
ProfileMetadata,
@@ -20,9 +20,9 @@ export const TKMetadata = t.union(
2020
export type TKMetadata = t.TypeOf<typeof TKMetadata>;
2121

2222
export {
23-
MetadataBase,
23+
TKMetadataBase,
2424
FollowingVideoMetadata,
25-
ForYouVideoMetadata,
25+
ForYouMetadata,
2626
NativeMetadata,
2727
SearchMetadata,
2828
SearchMetadataResult,

‎platforms/yttrex/backend/lib/automo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { Supporter } from '@yttrex/shared/models/Supporter';
2626
import { differenceInSeconds, formatDistance } from 'date-fns';
2727
import D from 'debug';
2828
import _ from 'lodash';
29-
import { Ad } from 'models/Ad';
29+
import { Ad } from '../models/Ad';
3030
import moment from 'moment';
3131
import { DeleteResult, Filter, MongoClient } from 'mongodb';
3232
import nconf from 'nconf';

0 commit comments

Comments
 (0)
This repository has been archived.