@glissandoo/lib 1.82.0 → 1.84.0

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.
@@ -44,4 +44,10 @@ export declare namespace EventoPlayerFbFunctionsTypes {
44
44
  interested: true | null;
45
45
  }
46
46
  type SwitchInterestResult = void;
47
+ interface EditPlayerInterestParams {
48
+ eventId: string;
49
+ playerId: string;
50
+ interested: true | null;
51
+ }
52
+ type EditPlayerInterestResult = void;
47
53
  }
@@ -35,6 +35,7 @@ export declare enum FbFunctionName {
35
35
  EventPlayerEditPlayerAttendance = "eventPlayer-editPlayerAttendance",
36
36
  EventPlayerSetReasonAttendance = "eventPlayer-setReasonAttendance",
37
37
  EventPlayerSwitchInterest = "eventPlayer-switchInterest",
38
+ EventPlayerEditPlayerInterest = "eventPlayer-editPlayerInterest",
38
39
  EventPlayerValidateRollCall = "eventPlayer-validateRollCall",
39
40
  EventPublish = "event-publish",
40
41
  EventRemove = "event-remove",
@@ -119,7 +120,17 @@ export declare enum FbFunctionName {
119
120
  UserOnUpdate = "user-onUpdate",
120
121
  UserRegister = "user-register",
121
122
  UserRemove = "user-remove",
123
+ UserJoinEvent = "user-joinEvent",
122
124
  UserSendYearWrapped = "user-sendYearWrapped",
125
+ OfferPublish = "offer-publish",
126
+ OfferEdit = "offer-edit",
127
+ OfferEditSelection = "offer-editSelection",
128
+ OfferOnUpdate = "offer-onUpdate",
129
+ OfferCloseSelection = "offer-closeSelection",
130
+ OfferRemove = "offer-remove",
131
+ OfferApplicantAdd = "offerApplicant-add",
132
+ OfferApplicantEdit = "offerApplicant-edit",
133
+ OfferApplicantRemove = "offerApplicant-remove",
123
134
  WebhookStripe = "webhook-stripe",
124
135
  WebhookGocardless = "webhook-gocardless",
125
136
  WebhookMessagebird = "webhook-messagebird",
@@ -39,6 +39,7 @@ var FbFunctionName;
39
39
  FbFunctionName["EventPlayerEditPlayerAttendance"] = "eventPlayer-editPlayerAttendance";
40
40
  FbFunctionName["EventPlayerSetReasonAttendance"] = "eventPlayer-setReasonAttendance";
41
41
  FbFunctionName["EventPlayerSwitchInterest"] = "eventPlayer-switchInterest";
42
+ FbFunctionName["EventPlayerEditPlayerInterest"] = "eventPlayer-editPlayerInterest";
42
43
  FbFunctionName["EventPlayerValidateRollCall"] = "eventPlayer-validateRollCall";
43
44
  FbFunctionName["EventPublish"] = "event-publish";
44
45
  FbFunctionName["EventRemove"] = "event-remove";
@@ -123,7 +124,17 @@ var FbFunctionName;
123
124
  FbFunctionName["UserOnUpdate"] = "user-onUpdate";
124
125
  FbFunctionName["UserRegister"] = "user-register";
125
126
  FbFunctionName["UserRemove"] = "user-remove";
127
+ FbFunctionName["UserJoinEvent"] = "user-joinEvent";
126
128
  FbFunctionName["UserSendYearWrapped"] = "user-sendYearWrapped";
129
+ FbFunctionName["OfferPublish"] = "offer-publish";
130
+ FbFunctionName["OfferEdit"] = "offer-edit";
131
+ FbFunctionName["OfferEditSelection"] = "offer-editSelection";
132
+ FbFunctionName["OfferOnUpdate"] = "offer-onUpdate";
133
+ FbFunctionName["OfferCloseSelection"] = "offer-closeSelection";
134
+ FbFunctionName["OfferRemove"] = "offer-remove";
135
+ FbFunctionName["OfferApplicantAdd"] = "offerApplicant-add";
136
+ FbFunctionName["OfferApplicantEdit"] = "offerApplicant-edit";
137
+ FbFunctionName["OfferApplicantRemove"] = "offerApplicant-remove";
127
138
  FbFunctionName["WebhookStripe"] = "webhook-stripe";
128
139
  FbFunctionName["WebhookGocardless"] = "webhook-gocardless";
129
140
  FbFunctionName["WebhookMessagebird"] = "webhook-messagebird";
@@ -0,0 +1,27 @@
1
+ import { InstrumentId } from '../helpers/instruments';
2
+ import { OfferType } from '../models/Offer/types';
3
+ export declare namespace OfferFbFunctionsTypes {
4
+ interface PublishParams {
5
+ offerId: string;
6
+ title: string;
7
+ description: string;
8
+ instrument: InstrumentId;
9
+ type: OfferType;
10
+ group: string;
11
+ event: string | null;
12
+ deadlineAt: number | null;
13
+ }
14
+ type PublishResult = void;
15
+ type EditParams = Pick<PublishParams, 'offerId' | 'title' | 'description' | 'deadlineAt'>;
16
+ type EditResult = void;
17
+ interface EditSelectionParams {
18
+ offerId: string;
19
+ selectedApplicantsIds: string[];
20
+ discardedApplicantsIds: string[];
21
+ }
22
+ type EditSelectionResult = void;
23
+ type CloseSelectionParams = Pick<PublishParams, 'offerId'>;
24
+ type CloseSelectionResult = void;
25
+ type RemoveParams = Pick<PublishParams, 'offerId'>;
26
+ type RemoveResult = void;
27
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ export declare namespace OfferApplicantFbFunctionsTypes {
2
+ interface AddParams {
3
+ offerId: string;
4
+ userId: string;
5
+ message: string | null;
6
+ }
7
+ type AddResult = void;
8
+ type EditParams = AddParams;
9
+ type EditResult = void;
10
+ type RemoveParams = Pick<AddParams, 'offerId' | 'userId'>;
11
+ type RemoveResult = void;
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -14,6 +14,7 @@ const regionByFunctions = {
14
14
  [index_1.FbFunctionName.UserOnCreateDoc]: GCloudRegions.UsCentral1,
15
15
  [index_1.FbFunctionName.UserOnUpdate]: GCloudRegions.UsCentral1,
16
16
  [index_1.FbFunctionName.UserRemove]: GCloudRegions.EuropeWest6,
17
+ [index_1.FbFunctionName.UserJoinEvent]: GCloudRegions.EuropeWest6,
17
18
  [index_1.FbFunctionName.UserOnLogin]: GCloudRegions.EuropeWest6,
18
19
  [index_1.FbFunctionName.UserOnSignUp]: GCloudRegions.EuropeWest6,
19
20
  [index_1.FbFunctionName.UserSendYearWrapped]: GCloudRegions.EuropeWest6,
@@ -87,6 +88,7 @@ const regionByFunctions = {
87
88
  [index_1.FbFunctionName.EventPlayerSetReasonAttendance]: GCloudRegions.EuropeWest6,
88
89
  [index_1.FbFunctionName.EventPlayerValidateRollCall]: GCloudRegions.EuropeWest6,
89
90
  [index_1.FbFunctionName.EventPlayerSwitchInterest]: GCloudRegions.EuropeWest6,
91
+ [index_1.FbFunctionName.EventPlayerEditPlayerInterest]: GCloudRegions.EuropeWest6,
90
92
  [index_1.FbFunctionName.EventPlayerEdit]: GCloudRegions.UsCentral1,
91
93
  [index_1.FbFunctionName.EventRepertoryEdit]: GCloudRegions.UsCentral1,
92
94
  [index_1.FbFunctionName.EventRepertoryDownloadPdf]: GCloudRegions.EuropeWest6,
@@ -119,6 +121,15 @@ const regionByFunctions = {
119
121
  [index_1.FbFunctionName.PartnershipRemoveAdmin]: GCloudRegions.EuropeWest6,
120
122
  [index_1.FbFunctionName.PartnershipGroupAdd]: GCloudRegions.EuropeWest6,
121
123
  [index_1.FbFunctionName.PartnershipGroupRemove]: GCloudRegions.EuropeWest6,
124
+ [index_1.FbFunctionName.OfferPublish]: GCloudRegions.EuropeWest6,
125
+ [index_1.FbFunctionName.OfferEdit]: GCloudRegions.EuropeWest6,
126
+ [index_1.FbFunctionName.OfferEditSelection]: GCloudRegions.EuropeWest6,
127
+ [index_1.FbFunctionName.OfferOnUpdate]: GCloudRegions.EuropeWest6,
128
+ [index_1.FbFunctionName.OfferCloseSelection]: GCloudRegions.EuropeWest6,
129
+ [index_1.FbFunctionName.OfferRemove]: GCloudRegions.EuropeWest6,
130
+ [index_1.FbFunctionName.OfferApplicantAdd]: GCloudRegions.EuropeWest6,
131
+ [index_1.FbFunctionName.OfferApplicantEdit]: GCloudRegions.EuropeWest6,
132
+ [index_1.FbFunctionName.OfferApplicantRemove]: GCloudRegions.EuropeWest6,
122
133
  [index_1.FbFunctionName.MiscAddSubscriber]: GCloudRegions.EuropeWest6,
123
134
  [index_1.FbFunctionName.MiscHandleActiveCampaignAutomationContacts]: GCloudRegions.EuropeWest6,
124
135
  [index_1.FbFunctionName.Auth]: GCloudRegions.UsCentral1,
@@ -14,4 +14,9 @@ export declare namespace UserFbFunctionsTypes {
14
14
  userId: string;
15
15
  }
16
16
  type RemoveResult = void;
17
+ interface JoinEventParams {
18
+ eventId: string;
19
+ instrument?: string;
20
+ }
21
+ type JoinEventResult = void;
17
22
  }
@@ -30,5 +30,6 @@ export declare enum CollectionNames {
30
30
  Payment = "payment",
31
31
  Federation = "federation",
32
32
  FederationPartnerships = "partnerships",
33
+ Offer = "offer",
33
34
  WebhookEvent = "webhookEvent"
34
35
  }
@@ -34,5 +34,6 @@ var CollectionNames;
34
34
  CollectionNames["Payment"] = "payment";
35
35
  CollectionNames["Federation"] = "federation";
36
36
  CollectionNames["FederationPartnerships"] = "partnerships";
37
+ CollectionNames["Offer"] = "offer";
37
38
  CollectionNames["WebhookEvent"] = "webhookEvent";
38
39
  })(CollectionNames = exports.CollectionNames || (exports.CollectionNames = {}));
@@ -21,6 +21,7 @@ export declare enum HttpsErrorMessages {
21
21
  InvalidSuperAdmin = "error.superadmin.noValid",
22
22
  InvalidData = "error.data.noValid",
23
23
  InvalidCommunication = "error.communication.noValid",
24
+ InvalidOffer = "error.offer.noValid",
24
25
  InvalidPartner = "error.partner.noValid",
25
26
  InvalidPartnership = "error.partnership.noValid",
26
27
  InvalidPartnershipPlan = "error.partnershipPlan.noValid",
package/helpers/errors.js CHANGED
@@ -22,6 +22,7 @@ var HttpsErrorMessages;
22
22
  HttpsErrorMessages["InvalidSuperAdmin"] = "error.superadmin.noValid";
23
23
  HttpsErrorMessages["InvalidData"] = "error.data.noValid";
24
24
  HttpsErrorMessages["InvalidCommunication"] = "error.communication.noValid";
25
+ HttpsErrorMessages["InvalidOffer"] = "error.offer.noValid";
25
26
  HttpsErrorMessages["InvalidPartner"] = "error.partner.noValid";
26
27
  HttpsErrorMessages["InvalidPartnership"] = "error.partnership.noValid";
27
28
  HttpsErrorMessages["InvalidPartnershipPlan"] = "error.partnershipPlan.noValid";
@@ -25,6 +25,8 @@ export declare enum NotificationEventActions {
25
25
  DeclineAssistanceByAdmin = "declineAssistanceByAdmin",
26
26
  ConfirmInterest = "confirmInterest",
27
27
  LoseInterest = "loseInterest",
28
+ ConfirmInterestByAdmin = "confirmInterestByAdmin",
29
+ LoseInterestByAdmin = "loseInterestByAdmin",
28
30
  SelectionSelected = "selectionSelected",
29
31
  SelectionDeselected = "selectionDeselected",
30
32
  Reminder = "reminder",
@@ -43,6 +43,8 @@ var NotificationEventActions;
43
43
  NotificationEventActions["DeclineAssistanceByAdmin"] = "declineAssistanceByAdmin";
44
44
  NotificationEventActions["ConfirmInterest"] = "confirmInterest";
45
45
  NotificationEventActions["LoseInterest"] = "loseInterest";
46
+ NotificationEventActions["ConfirmInterestByAdmin"] = "confirmInterestByAdmin";
47
+ NotificationEventActions["LoseInterestByAdmin"] = "loseInterestByAdmin";
46
48
  NotificationEventActions["SelectionSelected"] = "selectionSelected";
47
49
  NotificationEventActions["SelectionDeselected"] = "selectionDeselected";
48
50
  NotificationEventActions["Reminder"] = "reminder";
@@ -78,6 +80,8 @@ exports.notificationPerformance = {
78
80
  [NotificationEventActions.DeclineAssistanceByAdmin]: types_1.NotificationActions.PerformanceAssistanceDeclineByAdmin,
79
81
  [NotificationEventActions.ConfirmInterest]: types_1.NotificationActions.PerformanceInterestConfirm,
80
82
  [NotificationEventActions.LoseInterest]: types_1.NotificationActions.PerformanceInterestLose,
83
+ [NotificationEventActions.ConfirmInterestByAdmin]: types_1.NotificationActions.PerformanceInterestConfirmByAdmin,
84
+ [NotificationEventActions.LoseInterestByAdmin]: types_1.NotificationActions.PerformanceInterestLoseByAdmin,
81
85
  [NotificationEventActions.SelectionSelected]: types_1.NotificationActions.PerformanceSelectionSelect,
82
86
  [NotificationEventActions.SelectionDeselected]: types_1.NotificationActions.PerformanceSelectionDeselect,
83
87
  [NotificationEventActions.Reminder]: types_1.NotificationActions.PerformanceReminder,
@@ -106,6 +110,8 @@ exports.notificationSinglePractice = {
106
110
  [NotificationEventActions.DeclineAssistanceByAdmin]: types_1.NotificationActions.PracticeAssistanceDeclineByAdmin,
107
111
  [NotificationEventActions.ConfirmInterest]: types_1.NotificationActions.PracticeInterestConfirm,
108
112
  [NotificationEventActions.LoseInterest]: types_1.NotificationActions.PracticeInterestLose,
113
+ [NotificationEventActions.ConfirmInterestByAdmin]: types_1.NotificationActions.PracticeInterestConfirmByAdmin,
114
+ [NotificationEventActions.LoseInterestByAdmin]: types_1.NotificationActions.PracticeInterestLoseByAdmin,
109
115
  [NotificationEventActions.SelectionSelected]: types_1.NotificationActions.PracticeSelectionSelect,
110
116
  [NotificationEventActions.SelectionDeselected]: types_1.NotificationActions.PracticeSelectionDeselect,
111
117
  [NotificationEventActions.Reminder]: types_1.NotificationActions.PracticeReminder,
@@ -134,6 +140,8 @@ exports.notificationMultiplePractice = {
134
140
  [NotificationEventActions.DeclineAssistanceByAdmin]: types_1.NotificationActions.PracticeAssistanceDeclineByAdmin,
135
141
  [NotificationEventActions.ConfirmInterest]: types_1.NotificationActions.PracticeInterestConfirm,
136
142
  [NotificationEventActions.LoseInterest]: types_1.NotificationActions.PracticeInterestLose,
143
+ [NotificationEventActions.ConfirmInterestByAdmin]: types_1.NotificationActions.PracticeInterestConfirmByAdmin,
144
+ [NotificationEventActions.LoseInterestByAdmin]: types_1.NotificationActions.PracticeInterestLoseByAdmin,
137
145
  [NotificationEventActions.SelectionSelected]: types_1.NotificationActions.PracticeSelectionSelect,
138
146
  [NotificationEventActions.SelectionDeselected]: types_1.NotificationActions.PracticeSelectionDeselect,
139
147
  [NotificationEventActions.Reminder]: types_1.NotificationActions.PracticeReminder,
@@ -9,6 +9,8 @@ export default class EventoPlayerBasic {
9
9
  get displayName(): string;
10
10
  get photoURL(): string;
11
11
  get mainInstrument(): import("../../../helpers/instruments").InstrumentId;
12
+ get isGuest(): boolean;
13
+ get isGroupPlayer(): boolean;
12
14
  get status(): EventPlayerStatus | null;
13
15
  get reason(): import("./types").EventPlayerReason | null;
14
16
  get note(): string | null;
@@ -22,6 +22,12 @@ class EventoPlayerBasic {
22
22
  get mainInstrument() {
23
23
  return this.data.mainInstrument;
24
24
  }
25
+ get isGuest() {
26
+ return this.data.isGuest || false;
27
+ }
28
+ get isGroupPlayer() {
29
+ return !this.isGuest;
30
+ }
25
31
  get status() {
26
32
  return this.data.status || null;
27
33
  }
@@ -7,6 +7,8 @@ export default class EventoPlayer extends PlayerBasic<EventPlayerData> {
7
7
  get joinedAt(): FirebaseFirestore.Timestamp;
8
8
  get eventId(): string;
9
9
  get status(): EventPlayerStatus | null;
10
+ get isGuest(): boolean;
11
+ get isGroupPlayer(): boolean;
10
12
  get isConfirmed(): boolean;
11
13
  get isDeclined(): boolean;
12
14
  get isPending(): boolean;
@@ -21,6 +21,12 @@ class EventoPlayer extends basic_1.default {
21
21
  get status() {
22
22
  return this.data.status;
23
23
  }
24
+ get isGuest() {
25
+ return this.data.isGuest || false;
26
+ }
27
+ get isGroupPlayer() {
28
+ return !this.isGuest;
29
+ }
24
30
  get isConfirmed() {
25
31
  return this.status === types_1.EventPlayerStatus.Confirmed;
26
32
  }
@@ -56,6 +56,7 @@ export interface EventRollcallHistory {
56
56
  changedBy: string;
57
57
  }
58
58
  export interface EventPlayerBasicData extends PlayerBasicData {
59
+ isGuest: boolean;
59
60
  note?: string | null;
60
61
  reason?: EventPlayerReason | null;
61
62
  status: EventPlayerStatus | null;
@@ -28,6 +28,8 @@ export declare enum NotificationActions {
28
28
  PerformanceAssistanceDeclineByAdmin = "performance.assistance.decline.byAdmin",
29
29
  PerformanceInterestConfirm = "performance.interest.confirm",
30
30
  PerformanceInterestLose = "performance.interest.lose",
31
+ PerformanceInterestConfirmByAdmin = "performance.interest.confirm.byAdmin",
32
+ PerformanceInterestLoseByAdmin = "performance.interest.lose.byAdmin",
31
33
  PerformanceSelectionSelect = "performance.selection.select",
32
34
  PerformanceSelectionDeselect = "performance.selection.deselect",
33
35
  PerformanceCancel = "performance.cancel",
@@ -54,6 +56,8 @@ export declare enum NotificationActions {
54
56
  PracticeAssistanceDeclineByAdmin = "practice.assistance.decline.byAdmin",
55
57
  PracticeInterestConfirm = "practice.interest.confirm",
56
58
  PracticeInterestLose = "practice.interest.lose",
59
+ PracticeInterestConfirmByAdmin = "practice.interest.confirm.byAdmin",
60
+ PracticeInterestLoseByAdmin = "practice.interest.lose.byAdmin",
57
61
  PracticeSelectionSelect = "practice.selection.select",
58
62
  PracticeSelectionDeselect = "practice.selection.deselect",
59
63
  PracticeCancel = "practice.cancel",
@@ -25,6 +25,8 @@ var NotificationActions;
25
25
  NotificationActions["PerformanceAssistanceDeclineByAdmin"] = "performance.assistance.decline.byAdmin";
26
26
  NotificationActions["PerformanceInterestConfirm"] = "performance.interest.confirm";
27
27
  NotificationActions["PerformanceInterestLose"] = "performance.interest.lose";
28
+ NotificationActions["PerformanceInterestConfirmByAdmin"] = "performance.interest.confirm.byAdmin";
29
+ NotificationActions["PerformanceInterestLoseByAdmin"] = "performance.interest.lose.byAdmin";
28
30
  NotificationActions["PerformanceSelectionSelect"] = "performance.selection.select";
29
31
  NotificationActions["PerformanceSelectionDeselect"] = "performance.selection.deselect";
30
32
  NotificationActions["PerformanceCancel"] = "performance.cancel";
@@ -51,6 +53,8 @@ var NotificationActions;
51
53
  NotificationActions["PracticeAssistanceDeclineByAdmin"] = "practice.assistance.decline.byAdmin";
52
54
  NotificationActions["PracticeInterestConfirm"] = "practice.interest.confirm";
53
55
  NotificationActions["PracticeInterestLose"] = "practice.interest.lose";
56
+ NotificationActions["PracticeInterestConfirmByAdmin"] = "practice.interest.confirm.byAdmin";
57
+ NotificationActions["PracticeInterestLoseByAdmin"] = "practice.interest.lose.byAdmin";
54
58
  NotificationActions["PracticeSelectionSelect"] = "practice.selection.select";
55
59
  NotificationActions["PracticeSelectionDeselect"] = "practice.selection.deselect";
56
60
  NotificationActions["PracticeCancel"] = "practice.cancel";
@@ -0,0 +1,16 @@
1
+ import { AOfferApplicantBasicData } from './types';
2
+ export default class OfferApplicantBasic {
3
+ offerId: string;
4
+ protected data: AOfferApplicantBasicData;
5
+ constructor(offerId: string, data: AOfferApplicantBasicData);
6
+ get id(): string;
7
+ get username(): string;
8
+ get displayName(): string;
9
+ get photoURL(): string;
10
+ get appliedAt(): FirebaseFirestore.Timestamp;
11
+ get selectedAt(): FirebaseFirestore.Timestamp | null;
12
+ get isSelected(): boolean;
13
+ get discardedAt(): FirebaseFirestore.Timestamp | null;
14
+ get isDiscarded(): boolean;
15
+ get message(): string | null;
16
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class OfferApplicantBasic {
4
+ constructor(offerId, data) {
5
+ this.offerId = offerId;
6
+ this.data = data;
7
+ }
8
+ get id() {
9
+ return this.data.id;
10
+ }
11
+ get username() {
12
+ return this.data.username;
13
+ }
14
+ get displayName() {
15
+ return this.data.displayName;
16
+ }
17
+ get photoURL() {
18
+ return this.data.photoURL;
19
+ }
20
+ get appliedAt() {
21
+ return this.data.appliedAt;
22
+ }
23
+ get selectedAt() {
24
+ return this.data.selectedAt || null;
25
+ }
26
+ get isSelected() {
27
+ return !!this.selectedAt;
28
+ }
29
+ get discardedAt() {
30
+ return this.data.discardedAt || null;
31
+ }
32
+ get isDiscarded() {
33
+ return !!this.discardedAt;
34
+ }
35
+ get message() {
36
+ return this.data.message || null;
37
+ }
38
+ }
39
+ exports.default = OfferApplicantBasic;
@@ -0,0 +1,11 @@
1
+ import { Timestamp } from '@google-cloud/firestore';
2
+ import { UserBasicData } from '../../User/types';
3
+ export interface OfferApplicantBasicData extends UserBasicData {
4
+ appliedAt: Timestamp;
5
+ selectedAt: Timestamp | null;
6
+ discardedAt: Timestamp | null;
7
+ message: string | null;
8
+ }
9
+ export interface AOfferApplicantBasicData extends OfferApplicantBasicData {
10
+ id: string;
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,30 @@
1
+ import { LanguagesTypes } from '../../lang';
2
+ import { DocumentModel } from '../Model';
3
+ import ModelWithLang from '../Model/lang';
4
+ import OfferApplicantBasic from './Applicant/basic';
5
+ import { OfferData, OfferType } from './types';
6
+ export default class Offer extends ModelWithLang<OfferData> {
7
+ constructor(doc: DocumentModel, lang?: LanguagesTypes);
8
+ get createdAt(): FirebaseFirestore.Timestamp;
9
+ get createdBy(): string;
10
+ get title(): string;
11
+ get instrument(): import("../../helpers/instruments").InstrumentId;
12
+ get description(): string;
13
+ get type(): OfferType;
14
+ get group(): string;
15
+ get event(): string | null;
16
+ get applicantsIds(): string[];
17
+ get applicants(): Record<string, import("./Applicant/types").OfferApplicantBasicData>;
18
+ get applicantList(): OfferApplicantBasic[];
19
+ get deadlineAt(): FirebaseFirestore.Timestamp | null;
20
+ get isResponseAllowed(): boolean;
21
+ get selectionClosedAt(): FirebaseFirestore.Timestamp | null;
22
+ get selectionClosedBy(): string | null;
23
+ get isSelectionClosed(): boolean;
24
+ get updatedAt(): FirebaseFirestore.Timestamp;
25
+ get updatedBy(): string | null;
26
+ get deletedAt(): FirebaseFirestore.Timestamp | null;
27
+ get deletedBy(): string | null;
28
+ get isDeleted(): boolean;
29
+ get isActive(): boolean;
30
+ }
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const date_fns_1 = require("date-fns");
7
+ const lodash_1 = require("lodash");
8
+ const instruments_1 = require("../../helpers/instruments");
9
+ const objects_1 = require("../../helpers/objects");
10
+ const lang_1 = require("../../lang");
11
+ const lang_2 = __importDefault(require("../Model/lang"));
12
+ const basic_1 = __importDefault(require("./Applicant/basic"));
13
+ const types_1 = require("./types");
14
+ class Offer extends lang_2.default {
15
+ constructor(doc, lang = lang_1.defaultLocale) {
16
+ super(doc, lang);
17
+ }
18
+ get createdAt() {
19
+ return this.data.createdAt;
20
+ }
21
+ get createdBy() {
22
+ return this.data.createdBy;
23
+ }
24
+ get title() {
25
+ return this.data.title || '';
26
+ }
27
+ get instrument() {
28
+ return this.data.instrument || instruments_1.DefaultInstrumentId.Maracas;
29
+ }
30
+ get description() {
31
+ return this.data.description || '';
32
+ }
33
+ get type() {
34
+ return this.data.type || types_1.OfferType.Group;
35
+ }
36
+ get group() {
37
+ return this.data.group || '';
38
+ }
39
+ get event() {
40
+ return this.data.event || null;
41
+ }
42
+ get applicantsIds() {
43
+ return this.data.applicantsIds || [];
44
+ }
45
+ get applicants() {
46
+ return this.data.applicants || {};
47
+ }
48
+ get applicantList() {
49
+ return (0, objects_1.mapToArray)(this.applicants).map((data) => new basic_1.default(this.id, data));
50
+ }
51
+ get deadlineAt() {
52
+ return this.data.deadlineAt || null;
53
+ }
54
+ get isResponseAllowed() {
55
+ return (!this.isSelectionClosed && (this.deadlineAt ? (0, date_fns_1.isFuture)(this.deadlineAt.toDate()) : true));
56
+ }
57
+ get selectionClosedAt() {
58
+ return this.data.selectionClosedAt || null;
59
+ }
60
+ get selectionClosedBy() {
61
+ return this.data.selectionClosedBy || null;
62
+ }
63
+ get isSelectionClosed() {
64
+ return !(0, lodash_1.isNull)(this.selectionClosedAt);
65
+ }
66
+ get updatedAt() {
67
+ return this.data.updatedAt || null;
68
+ }
69
+ get updatedBy() {
70
+ return this.data.updatedBy || null;
71
+ }
72
+ get deletedAt() {
73
+ return this.data.deletedAt || null;
74
+ }
75
+ get deletedBy() {
76
+ return this.data.deletedBy || null;
77
+ }
78
+ get isDeleted() {
79
+ return !this.exists || !(0, lodash_1.isNull)(this.deletedAt);
80
+ }
81
+ get isActive() {
82
+ return !this.isDeleted;
83
+ }
84
+ }
85
+ exports.default = Offer;
@@ -0,0 +1,26 @@
1
+ import { Timestamp } from '@google-cloud/firestore';
2
+ import { InstrumentId } from '../../helpers/instruments';
3
+ import { OfferApplicantBasicData } from './Applicant/types';
4
+ export declare enum OfferType {
5
+ Group = "group",
6
+ Event = "event"
7
+ }
8
+ export interface OfferData {
9
+ title: string;
10
+ description: string;
11
+ instrument: InstrumentId;
12
+ type: OfferType;
13
+ group: string;
14
+ event: string | null;
15
+ applicantsIds: string[];
16
+ applicants: Record<string, OfferApplicantBasicData>;
17
+ deadlineAt: Timestamp | null;
18
+ selectionClosedAt: Timestamp | null;
19
+ selectionClosedBy: string | null;
20
+ updatedAt: Timestamp;
21
+ updatedBy: string;
22
+ deletedAt: Timestamp | null;
23
+ deletedBy: string | null;
24
+ readonly createdAt: Timestamp;
25
+ readonly createdBy: string;
26
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OfferType = void 0;
4
+ var OfferType;
5
+ (function (OfferType) {
6
+ OfferType["Group"] = "group";
7
+ OfferType["Event"] = "event";
8
+ })(OfferType = exports.OfferType || (exports.OfferType = {}));
@@ -64,4 +64,5 @@ export default class User extends UserBasic<UserData> {
64
64
  id: string;
65
65
  })[];
66
66
  get analyticsEnabled(): true;
67
+ get appliedOffers(): string[];
67
68
  }
@@ -169,5 +169,8 @@ class User extends basic_1.default {
169
169
  get analyticsEnabled() {
170
170
  return this.data.analyticsEnabled || true;
171
171
  }
172
+ get appliedOffers() {
173
+ return this.data.appliedOffers || [];
174
+ }
172
175
  }
173
176
  exports.default = User;
@@ -93,6 +93,7 @@ export interface UserData extends UserBasicData {
93
93
  registerVia: UserRegisterVia;
94
94
  lastAppLoginAt: Timestamp | null;
95
95
  lastWebLoginAt: Timestamp | null;
96
+ appliedOffers: string[];
96
97
  }
97
98
  export interface AUserBasicData extends UserBasicData {
98
99
  id: string;
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.82.0",
3
+ "version": "1.84.0",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
7
7
  "scripts": {
8
- "tsc": "tsc",
9
- "build": "tsc",
10
- "build:watch": "tsc --watch",
8
+ "tsc": "cp package.json ./lib && tsc",
9
+ "build": "npm run tsc",
10
+ "build:watch": "npm run tsc -- --watch",
11
+ "build:link": "tsc",
11
12
  "test": "echo \"Error: no test specified\" && exit 1",
12
13
  "format": "prettier --write \"src/**/*.ts\" \"src/lang/*.json\"",
13
14
  "format:single": "prettier --write",
14
15
  "lint": "eslint --ext .ts ./src",
15
- "prepare": "rm -rf ./lib && npm run build",
16
+ "prepare": "rm -rf ./lib && npm run build:link",
16
17
  "set-husky": "node scripts/setHusky.js",
17
18
  "preversion": "npm run lint",
18
19
  "version": "npm run format && git add -A src && ./publish.sh",