ad2app-lib 1.0.2 → 1.0.4

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.
@@ -5,12 +5,31 @@ interface DriverConfig {
5
5
  getHeaders?: () => HeadersInit;
6
6
  }
7
7
  export declare function configureApiDriver(config: DriverConfig): void;
8
- export declare function fetchCall<T, Q>(path: string, fetchParams?: FetchParams<Q>, method?: HttpMethod): Promise<T>;
8
+ type FetchCallArgs<Q> = [
9
+ path: string,
10
+ params?: FetchParams<Q>,
11
+ method?: HttpMethod,
12
+ headers?: HeadersInit,
13
+ transformers?: {
14
+ body?: (body: any) => BodyInit;
15
+ }
16
+ ];
17
+ export declare function fetchCall<T, Q>(...args: FetchCallArgs<Q>): Promise<T>;
9
18
  export declare function apiDriver(): {
10
- get: <T, Q>(path: string, params?: FetchParams<Q>) => Promise<T>;
11
- post: <T, Q>(path: string, params?: FetchParams<Q>) => Promise<T>;
12
- put: <T, Q>(path: string, params?: FetchParams<Q>) => Promise<T>;
13
- patch: <T, Q>(path: string, params?: FetchParams<Q>) => Promise<T>;
14
- delete: <T, Q>(path: string, params?: FetchParams<Q>) => Promise<T>;
19
+ get: <T, Q>(path: string, params?: FetchParams<Q>, method?: HttpMethod, headers?: HeadersInit, transformers?: {
20
+ body?: (body: any) => BodyInit;
21
+ }) => Promise<T>;
22
+ post: <T, Q>(path: string, params?: FetchParams<Q>, method?: HttpMethod, headers?: HeadersInit, transformers?: {
23
+ body?: (body: any) => BodyInit;
24
+ }) => Promise<T>;
25
+ put: <T, Q>(path: string, params?: FetchParams<Q>, method?: HttpMethod, headers?: HeadersInit, transformers?: {
26
+ body?: (body: any) => BodyInit;
27
+ }) => Promise<T>;
28
+ patch: <T, Q>(path: string, params?: FetchParams<Q>, method?: HttpMethod, headers?: HeadersInit, transformers?: {
29
+ body?: (body: any) => BodyInit;
30
+ }) => Promise<T>;
31
+ delete: <T, Q>(path: string, params?: FetchParams<Q>, method?: HttpMethod, headers?: HeadersInit, transformers?: {
32
+ body?: (body: any) => BodyInit;
33
+ }) => Promise<T>;
15
34
  };
16
35
  export {};
@@ -8,8 +8,12 @@ let CONFIG;
8
8
  function configureApiDriver(config) {
9
9
  CONFIG = config;
10
10
  }
11
- async function fetchCall(path, fetchParams, method = 'get') {
12
- const headers = CONFIG.getHeaders?.() || {};
11
+ async function fetchCall(...args) {
12
+ let [path, fetchParams, method, headers, transformers] = args;
13
+ headers = {
14
+ ...CONFIG.getHeaders?.(),
15
+ ...headers,
16
+ };
13
17
  const query = {};
14
18
  Object.entries(fetchParams?.query || {}).forEach(([key, val]) => {
15
19
  query[key] = Array.isArray(val) ? JSON.stringify(val) : val;
@@ -21,7 +25,11 @@ async function fetchCall(path, fetchParams, method = 'get') {
21
25
  headers,
22
26
  };
23
27
  if (fetchParams?.body) {
28
+ // if (transformers?.body) {
29
+ // init.body = transformers.body(fetchParams.body);
30
+ // } else {
24
31
  init.body = JSON.stringify(fetchParams.body);
32
+ // }
25
33
  headers['Content-Type'] = 'application/json';
26
34
  }
27
35
  const res = await fetch(fullPath, init);
@@ -31,10 +39,10 @@ async function fetchCall(path, fetchParams, method = 'get') {
31
39
  }
32
40
  function apiDriver() {
33
41
  return {
34
- get: (path, params) => fetchCall(path, params, 'get'),
35
- post: (path, params) => fetchCall(path, params, 'post'),
36
- put: (path, params) => fetchCall(path, params, 'put'),
37
- patch: (path, params) => fetchCall(path, params, 'patch'),
38
- delete: (path, params) => fetchCall(path, params, 'delete'),
42
+ get: (...args) => fetchCall(args[0], args[1], 'get', args[3], args[4]),
43
+ post: (...args) => fetchCall(args[0], args[1], 'post', args[3], args[4]),
44
+ put: (...args) => fetchCall(args[0], args[1], 'put', args[3], args[4]),
45
+ patch: (...args) => fetchCall(args[0], args[1], 'patch', args[3], args[4]),
46
+ delete: (...args) => fetchCall(args[0], args[1], 'delete', args[3], args[4]),
39
47
  };
40
48
  }
@@ -1,5 +1,5 @@
1
- import { I_Offer } from "./I_Offer";
2
- import { I_User } from "./I_User";
1
+ import { I_Offer } from './I_Offer';
2
+ import { I_User } from './I_User';
3
3
  export declare class I_Agency {
4
4
  id: string;
5
5
  name: string;
@@ -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
  });
@@ -0,0 +1,62 @@
1
+ import { I_Media } from './I_Media';
2
+ import { I_Offer } from './I_Offer';
3
+ import { I_User } from './I_User';
4
+ export declare class I_Collaboration {
5
+ id: string;
6
+ offer: I_Offer;
7
+ media: I_Media[];
8
+ comments: I_CollaborationComment[];
9
+ }
10
+ export declare class I_CollaborationComment {
11
+ id: string;
12
+ content: string;
13
+ collaboration: I_Collaboration;
14
+ author: I_User;
15
+ createdAt: Date;
16
+ }
17
+ export declare class I_GetCollaborationDTO {
18
+ collaborationId: string;
19
+ constructor(data?: Partial<I_GetCollaborationDTO>);
20
+ }
21
+ export declare class I_GetCollaborationByOfferDTO {
22
+ offerId: string;
23
+ constructor(data?: Partial<I_GetCollaborationByOfferDTO>);
24
+ }
25
+ export declare class I_GetCampaignCollaborationsDTO {
26
+ campaignId: string;
27
+ constructor(data?: Partial<I_GetCampaignCollaborationsDTO>);
28
+ }
29
+ export declare class I_GetCollaborationsDTO {
30
+ userId: string;
31
+ constructor(data?: Partial<I_GetCollaborationsDTO>);
32
+ }
33
+ export declare class I_FindUserCollaborationsDTO {
34
+ userId: string;
35
+ constructor(data?: Partial<I_FindUserCollaborationsDTO>);
36
+ }
37
+ export declare class I_CreateCollaborationDTO {
38
+ offerId: string;
39
+ constructor(data?: Partial<I_CreateCollaborationDTO>);
40
+ }
41
+ export declare class I_UploadCollaborationMediaDTO {
42
+ collaborationId: string;
43
+ file: string;
44
+ fileName: string;
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
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
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
+ class I_Collaboration {
5
+ }
6
+ exports.I_Collaboration = I_Collaboration;
7
+ class I_CollaborationComment {
8
+ }
9
+ exports.I_CollaborationComment = I_CollaborationComment;
10
+ class I_CreateCollaborationDTO {
11
+ constructor(data) {
12
+ this.offerId = data?.offerId ?? null;
13
+ }
14
+ }
15
+ exports.I_CreateCollaborationDTO = I_CreateCollaborationDTO;
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 {
32
+ }
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;
@@ -1,6 +1,22 @@
1
- export declare enum I_MediaStatus {
1
+ export declare enum I_MediaStage {
2
2
  UPLOADED = "uploaded",
3
3
  ADJUSTMENT_REQUIRED = "adjustmentRequired",
4
4
  REJECTED = "rejected",
5
5
  ACCEPTED = "accepted"
6
6
  }
7
+ export declare class I_Media {
8
+ id: string;
9
+ url: string;
10
+ fileName: string;
11
+ stage: I_MediaStage;
12
+ createdAt: Date;
13
+ }
14
+ export declare class I_GetCollaborationMediaDTO {
15
+ collaborationId: string;
16
+ }
17
+ export declare class I_CreateMediaDTO {
18
+ collaborationId: string;
19
+ fileName: string;
20
+ type: I_MediaStage;
21
+ file: string;
22
+ }
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.I_MediaStatus = void 0;
4
- var I_MediaStatus;
5
- (function (I_MediaStatus) {
6
- I_MediaStatus["UPLOADED"] = "uploaded";
7
- I_MediaStatus["ADJUSTMENT_REQUIRED"] = "adjustmentRequired";
8
- I_MediaStatus["REJECTED"] = "rejected";
9
- I_MediaStatus["ACCEPTED"] = "accepted";
10
- })(I_MediaStatus || (exports.I_MediaStatus = I_MediaStatus = {}));
3
+ exports.I_Media = exports.I_MediaStage = void 0;
4
+ var I_MediaStage;
5
+ (function (I_MediaStage) {
6
+ I_MediaStage["UPLOADED"] = "uploaded";
7
+ I_MediaStage["ADJUSTMENT_REQUIRED"] = "adjustmentRequired";
8
+ I_MediaStage["REJECTED"] = "rejected";
9
+ I_MediaStage["ACCEPTED"] = "accepted";
10
+ })(I_MediaStage || (exports.I_MediaStage = I_MediaStage = {}));
11
+ class I_Media {
12
+ }
13
+ exports.I_Media = I_Media;
@@ -8,6 +8,7 @@ export declare class I_Offer {
8
8
  price?: number;
9
9
  status?: I_OfferStatus;
10
10
  action?: OfferActions;
11
+ campaign: I_Campaign;
11
12
  constructor(data?: I_Offer);
12
13
  }
13
14
  export type OfferActions = 'create' | 'delete' | 'confirm' | 'reject' | 'negotiate' | 'accept';
@@ -19,6 +19,7 @@ class I_Offer {
19
19
  this.price = data?.price ?? null;
20
20
  this.status = data?.status ?? null;
21
21
  this.action = data?.action ?? null;
22
+ this.campaign = data?.campaign ?? null;
22
23
  }
23
24
  }
24
25
  exports.I_Offer = I_Offer;
@@ -30,3 +30,4 @@ 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_Collaboration';
@@ -46,3 +46,4 @@ __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_Collaboration"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ad2app-lib",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "commonjs",
@@ -14,12 +14,23 @@ export function configureApiDriver(config: DriverConfig) {
14
14
  CONFIG = config;
15
15
  }
16
16
 
17
- export async function fetchCall<T, Q>(
17
+ type FetchCallArgs<Q> = [
18
18
  path: string,
19
- fetchParams?: FetchParams<Q>,
20
- method: HttpMethod = 'get'
21
- ): Promise<T> {
22
- const headers: HeadersInit = CONFIG.getHeaders?.() || {};
19
+ params?: FetchParams<Q>,
20
+ method?: HttpMethod,
21
+ headers?: HeadersInit,
22
+ transformers?: {
23
+ body?: (body: any) => BodyInit;
24
+ }
25
+ ];
26
+
27
+ export async function fetchCall<T, Q>(...args: FetchCallArgs<Q>): Promise<T> {
28
+ let [path, fetchParams, method, headers, transformers] = args;
29
+
30
+ headers = {
31
+ ...CONFIG.getHeaders?.(),
32
+ ...headers,
33
+ };
23
34
 
24
35
  const query: Q = {} as Q;
25
36
  Object.entries(fetchParams?.query || {}).forEach(([key, val]) => {
@@ -38,7 +49,12 @@ export async function fetchCall<T, Q>(
38
49
  };
39
50
 
40
51
  if (fetchParams?.body) {
52
+ // if (transformers?.body) {
53
+ // init.body = transformers.body(fetchParams.body);
54
+ // } else {
41
55
  init.body = JSON.stringify(fetchParams.body);
56
+ // }
57
+
42
58
  headers['Content-Type'] = 'application/json';
43
59
  }
44
60
 
@@ -51,15 +67,15 @@ export async function fetchCall<T, Q>(
51
67
 
52
68
  export function apiDriver() {
53
69
  return {
54
- get: <T, Q>(path: string, params?: FetchParams<Q>) =>
55
- fetchCall<T, Q>(path, params, 'get'),
56
- post: <T, Q>(path: string, params?: FetchParams<Q>) =>
57
- fetchCall<T, Q>(path, params, 'post'),
58
- put: <T, Q>(path: string, params?: FetchParams<Q>) =>
59
- fetchCall<T, Q>(path, params, 'put'),
60
- patch: <T, Q>(path: string, params?: FetchParams<Q>) =>
61
- fetchCall<T, Q>(path, params, 'patch'),
62
- delete: <T, Q>(path: string, params?: FetchParams<Q>) =>
63
- fetchCall<T, Q>(path, params, 'delete'),
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]),
64
80
  };
65
81
  }
@@ -1,5 +1,5 @@
1
- import { I_Offer } from "./I_Offer";
2
- import { I_User } from "./I_User";
1
+ import { I_Offer } from './I_Offer';
2
+ import { I_User } from './I_User';
3
3
 
4
4
  export class I_Agency {
5
5
  id: string;
@@ -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
  });
@@ -0,0 +1,79 @@
1
+ import { I_Media } from './I_Media';
2
+ import { I_Offer } from './I_Offer';
3
+ import { I_User } from './I_User';
4
+
5
+ export class I_Collaboration {
6
+ id: string;
7
+ offer: I_Offer;
8
+ media: I_Media[];
9
+ comments: I_CollaborationComment[];
10
+ }
11
+
12
+ export class I_CollaborationComment {
13
+ id: string;
14
+ content: string;
15
+ collaboration: I_Collaboration;
16
+ author: I_User;
17
+ createdAt: Date;
18
+ }
19
+
20
+ export declare class I_GetCollaborationDTO {
21
+ collaborationId: string;
22
+ constructor(data?: Partial<I_GetCollaborationDTO>);
23
+ }
24
+
25
+ export declare class I_GetCollaborationByOfferDTO {
26
+ offerId: string;
27
+ constructor(data?: Partial<I_GetCollaborationByOfferDTO>);
28
+ }
29
+
30
+ export declare class I_GetCampaignCollaborationsDTO {
31
+ campaignId: string;
32
+ constructor(data?: Partial<I_GetCampaignCollaborationsDTO>);
33
+ }
34
+
35
+ export declare class I_GetCollaborationsDTO {
36
+ userId: string;
37
+ constructor(data?: Partial<I_GetCollaborationsDTO>);
38
+ }
39
+
40
+ export declare class I_FindUserCollaborationsDTO {
41
+ userId: string;
42
+ constructor(data?: Partial<I_FindUserCollaborationsDTO>);
43
+ }
44
+
45
+ export class I_CreateCollaborationDTO {
46
+ offerId: string;
47
+
48
+ constructor(data?: Partial<I_CreateCollaborationDTO>) {
49
+ this.offerId = data?.offerId ?? null;
50
+ }
51
+ }
52
+
53
+ export class I_UploadCollaborationMediaDTO {
54
+ collaborationId: string;
55
+ file: string;
56
+ fileName: string;
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
+ }
@@ -11,6 +11,21 @@ export class I_Item<T> implements I_ResponseMessage {
11
11
  this.status = data?.status || 'succeeded';
12
12
  this.message = data?.message || '';
13
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;
28
+ }
14
29
  }
15
30
 
16
31
  export const itemIsLoading = (item: I_Item<any>) => item.status === 'loading';
@@ -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
  }
@@ -1,6 +1,25 @@
1
- export enum I_MediaStatus {
1
+ export enum I_MediaStage {
2
2
  UPLOADED = 'uploaded',
3
3
  ADJUSTMENT_REQUIRED = 'adjustmentRequired',
4
4
  REJECTED = 'rejected',
5
5
  ACCEPTED = 'accepted',
6
6
  }
7
+
8
+ export class I_Media {
9
+ id: string;
10
+ url: string;
11
+ fileName: string;
12
+ stage: I_MediaStage;
13
+ createdAt: Date;
14
+ }
15
+
16
+ export declare class I_GetCollaborationMediaDTO {
17
+ collaborationId: string;
18
+ }
19
+
20
+ export declare class I_CreateMediaDTO {
21
+ collaborationId: string;
22
+ fileName: string;
23
+ type: I_MediaStage;
24
+ file: string;
25
+ }
@@ -10,6 +10,7 @@ export class I_Offer {
10
10
  price?: number;
11
11
  status?: I_OfferStatus;
12
12
  action?: OfferActions;
13
+ campaign: I_Campaign;
13
14
 
14
15
  constructor(data?: I_Offer) {
15
16
  this.agency = data?.agency ?? null;
@@ -18,6 +19,7 @@ export class I_Offer {
18
19
  this.price = data?.price ?? null;
19
20
  this.status = data?.status ?? null;
20
21
  this.action = data?.action ?? null;
22
+ this.campaign = data?.campaign ?? null;
21
23
  }
22
24
  }
23
25
 
@@ -30,3 +30,4 @@ 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_Collaboration';