ad2app-lib 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ {
2
+ "folders": [
3
+ {
4
+ "path": "."
5
+ }
6
+ ],
7
+ "settings": {
8
+ "workbench.colorTheme": "Kimbie Dark"
9
+ }
10
+ }
@@ -1,8 +1,8 @@
1
- import { I_CampaignGoal } from "./I_CampaignGoal";
2
- import { I_CampaignCollaborationMethod } from "./I_CampaignCollaborationMethod";
3
- import { I_Influencer } from "./I_Influencer";
4
- import { I_InfluencersList } from "./I_InfluencersLists";
5
- import { I_CampaignDeadline } from "./I_CampaignDeadline";
1
+ import { I_CampaignGoal } from './I_CampaignGoal';
2
+ import { I_CampaignCollaborationMethod } from './I_CampaignCollaborationMethod';
3
+ import { I_Influencer } from './I_Influencer';
4
+ import { I_InfluencersList } from './I_InfluencersLists';
5
+ import { I_CampaignDeadline } from './I_CampaignDeadline';
6
6
  declare class I_Brief {
7
7
  brand: string;
8
8
  campaignTags: string;
@@ -21,8 +21,8 @@ export declare class I_Campaign {
21
21
  name: string;
22
22
  brief: I_Brief;
23
23
  influencersList: {
24
- id: I_InfluencersList["id"];
25
- name: I_InfluencersList["name"];
24
+ id: I_InfluencersList['id'];
25
+ name: I_InfluencersList['name'];
26
26
  influencers: I_Influencer[];
27
27
  };
28
28
  deadlines: I_CampaignDeadline[];
@@ -56,8 +56,8 @@ export declare class I_EditCampaignDTO {
56
56
  viewsFrom: number;
57
57
  viewsTo: number;
58
58
  campaignTags: string;
59
- campaignGoals: I_CampaignGoal[];
60
- campaignCollaborationMethods: I_CampaignCollaborationMethod[];
59
+ campaignGoals: string[];
60
+ campaignCollaborationMethods: string[];
61
61
  minInfluencersQuantity: number;
62
62
  maxInfluencersQuantity: number;
63
63
  startDate: Date;
@@ -56,7 +56,7 @@ __decorate([
56
56
  ], I_CreateInfluencersListForCampaignDTO.prototype, "influencers", void 0);
57
57
  class I_GetCampaignDTO {
58
58
  constructor(data) {
59
- this.id = data?.id ?? "";
59
+ this.id = data?.id ?? '';
60
60
  }
61
61
  }
62
62
  exports.I_GetCampaignDTO = I_GetCampaignDTO;
@@ -1,10 +1,11 @@
1
- import { I_OfferStatus } from "./I_Offer";
1
+ import { I_OfferStatus } from './I_Offer';
2
2
  export declare class I_CampaignDeadline {
3
3
  id: string;
4
4
  name: string;
5
5
  date: Date;
6
6
  isConfirmed: boolean;
7
7
  isReadyToConfirm: boolean;
8
+ createdAt: Date;
8
9
  constructor(data?: Partial<I_CampaignDeadline>);
9
10
  }
10
11
  export declare class I_CreateCampaignDeadlineDTO {
@@ -19,6 +19,7 @@ class I_CampaignDeadline {
19
19
  this.date = data?.date ?? null;
20
20
  this.isConfirmed = data?.isConfirmed ?? null;
21
21
  this.isReadyToConfirm = data?.isReadyToConfirm ?? null;
22
+ this.createdAt = data?.createdAt ?? null;
22
23
  }
23
24
  }
24
25
  exports.I_CampaignDeadline = I_CampaignDeadline;
@@ -66,7 +67,7 @@ class I_EditCampaignDeadlinesDTO {
66
67
  constructor(data) {
67
68
  this.campaignId = data?.campaignId ?? null;
68
69
  Object.entries(data || {}).forEach(([key, value]) => {
69
- if (key !== "startDate" && key !== "endDate") {
70
+ if (key !== 'startDate' && key !== 'endDate') {
70
71
  this[key] = value;
71
72
  }
72
73
  });
@@ -1,12 +1,18 @@
1
+ import { I_Media } from './I_Media';
1
2
  import { I_Offer } from './I_Offer';
3
+ import { I_User } from './I_User';
2
4
  export declare class I_Collaboration {
3
5
  id: string;
4
6
  offer: I_Offer;
5
- media: [];
7
+ media: I_Media[];
8
+ comments: I_CollaborationComment[];
6
9
  }
7
- export declare class I_GetCampaignCollaborationsDTO {
8
- campaignId: string;
9
- constructor(data?: Partial<I_GetCampaignCollaborationsDTO>);
10
+ export declare class I_CollaborationComment {
11
+ id: string;
12
+ content: string;
13
+ collaboration: I_Collaboration;
14
+ author: I_User;
15
+ createdAt: Date;
10
16
  }
11
17
  export declare class I_GetCollaborationDTO {
12
18
  collaborationId: string;
@@ -16,6 +22,10 @@ export declare class I_GetCollaborationByOfferDTO {
16
22
  offerId: string;
17
23
  constructor(data?: Partial<I_GetCollaborationByOfferDTO>);
18
24
  }
25
+ export declare class I_GetCampaignCollaborationsDTO {
26
+ campaignId: string;
27
+ constructor(data?: Partial<I_GetCampaignCollaborationsDTO>);
28
+ }
19
29
  export declare class I_GetCollaborationsDTO {
20
30
  userId: string;
21
31
  constructor(data?: Partial<I_GetCollaborationsDTO>);
@@ -28,8 +38,25 @@ export declare class I_CreateCollaborationDTO {
28
38
  offerId: string;
29
39
  constructor(data?: Partial<I_CreateCollaborationDTO>);
30
40
  }
31
- export declare class I_UploadFirstMediaVersionDTO {
41
+ export declare class I_UploadCollaborationMediaDTO {
32
42
  collaborationId: string;
33
43
  file: string;
34
44
  fileName: string;
35
45
  }
46
+ export declare class I_AddCollaborationCommentDTO {
47
+ collaborationId: string;
48
+ comment: string;
49
+ }
50
+ export declare class I_RequestCollaborationMediaAdjustmentDTO {
51
+ collaborationId: string;
52
+ comment: string;
53
+ }
54
+ export declare class I_AcceptCollaborationMediaDTO {
55
+ collaborationId: string;
56
+ }
57
+ export declare class I_RejectCollaborationMediaDTO {
58
+ collaborationId: string;
59
+ }
60
+ export declare class I_GetCollaborationCommentsDTO {
61
+ collaborationId: string;
62
+ }
@@ -1,15 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.I_UploadFirstMediaVersionDTO = exports.I_CreateCollaborationDTO = exports.I_Collaboration = void 0;
3
+ exports.I_GetCollaborationCommentsDTO = exports.I_RejectCollaborationMediaDTO = exports.I_AcceptCollaborationMediaDTO = exports.I_RequestCollaborationMediaAdjustmentDTO = exports.I_AddCollaborationCommentDTO = exports.I_UploadCollaborationMediaDTO = exports.I_CreateCollaborationDTO = exports.I_CollaborationComment = exports.I_Collaboration = void 0;
4
4
  class I_Collaboration {
5
5
  }
6
6
  exports.I_Collaboration = I_Collaboration;
7
+ class I_CollaborationComment {
8
+ }
9
+ exports.I_CollaborationComment = I_CollaborationComment;
7
10
  class I_CreateCollaborationDTO {
8
11
  constructor(data) {
9
12
  this.offerId = data?.offerId ?? null;
10
13
  }
11
14
  }
12
15
  exports.I_CreateCollaborationDTO = I_CreateCollaborationDTO;
13
- class I_UploadFirstMediaVersionDTO {
16
+ class I_UploadCollaborationMediaDTO {
17
+ }
18
+ exports.I_UploadCollaborationMediaDTO = I_UploadCollaborationMediaDTO;
19
+ class I_AddCollaborationCommentDTO {
20
+ }
21
+ exports.I_AddCollaborationCommentDTO = I_AddCollaborationCommentDTO;
22
+ class I_RequestCollaborationMediaAdjustmentDTO {
23
+ }
24
+ exports.I_RequestCollaborationMediaAdjustmentDTO = I_RequestCollaborationMediaAdjustmentDTO;
25
+ class I_AcceptCollaborationMediaDTO {
26
+ }
27
+ exports.I_AcceptCollaborationMediaDTO = I_AcceptCollaborationMediaDTO;
28
+ class I_RejectCollaborationMediaDTO {
29
+ }
30
+ exports.I_RejectCollaborationMediaDTO = I_RejectCollaborationMediaDTO;
31
+ class I_GetCollaborationCommentsDTO {
14
32
  }
15
- exports.I_UploadFirstMediaVersionDTO = I_UploadFirstMediaVersionDTO;
33
+ exports.I_GetCollaborationCommentsDTO = I_GetCollaborationCommentsDTO;
@@ -5,6 +5,8 @@ export declare class I_Item<T> implements I_ResponseMessage {
5
5
  status: T_FetchStatus;
6
6
  message?: string;
7
7
  constructor(data?: Partial<I_Item<T>>);
8
+ succeed?(data: T, message?: string): this;
9
+ fail?(message: string): this;
8
10
  }
9
11
  export declare const itemIsLoading: (item: I_Item<any>) => boolean;
10
12
  export declare const itemIsResolving: (item: I_Item<any>) => boolean;
@@ -7,6 +7,17 @@ class I_Item {
7
7
  this.status = data?.status || 'succeeded';
8
8
  this.message = data?.message || '';
9
9
  }
10
+ succeed(data, message) {
11
+ this.status = 'succeeded';
12
+ this.data = data;
13
+ this.message = message;
14
+ return this;
15
+ }
16
+ fail(message) {
17
+ this.status = 'failed';
18
+ this.message = message;
19
+ return this;
20
+ }
10
21
  }
11
22
  exports.I_Item = I_Item;
12
23
  const itemIsLoading = (item) => item.status === 'loading';
@@ -5,4 +5,6 @@ export declare class I_List<T> implements I_ResponseMessage {
5
5
  status: T_FetchStatus;
6
6
  message?: string;
7
7
  constructor(data?: Partial<I_List<T>>);
8
+ succeed?(items: T[], message?: string): this;
9
+ fail?(message: string): this;
8
10
  }
@@ -7,5 +7,16 @@ class I_List {
7
7
  this.status = data?.status || 'succeeded';
8
8
  this.message = data?.message || '';
9
9
  }
10
+ succeed(items, message) {
11
+ this.status = 'succeeded';
12
+ this.items = items;
13
+ this.message = message;
14
+ return this;
15
+ }
16
+ fail(message) {
17
+ this.status = 'failed';
18
+ this.message = message;
19
+ return this;
20
+ }
10
21
  }
11
22
  exports.I_List = I_List;
@@ -8,7 +8,8 @@ export declare class I_Media {
8
8
  id: string;
9
9
  url: string;
10
10
  fileName: string;
11
- type: I_MediaStage;
11
+ stage: I_MediaStage;
12
+ createdAt: Date;
12
13
  }
13
14
  export declare class I_GetCollaborationMediaDTO {
14
15
  collaborationId: string;
@@ -0,0 +1,11 @@
1
+ export declare enum SocialProvider {
2
+ TIKTOK = 'tiktok',
3
+ }
4
+ export declare class I_SocialSignInDTO {
5
+ userId: string;
6
+ provider: SocialProvider;
7
+ provider_user_id: string;
8
+ access_token: string;
9
+ refresh_token?: string;
10
+ expires_at?: string;
11
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.I_SocialSignInDTO = exports.SocialProvider = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ var SocialProvider;
15
+ (function (SocialProvider) {
16
+ SocialProvider["TIKTOK"] = "tiktok";
17
+ })(SocialProvider || (exports.SocialProvider = SocialProvider = {}));
18
+ class I_SocialSignInDTO {
19
+ }
20
+ exports.I_SocialSignInDTO = I_SocialSignInDTO;
21
+ __decorate([
22
+ (0, class_validator_1.IsNotEmpty)(),
23
+ __metadata("design:type", String)
24
+ ], I_SocialSignInDTO.prototype, "userId", void 0);
25
+ __decorate([
26
+ (0, class_validator_1.IsEnum)(SocialProvider),
27
+ __metadata("design:type", String)
28
+ ], I_SocialSignInDTO.prototype, "provider", void 0);
29
+ __decorate([
30
+ (0, class_validator_1.IsNotEmpty)(),
31
+ (0, class_validator_1.IsString)(),
32
+ __metadata("design:type", String)
33
+ ], I_SocialSignInDTO.prototype, "provider_user_id", void 0);
34
+ __decorate([
35
+ (0, class_validator_1.IsNotEmpty)(),
36
+ (0, class_validator_1.IsString)(),
37
+ __metadata("design:type", String)
38
+ ], I_SocialSignInDTO.prototype, "access_token", void 0);
39
+ __decorate([
40
+ (0, class_validator_1.IsOptional)(),
41
+ (0, class_validator_1.IsString)(),
42
+ __metadata("design:type", String)
43
+ ], I_SocialSignInDTO.prototype, "refresh_token", void 0);
44
+ __decorate([
45
+ (0, class_validator_1.IsOptional)(),
46
+ (0, class_validator_1.IsISO8601)(),
47
+ __metadata("design:type", String)
48
+ ], I_SocialSignInDTO.prototype, "expires_at", void 0);
@@ -1,8 +1,8 @@
1
- import { I_Influencer } from "./I_Influencer";
1
+ import { I_Influencer } from './I_Influencer';
2
2
  export declare class I_User {
3
3
  id: string;
4
- email: string;
5
- password: string;
4
+ email?: string;
5
+ password?: string;
6
6
  role: UserRoles;
7
7
  influencer?: I_Influencer;
8
8
  }
@@ -30,4 +30,5 @@ export * from './I_Offer';
30
30
  export * from './I_CampaignDeadline';
31
31
  export * from './I_Agency';
32
32
  export * from './I_Media';
33
+ export * from './I_SocialAccount';
33
34
  export * from './I_Collaboration';
@@ -46,4 +46,5 @@ __exportStar(require("./I_Offer"), exports);
46
46
  __exportStar(require("./I_CampaignDeadline"), exports);
47
47
  __exportStar(require("./I_Agency"), exports);
48
48
  __exportStar(require("./I_Media"), exports);
49
+ __exportStar(require("./I_SocialAccount"), exports);
49
50
  __exportStar(require("./I_Collaboration"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ad2app-lib",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "commonjs",
@@ -1,7 +1,7 @@
1
- import { FetchParams } from '../types';
2
- import { concatApiPaths, createQueryString, insertParams } from './utils';
1
+ import { FetchParams } from "../types";
2
+ import { concatApiPaths, createQueryString, insertParams } from "./utils";
3
3
 
4
- type HttpMethod = 'get' | 'post' | 'put' | 'patch' | 'delete';
4
+ type HttpMethod = "get" | "post" | "put" | "patch" | "delete";
5
5
 
6
6
  interface DriverConfig {
7
7
  apiUrl: string;
@@ -14,33 +14,36 @@ export function configureApiDriver(config: DriverConfig) {
14
14
  CONFIG = config;
15
15
  }
16
16
 
17
- type FetchCallArgs<Q> = [
18
- path: string,
19
- params?: FetchParams<Q>,
20
- method?: HttpMethod,
21
- headers?: HeadersInit,
17
+ type FetchCallArgs<Q> = {
18
+ path?: string;
19
+ params?: FetchParams<Q>;
20
+ method?: HttpMethod;
21
+ headers?: HeadersInit;
22
22
  transformers?: {
23
23
  body?: (body: any) => BodyInit;
24
- }
25
- ];
24
+ };
25
+ baseUrl?: string;
26
+ };
26
27
 
27
- export async function fetchCall<T, Q>(...args: FetchCallArgs<Q>): Promise<T> {
28
- let [path, fetchParams, method, headers, transformers] = args;
28
+ export async function fetchCall<T, Q>(args: FetchCallArgs<Q>): Promise<T> {
29
+ let { path, params, method, headers, baseUrl, transformers } = args;
29
30
 
30
31
  headers = {
31
- ...CONFIG.getHeaders?.(),
32
+ ...CONFIG?.getHeaders?.(),
32
33
  ...headers,
33
34
  };
34
35
 
35
36
  const query: Q = {} as Q;
36
- Object.entries(fetchParams?.query || {}).forEach(([key, val]) => {
37
+ Object.entries(params?.query || {}).forEach(([key, val]) => {
37
38
  query[key] = Array.isArray(val) ? JSON.stringify(val) : val;
38
39
  });
39
40
 
40
- const queryString = createQueryString({ ...fetchParams, query });
41
+ const apiUrl = baseUrl ?? CONFIG.apiUrl;
42
+
43
+ const queryString = createQueryString({ ...params, query });
41
44
  const fullPath = insertParams(
42
- concatApiPaths(CONFIG.apiUrl, path) + queryString,
43
- fetchParams?.params
45
+ concatApiPaths(apiUrl, path) + queryString,
46
+ params?.params
44
47
  );
45
48
 
46
49
  const init: RequestInit = {
@@ -48,34 +51,69 @@ export async function fetchCall<T, Q>(...args: FetchCallArgs<Q>): Promise<T> {
48
51
  headers,
49
52
  };
50
53
 
51
- if (fetchParams?.body) {
52
- // if (transformers?.body) {
53
- // init.body = transformers.body(fetchParams.body);
54
- // } else {
55
- init.body = JSON.stringify(fetchParams.body);
56
- // }
54
+ if (params?.body) {
55
+ if (transformers?.body) {
56
+ init.body = transformers.body(params.body);
57
+ } else {
58
+ init.body = JSON.stringify(params.body);
59
+ }
57
60
 
58
- headers['Content-Type'] = 'application/json';
61
+ if (!headers["Content-Type"]) {
62
+ headers["Content-Type"] = "application/json";
63
+ }
59
64
  }
60
65
 
61
66
  const res = await fetch(fullPath, init);
62
67
 
63
68
  if (!res.ok) throw new Error(JSON.stringify(await res.json()));
64
69
 
65
- return res.json() as Promise<T>;
70
+ try {
71
+ return res.json() as Promise<T>;
72
+ } catch {
73
+ return res.text() as Promise<T>;
74
+ }
66
75
  }
67
76
 
68
- export function apiDriver() {
77
+ type MethodCallArgs<Q> = [
78
+ path: string,
79
+ options: Omit<FetchCallArgs<Q>, "path" | "method">
80
+ ];
81
+
82
+ export function apiDriver(baseUrl?: string) {
69
83
  return {
70
- get: <T, Q>(...args: FetchCallArgs<Q>) =>
71
- fetchCall<T, Q>(args[0], args[1], 'get', args[3], args[4]),
72
- post: <T, Q>(...args: FetchCallArgs<Q>) =>
73
- fetchCall<T, Q>(args[0], args[1], 'post', args[3], args[4]),
74
- put: <T, Q>(...args: FetchCallArgs<Q>) =>
75
- fetchCall<T, Q>(args[0], args[1], 'put', args[3], args[4]),
76
- patch: <T, Q>(...args: FetchCallArgs<Q>) =>
77
- fetchCall<T, Q>(args[0], args[1], 'patch', args[3], args[4]),
78
- delete: <T, Q>(...args: FetchCallArgs<Q>) =>
79
- fetchCall<T, Q>(args[0], args[1], 'delete', args[3], args[4]),
84
+ get: <T, Q>(...args: MethodCallArgs<Q>) =>
85
+ fetchCall<T, Q>({
86
+ ...args[1],
87
+ path: args[0],
88
+ method: "get",
89
+ baseUrl,
90
+ }),
91
+ post: <T, Q>(...args: MethodCallArgs<Q>) =>
92
+ fetchCall<T, Q>({
93
+ ...args[1],
94
+ path: args[0],
95
+ method: "post",
96
+ baseUrl,
97
+ }),
98
+ put: <T, Q>(...args: MethodCallArgs<Q>) =>
99
+ fetchCall<T, Q>({
100
+ ...args[1],
101
+ path: args[0],
102
+ method: "put",
103
+ }),
104
+ patch: <T, Q>(...args: MethodCallArgs<Q>) =>
105
+ fetchCall<T, Q>({
106
+ ...args[1],
107
+ path: args[0],
108
+ method: "patch",
109
+ baseUrl,
110
+ }),
111
+ delete: <T, Q>(...args: MethodCallArgs<Q>) =>
112
+ fetchCall<T, Q>({
113
+ ...args[1],
114
+ path: args[0],
115
+ method: "delete",
116
+ baseUrl,
117
+ }),
80
118
  };
81
119
  }
@@ -1,9 +1,9 @@
1
- import { IsArray, IsNotEmpty, IsNumber, IsString } from "class-validator";
2
- import { I_CampaignGoal } from "./I_CampaignGoal";
3
- import { I_CampaignCollaborationMethod } from "./I_CampaignCollaborationMethod";
4
- import { I_Influencer } from "./I_Influencer";
5
- import { I_InfluencersList } from "./I_InfluencersLists";
6
- import { I_CampaignDeadline } from "./I_CampaignDeadline";
1
+ import { IsArray, IsNotEmpty, IsNumber, IsString } from 'class-validator';
2
+ import { I_CampaignGoal } from './I_CampaignGoal';
3
+ import { I_CampaignCollaborationMethod } from './I_CampaignCollaborationMethod';
4
+ import { I_Influencer } from './I_Influencer';
5
+ import { I_InfluencersList } from './I_InfluencersLists';
6
+ import { I_CampaignDeadline } from './I_CampaignDeadline';
7
7
 
8
8
  class I_Brief {
9
9
  brand: string;
@@ -37,8 +37,8 @@ export class I_Campaign {
37
37
  name: string;
38
38
  brief: I_Brief;
39
39
  influencersList: {
40
- id: I_InfluencersList["id"];
41
- name: I_InfluencersList["name"];
40
+ id: I_InfluencersList['id'];
41
+ name: I_InfluencersList['name'];
42
42
  influencers: I_Influencer[];
43
43
  };
44
44
  deadlines: I_CampaignDeadline[];
@@ -76,7 +76,7 @@ export class I_GetCampaignDTO {
76
76
  id: string;
77
77
 
78
78
  constructor(data: Partial<I_GetCampaignDTO>) {
79
- this.id = data?.id ?? "";
79
+ this.id = data?.id ?? '';
80
80
  }
81
81
  }
82
82
 
@@ -117,10 +117,10 @@ export class I_EditCampaignDTO {
117
117
  campaignTags: string;
118
118
 
119
119
  @IsArray()
120
- campaignGoals: I_CampaignGoal[];
120
+ campaignGoals: string[];
121
121
 
122
122
  @IsArray()
123
- campaignCollaborationMethods: I_CampaignCollaborationMethod[];
123
+ campaignCollaborationMethods: string[];
124
124
 
125
125
  @IsNotEmpty()
126
126
  @IsNumber()
@@ -1,5 +1,5 @@
1
- import { IsNotEmpty, IsOptional, IsString } from "class-validator";
2
- import { I_OfferStatus } from "./I_Offer";
1
+ import { IsNotEmpty, IsOptional, IsString } from 'class-validator';
2
+ import { I_OfferStatus } from './I_Offer';
3
3
 
4
4
  export class I_CampaignDeadline {
5
5
  id: string;
@@ -7,6 +7,7 @@ export class I_CampaignDeadline {
7
7
  date: Date;
8
8
  isConfirmed: boolean;
9
9
  isReadyToConfirm: boolean;
10
+ createdAt: Date;
10
11
 
11
12
  constructor(data?: Partial<I_CampaignDeadline>) {
12
13
  this.id = data?.id ?? null;
@@ -14,6 +15,7 @@ export class I_CampaignDeadline {
14
15
  this.date = data?.date ?? null;
15
16
  this.isConfirmed = data?.isConfirmed ?? null;
16
17
  this.isReadyToConfirm = data?.isReadyToConfirm ?? null;
18
+ this.createdAt = data?.createdAt ?? null;
17
19
  }
18
20
  }
19
21
 
@@ -57,7 +59,7 @@ export class I_EditCampaignDeadlinesDTO {
57
59
  this.campaignId = data?.campaignId ?? null;
58
60
 
59
61
  Object.entries(data || {}).forEach(([key, value]) => {
60
- if (key !== "startDate" && key !== "endDate") {
62
+ if (key !== 'startDate' && key !== 'endDate') {
61
63
  this[key] = value;
62
64
  }
63
65
  });
@@ -1,15 +1,20 @@
1
1
  import { I_Media } from './I_Media';
2
2
  import { I_Offer } from './I_Offer';
3
+ import { I_User } from './I_User';
3
4
 
4
5
  export class I_Collaboration {
5
6
  id: string;
6
7
  offer: I_Offer;
7
- media: [];
8
+ media: I_Media[];
9
+ comments: I_CollaborationComment[];
8
10
  }
9
11
 
10
- export declare class I_GetCampaignCollaborationsDTO {
11
- campaignId: string;
12
- constructor(data?: Partial<I_GetCampaignCollaborationsDTO>);
12
+ export class I_CollaborationComment {
13
+ id: string;
14
+ content: string;
15
+ collaboration: I_Collaboration;
16
+ author: I_User;
17
+ createdAt: Date;
13
18
  }
14
19
 
15
20
  export declare class I_GetCollaborationDTO {
@@ -22,6 +27,11 @@ export declare class I_GetCollaborationByOfferDTO {
22
27
  constructor(data?: Partial<I_GetCollaborationByOfferDTO>);
23
28
  }
24
29
 
30
+ export declare class I_GetCampaignCollaborationsDTO {
31
+ campaignId: string;
32
+ constructor(data?: Partial<I_GetCampaignCollaborationsDTO>);
33
+ }
34
+
25
35
  export declare class I_GetCollaborationsDTO {
26
36
  userId: string;
27
37
  constructor(data?: Partial<I_GetCollaborationsDTO>);
@@ -40,8 +50,30 @@ export class I_CreateCollaborationDTO {
40
50
  }
41
51
  }
42
52
 
43
- export class I_UploadFirstMediaVersionDTO {
53
+ export class I_UploadCollaborationMediaDTO {
44
54
  collaborationId: string;
45
55
  file: string;
46
56
  fileName: string;
47
57
  }
58
+
59
+ export class I_AddCollaborationCommentDTO {
60
+ collaborationId: string;
61
+ comment: string;
62
+ }
63
+
64
+ export class I_RequestCollaborationMediaAdjustmentDTO {
65
+ collaborationId: string;
66
+ comment: string;
67
+ }
68
+
69
+ export class I_AcceptCollaborationMediaDTO {
70
+ collaborationId: string;
71
+ }
72
+
73
+ export class I_RejectCollaborationMediaDTO {
74
+ collaborationId: string;
75
+ }
76
+
77
+ export class I_GetCollaborationCommentsDTO {
78
+ collaborationId: string;
79
+ }
@@ -1,5 +1,5 @@
1
- import { I_ResponseMessage } from './I_ResponseMessage';
2
- import { T_FetchStatus } from './T_FetchStatus';
1
+ import { I_ResponseMessage } from "./I_ResponseMessage";
2
+ import { T_FetchStatus } from "./T_FetchStatus";
3
3
 
4
4
  export class I_Item<T> implements I_ResponseMessage {
5
5
  data: T;
@@ -8,12 +8,27 @@ export class I_Item<T> implements I_ResponseMessage {
8
8
 
9
9
  constructor(data?: Partial<I_Item<T>>) {
10
10
  this.data = data?.data || null;
11
- this.status = data?.status || 'succeeded';
12
- this.message = data?.message || '';
11
+ this.status = data?.status || "succeeded";
12
+ this.message = data?.message || "";
13
+ }
14
+
15
+ succeed?(data: T, message?: string): this {
16
+ this.status = "succeeded";
17
+ this.data = data;
18
+ this.message = message;
19
+
20
+ return this;
21
+ }
22
+
23
+ fail?(message: string): this {
24
+ this.status = "failed";
25
+ this.message = message;
26
+
27
+ return this;
13
28
  }
14
29
  }
15
30
 
16
- export const itemIsLoading = (item: I_Item<any>) => item.status === 'loading';
31
+ export const itemIsLoading = (item: I_Item<any>) => item.status === "loading";
17
32
  export const itemIsResolving = (item: I_Item<any>) =>
18
- item.status === 'initial' || item.status === 'loading';
19
- export const itemFailed = (item: I_Item<any>) => item.status === 'failed';
33
+ item.status === "initial" || item.status === "loading";
34
+ export const itemFailed = (item: I_Item<any>) => item.status === "failed";
@@ -11,4 +11,19 @@ export class I_List<T> implements I_ResponseMessage {
11
11
  this.status = data?.status || 'succeeded';
12
12
  this.message = data?.message || '';
13
13
  }
14
+
15
+ succeed?(items: T[], message?: string): this {
16
+ this.status = 'succeeded';
17
+ this.items = items;
18
+ this.message = message;
19
+
20
+ return this;
21
+ }
22
+
23
+ fail?(message: string): this {
24
+ this.status = 'failed';
25
+ this.message = message;
26
+
27
+ return this;
28
+ }
14
29
  }
@@ -9,7 +9,8 @@ export class I_Media {
9
9
  id: string;
10
10
  url: string;
11
11
  fileName: string;
12
- type: I_MediaStage;
12
+ stage: I_MediaStage;
13
+ createdAt: Date;
13
14
  }
14
15
 
15
16
  export declare class I_GetCollaborationMediaDTO {
@@ -0,0 +1,14 @@
1
+ export type I_CrossPostContentDTO = {
2
+ file: File;
3
+ description: string;
4
+ refreshToken: string;
5
+ };
6
+
7
+ export type I_GetPublishStatusDTO = {
8
+ publishId: string;
9
+ refreshToken: string;
10
+ };
11
+
12
+ export type I_PublishStatus = {
13
+ status: string;
14
+ };
@@ -1,11 +1,11 @@
1
- import { T_FetchStatus } from './T_FetchStatus';
1
+ import { T_FetchStatus } from "./T_FetchStatus";
2
2
 
3
3
  export class I_ResponseMessage {
4
4
  status: T_FetchStatus;
5
5
  message?: string;
6
6
 
7
7
  constructor(data?: Partial<I_ResponseMessage>) {
8
- this.status = data?.status || 'initial';
9
- this.message = data?.message || '';
8
+ this.status = data?.status || "initial";
9
+ this.message = data?.message || "";
10
10
  }
11
11
  }
@@ -0,0 +1,52 @@
1
+ import {
2
+ IsNotEmpty,
3
+ IsOptional,
4
+ IsEnum,
5
+ IsISO8601,
6
+ IsString,
7
+ } from 'class-validator';
8
+
9
+ export enum SocialProvider {
10
+ TIKTOK = 'tiktok',
11
+ }
12
+
13
+ export class I_SocialSignInDTO {
14
+ // @IsNotEmpty()
15
+ // userId: string;
16
+
17
+ @IsEnum(SocialProvider)
18
+ provider: SocialProvider;
19
+
20
+ @IsNotEmpty()
21
+ @IsString()
22
+ provider_user_id: string;
23
+
24
+ @IsNotEmpty()
25
+ @IsString()
26
+ access_token: string;
27
+
28
+ @IsOptional()
29
+ @IsString()
30
+ refresh_token?: string;
31
+
32
+ @IsOptional()
33
+ @IsISO8601()
34
+ expires_at?: string;
35
+ }
36
+
37
+ export class I_TikTokUserPayload {
38
+ id: string;
39
+ role: string;
40
+ email?: string | null;
41
+ accessToken: string;
42
+ refreshToken: string;
43
+ influencer?: { handle_tt: string };
44
+
45
+ constructor(data: I_TikTokUserPayload) {
46
+ this.id = data.id;
47
+ this.role = data.role;
48
+ this.email = data.email; this.accessToken = data.accessToken;
49
+ this.refreshToken = data.refreshToken;
50
+ this.influencer = data.influencer;
51
+ }
52
+ };
@@ -1,10 +1,10 @@
1
- import { IsNotEmpty } from "class-validator";
2
- import { I_Influencer } from "./I_Influencer";
1
+ import { IsNotEmpty } from 'class-validator';
2
+ import { I_Influencer } from './I_Influencer';
3
3
 
4
4
  export class I_User {
5
5
  id: string;
6
- email: string;
7
- password: string;
6
+ email?: string;
7
+ password?: string;
8
8
  role: UserRoles;
9
9
  influencer?: I_Influencer;
10
10
  }
@@ -14,9 +14,9 @@ export class I_SignedUser extends I_User {
14
14
  }
15
15
 
16
16
  export enum UserRoles {
17
- ADMIN = "ADMIN",
18
- INFLUENCER = "INFLUENCER",
19
- AGENT = "AGENT",
17
+ ADMIN = 'ADMIN',
18
+ INFLUENCER = 'INFLUENCER',
19
+ AGENT = 'AGENT',
20
20
  }
21
21
 
22
22
  export class I_UserCreateDTO {
@@ -1,33 +1,35 @@
1
- export * from './I_TikTokUser';
2
- export * from './I_Queue';
3
- export * from './I_Campaign';
4
- export * from './I_Influencer';
5
- export * from './I_InfluencersLists';
6
- export * from './I_InfluencersCategories';
7
- export * from './I_InfluencersProperties';
8
- export * from './I_Item';
9
- export * from './I_List';
10
- export * from './I_PaginatedList';
11
- export * from './I_Pagination';
12
- export * from './I_TIkTokRaports';
13
- export * from './I_Tag';
14
- export * from './I_TikTokPost';
15
- export * from './I_User';
16
- export * from './I_UserTikTokStatistic';
17
- export * from './I_ScrappingAccount';
18
- export * from './global';
19
- export * from './I_Scrappers';
20
- export * from './I_ScrappingServiceMessages';
21
- export * from './I_ScrappingMachine';
22
- export * from './I_ScrappingMachineProcess';
23
- export * from './T_FetchStatus';
24
- export * from './I_ResponseMessage';
25
- export * from './I_ScrapperLog';
26
- export * from './I_CampaignGoal';
27
- export * from './I_CampaignCollaborationMethod';
28
- export * from './I_TikTokReport';
29
- export * from './I_Offer';
30
- export * from './I_CampaignDeadline';
31
- export * from './I_Agency';
32
- export * from './I_Media';
33
- export * from './I_Collaboration';
1
+ export * from "./I_TikTokUser";
2
+ export * from "./I_Queue";
3
+ export * from "./I_Campaign";
4
+ export * from "./I_Influencer";
5
+ export * from "./I_InfluencersLists";
6
+ export * from "./I_InfluencersCategories";
7
+ export * from "./I_InfluencersProperties";
8
+ export * from "./I_Item";
9
+ export * from "./I_List";
10
+ export * from "./I_PaginatedList";
11
+ export * from "./I_Pagination";
12
+ export * from "./I_TIkTokRaports";
13
+ export * from "./I_Tag";
14
+ export * from "./I_TikTokPost";
15
+ export * from "./I_User";
16
+ export * from "./I_UserTikTokStatistic";
17
+ export * from "./I_ScrappingAccount";
18
+ export * from "./global";
19
+ export * from "./I_Scrappers";
20
+ export * from "./I_ScrappingServiceMessages";
21
+ export * from "./I_ScrappingMachine";
22
+ export * from "./I_ScrappingMachineProcess";
23
+ export * from "./T_FetchStatus";
24
+ export * from "./I_ResponseMessage";
25
+ export * from "./I_ScrapperLog";
26
+ export * from "./I_CampaignGoal";
27
+ export * from "./I_CampaignCollaborationMethod";
28
+ export * from "./I_TikTokReport";
29
+ export * from "./I_Offer";
30
+ export * from "./I_CampaignDeadline";
31
+ export * from "./I_Agency";
32
+ export * from "./I_Media";
33
+ export * from "./I_SocialAccount";
34
+ export * from "./I_Collaboration";
35
+ export * from "./I_Publish";