@glissandoo/lib 1.86.0 → 1.87.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.
- package/functions/index.d.ts +2 -1
- package/functions/index.js +2 -1
- package/functions/offer.d.ts +26 -10
- package/functions/offerApplicant.d.ts +4 -3
- package/functions/regions.js +2 -1
- package/helpers/collections.d.ts +1 -0
- package/helpers/collections.js +1 -0
- package/models/Offer/Applicant/index.d.ts +17 -0
- package/models/Offer/Applicant/{basic.js → index.js} +16 -7
- package/models/Offer/Applicant/types.d.ts +9 -8
- package/models/Offer/index.d.ts +12 -5
- package/models/Offer/index.js +17 -2
- package/models/Offer/types.d.ts +20 -5
- package/models/User/index.d.ts +0 -1
- package/models/User/index.js +0 -3
- package/models/User/types.d.ts +0 -1
- package/package.json +1 -1
- package/models/Offer/Applicant/basic.d.ts +0 -16
package/functions/index.d.ts
CHANGED
|
@@ -123,7 +123,8 @@ export declare enum FbFunctionName {
|
|
|
123
123
|
UserSendYearWrapped = "user-sendYearWrapped",
|
|
124
124
|
OfferPublish = "offer-publish",
|
|
125
125
|
OfferEdit = "offer-edit",
|
|
126
|
-
|
|
126
|
+
OfferSelectApplicant = "offer-selectApplicant",
|
|
127
|
+
OfferViewApplicant = "offer-viewApplicant",
|
|
127
128
|
OfferOnUpdate = "offer-onUpdate",
|
|
128
129
|
OfferCloseSelection = "offer-closeSelection",
|
|
129
130
|
OfferRemove = "offer-remove",
|
package/functions/index.js
CHANGED
|
@@ -127,7 +127,8 @@ var FbFunctionName;
|
|
|
127
127
|
FbFunctionName["UserSendYearWrapped"] = "user-sendYearWrapped";
|
|
128
128
|
FbFunctionName["OfferPublish"] = "offer-publish";
|
|
129
129
|
FbFunctionName["OfferEdit"] = "offer-edit";
|
|
130
|
-
FbFunctionName["
|
|
130
|
+
FbFunctionName["OfferSelectApplicant"] = "offer-selectApplicant";
|
|
131
|
+
FbFunctionName["OfferViewApplicant"] = "offer-viewApplicant";
|
|
131
132
|
FbFunctionName["OfferOnUpdate"] = "offer-onUpdate";
|
|
132
133
|
FbFunctionName["OfferCloseSelection"] = "offer-closeSelection";
|
|
133
134
|
FbFunctionName["OfferRemove"] = "offer-remove";
|
package/functions/offer.d.ts
CHANGED
|
@@ -1,27 +1,43 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DefaultInstrumentId } from '../helpers/instruments';
|
|
2
|
+
import { Descendant } from '../helpers/slate';
|
|
2
3
|
import { OfferType } from '../models/Offer/types';
|
|
3
4
|
export declare namespace OfferFbFunctionsTypes {
|
|
4
5
|
interface PublishParams {
|
|
5
6
|
offerId: string;
|
|
6
7
|
title: string;
|
|
7
|
-
description:
|
|
8
|
-
instrument:
|
|
8
|
+
description: Descendant[];
|
|
9
|
+
instrument: DefaultInstrumentId;
|
|
10
|
+
locality: string;
|
|
11
|
+
location: {
|
|
12
|
+
_latitude: number;
|
|
13
|
+
_longitude: number;
|
|
14
|
+
};
|
|
15
|
+
country: string;
|
|
9
16
|
type: OfferType;
|
|
10
17
|
group: string;
|
|
11
18
|
event: string | null;
|
|
12
19
|
deadlineAt: number | null;
|
|
20
|
+
timezone: string;
|
|
13
21
|
}
|
|
14
22
|
type PublishResult = void;
|
|
15
|
-
type EditParams =
|
|
23
|
+
type EditParams = Omit<PublishParams, 'instrument' | 'type' | 'group' | 'event'>;
|
|
16
24
|
type EditResult = void;
|
|
17
|
-
interface
|
|
25
|
+
interface SelectApplicantParams {
|
|
26
|
+
offerId: string;
|
|
27
|
+
userId: string;
|
|
28
|
+
}
|
|
29
|
+
type SelectApplicantResult = void;
|
|
30
|
+
interface ViewApplicantParams {
|
|
31
|
+
offerId: string;
|
|
32
|
+
userId: string;
|
|
33
|
+
}
|
|
34
|
+
type ViewApplicantResult = void;
|
|
35
|
+
interface CloseSelectionParams {
|
|
18
36
|
offerId: string;
|
|
19
|
-
selectedApplicantsIds: string[];
|
|
20
|
-
discardedApplicantsIds: string[];
|
|
21
37
|
}
|
|
22
|
-
type EditSelectionResult = void;
|
|
23
|
-
type CloseSelectionParams = Pick<PublishParams, 'offerId'>;
|
|
24
38
|
type CloseSelectionResult = void;
|
|
25
|
-
|
|
39
|
+
interface RemoveParams {
|
|
40
|
+
offerId: string;
|
|
41
|
+
}
|
|
26
42
|
type RemoveResult = void;
|
|
27
43
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export declare namespace OfferApplicantFbFunctionsTypes {
|
|
2
2
|
interface AddParams {
|
|
3
3
|
offerId: string;
|
|
4
|
-
|
|
5
|
-
message: string | null;
|
|
4
|
+
message: string;
|
|
6
5
|
}
|
|
7
6
|
type AddResult = void;
|
|
8
7
|
type EditParams = AddParams;
|
|
9
8
|
type EditResult = void;
|
|
10
|
-
|
|
9
|
+
interface RemoveParams {
|
|
10
|
+
offerId: string;
|
|
11
|
+
}
|
|
11
12
|
type RemoveResult = void;
|
|
12
13
|
}
|
package/functions/regions.js
CHANGED
|
@@ -123,7 +123,8 @@ const regionByFunctions = {
|
|
|
123
123
|
[index_1.FbFunctionName.PartnershipGroupRemove]: GCloudRegions.EuropeWest6,
|
|
124
124
|
[index_1.FbFunctionName.OfferPublish]: GCloudRegions.EuropeWest6,
|
|
125
125
|
[index_1.FbFunctionName.OfferEdit]: GCloudRegions.EuropeWest6,
|
|
126
|
-
[index_1.FbFunctionName.
|
|
126
|
+
[index_1.FbFunctionName.OfferSelectApplicant]: GCloudRegions.EuropeWest6,
|
|
127
|
+
[index_1.FbFunctionName.OfferViewApplicant]: GCloudRegions.EuropeWest6,
|
|
127
128
|
[index_1.FbFunctionName.OfferOnUpdate]: GCloudRegions.EuropeWest6,
|
|
128
129
|
[index_1.FbFunctionName.OfferCloseSelection]: GCloudRegions.EuropeWest6,
|
|
129
130
|
[index_1.FbFunctionName.OfferRemove]: GCloudRegions.EuropeWest6,
|
package/helpers/collections.d.ts
CHANGED
package/helpers/collections.js
CHANGED
|
@@ -35,5 +35,6 @@ var CollectionNames;
|
|
|
35
35
|
CollectionNames["Federation"] = "federation";
|
|
36
36
|
CollectionNames["FederationPartnerships"] = "partnerships";
|
|
37
37
|
CollectionNames["Offer"] = "offer";
|
|
38
|
+
CollectionNames["OfferApplicants"] = "applicants";
|
|
38
39
|
CollectionNames["WebhookEvent"] = "webhookEvent";
|
|
39
40
|
})(CollectionNames = exports.CollectionNames || (exports.CollectionNames = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Model, { DocumentModel } from '../../Model';
|
|
2
|
+
import { OfferApplicantData } from './types';
|
|
3
|
+
export default class OfferApplicantBasic extends Model<OfferApplicantData> {
|
|
4
|
+
constructor(doc: DocumentModel);
|
|
5
|
+
get username(): string;
|
|
6
|
+
get displayName(): string;
|
|
7
|
+
get photoURL(): string;
|
|
8
|
+
get appliedAt(): FirebaseFirestore.Timestamp;
|
|
9
|
+
get selectedAt(): FirebaseFirestore.Timestamp | null;
|
|
10
|
+
get isSelected(): boolean;
|
|
11
|
+
get discardedAt(): FirebaseFirestore.Timestamp | null;
|
|
12
|
+
get isDiscarded(): boolean;
|
|
13
|
+
get message(): string | null;
|
|
14
|
+
get viewedAt(): FirebaseFirestore.Timestamp | null;
|
|
15
|
+
get isViewed(): boolean;
|
|
16
|
+
get history(): import("./types").OfferApplicantHistory[];
|
|
17
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
get id() {
|
|
9
|
-
return this.data.id;
|
|
6
|
+
const Model_1 = __importDefault(require("../../Model"));
|
|
7
|
+
class OfferApplicantBasic extends Model_1.default {
|
|
8
|
+
constructor(doc) {
|
|
9
|
+
super(doc);
|
|
10
10
|
}
|
|
11
11
|
get username() {
|
|
12
12
|
return this.data.username;
|
|
@@ -35,5 +35,14 @@ class OfferApplicantBasic {
|
|
|
35
35
|
get message() {
|
|
36
36
|
return this.data.message || null;
|
|
37
37
|
}
|
|
38
|
+
get viewedAt() {
|
|
39
|
+
return this.data.viewedAt || null;
|
|
40
|
+
}
|
|
41
|
+
get isViewed() {
|
|
42
|
+
return !!this.viewedAt;
|
|
43
|
+
}
|
|
44
|
+
get history() {
|
|
45
|
+
return (this.data.history || []).sort((a, b) => a.changedAt.toMillis() - b.changedAt.toMillis());
|
|
46
|
+
}
|
|
38
47
|
}
|
|
39
48
|
exports.default = OfferApplicantBasic;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Timestamp } from '@google-cloud/firestore';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { OfferApplicantBasicData } from '../types';
|
|
3
|
+
type OfferApplicantHistoricalAction = 'viewed' | 'selected' | 'apply' | 'discard' | 'edit';
|
|
4
|
+
export interface OfferApplicantHistory {
|
|
5
|
+
action: OfferApplicantHistoricalAction;
|
|
6
|
+
changedAt: Timestamp;
|
|
7
|
+
changedBy: string;
|
|
8
8
|
}
|
|
9
|
-
export interface
|
|
10
|
-
|
|
9
|
+
export interface OfferApplicantData extends OfferApplicantBasicData {
|
|
10
|
+
history: OfferApplicantHistory[];
|
|
11
11
|
}
|
|
12
|
+
export {};
|
package/models/Offer/index.d.ts
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
|
+
import { DefaultInstrumentId } from '../../helpers/instruments';
|
|
1
2
|
import { LanguagesTypes } from '../../lang';
|
|
2
3
|
import { DocumentModel } from '../Model';
|
|
3
4
|
import ModelWithLang from '../Model/lang';
|
|
4
|
-
import OfferApplicantBasic from './Applicant/basic';
|
|
5
5
|
import { OfferData, OfferType } from './types';
|
|
6
6
|
export default class Offer extends ModelWithLang<OfferData> {
|
|
7
7
|
constructor(doc: DocumentModel, lang?: LanguagesTypes);
|
|
8
8
|
get createdAt(): FirebaseFirestore.Timestamp;
|
|
9
9
|
get createdBy(): string;
|
|
10
10
|
get title(): string;
|
|
11
|
-
get instrument():
|
|
12
|
-
get description():
|
|
11
|
+
get instrument(): DefaultInstrumentId;
|
|
12
|
+
get description(): import("../../helpers/slate").Descendant[];
|
|
13
|
+
get plainDescription(): string;
|
|
13
14
|
get type(): OfferType;
|
|
14
15
|
get group(): string;
|
|
15
16
|
get event(): string | null;
|
|
17
|
+
get locality(): string;
|
|
18
|
+
get location(): FirebaseFirestore.GeoPoint;
|
|
19
|
+
get country(): string;
|
|
16
20
|
get applicantsIds(): string[];
|
|
17
|
-
get applicants(): Record<string, import("./
|
|
18
|
-
get applicantList():
|
|
21
|
+
get applicants(): Record<string, import("./types").OfferApplicantBasicData>;
|
|
22
|
+
get applicantList(): (import("./types").OfferApplicantBasicData & {
|
|
23
|
+
id: string;
|
|
24
|
+
})[];
|
|
19
25
|
get deadlineAt(): FirebaseFirestore.Timestamp | null;
|
|
26
|
+
get timezone(): string;
|
|
20
27
|
get isResponseAllowed(): boolean;
|
|
21
28
|
get selectionClosedAt(): FirebaseFirestore.Timestamp | null;
|
|
22
29
|
get selectionClosedBy(): string | null;
|
package/models/Offer/index.js
CHANGED
|
@@ -7,9 +7,9 @@ const date_fns_1 = require("date-fns");
|
|
|
7
7
|
const lodash_1 = require("lodash");
|
|
8
8
|
const instruments_1 = require("../../helpers/instruments");
|
|
9
9
|
const objects_1 = require("../../helpers/objects");
|
|
10
|
+
const slate_1 = require("../../helpers/slate");
|
|
10
11
|
const lang_1 = require("../../lang");
|
|
11
12
|
const lang_2 = __importDefault(require("../Model/lang"));
|
|
12
|
-
const basic_1 = __importDefault(require("./Applicant/basic"));
|
|
13
13
|
const types_1 = require("./types");
|
|
14
14
|
class Offer extends lang_2.default {
|
|
15
15
|
constructor(doc, lang = lang_1.defaultLocale) {
|
|
@@ -30,6 +30,9 @@ class Offer extends lang_2.default {
|
|
|
30
30
|
get description() {
|
|
31
31
|
return this.data.description || '';
|
|
32
32
|
}
|
|
33
|
+
get plainDescription() {
|
|
34
|
+
return (0, slate_1.serializeSlateBlock)(this.description);
|
|
35
|
+
}
|
|
33
36
|
get type() {
|
|
34
37
|
return this.data.type || types_1.OfferType.Group;
|
|
35
38
|
}
|
|
@@ -39,6 +42,15 @@ class Offer extends lang_2.default {
|
|
|
39
42
|
get event() {
|
|
40
43
|
return this.data.event || null;
|
|
41
44
|
}
|
|
45
|
+
get locality() {
|
|
46
|
+
return this.data.locality;
|
|
47
|
+
}
|
|
48
|
+
get location() {
|
|
49
|
+
return this.data.location;
|
|
50
|
+
}
|
|
51
|
+
get country() {
|
|
52
|
+
return this.data.country;
|
|
53
|
+
}
|
|
42
54
|
get applicantsIds() {
|
|
43
55
|
return this.data.applicantsIds || [];
|
|
44
56
|
}
|
|
@@ -46,11 +58,14 @@ class Offer extends lang_2.default {
|
|
|
46
58
|
return this.data.applicants || {};
|
|
47
59
|
}
|
|
48
60
|
get applicantList() {
|
|
49
|
-
return (0, objects_1.mapToArray)(this.applicants)
|
|
61
|
+
return (0, objects_1.mapToArray)(this.applicants);
|
|
50
62
|
}
|
|
51
63
|
get deadlineAt() {
|
|
52
64
|
return this.data.deadlineAt || null;
|
|
53
65
|
}
|
|
66
|
+
get timezone() {
|
|
67
|
+
return this.data.timezone || 'Europe/Madrid';
|
|
68
|
+
}
|
|
54
69
|
get isResponseAllowed() {
|
|
55
70
|
return (!this.isSelectionClosed && (this.deadlineAt ? (0, date_fns_1.isFuture)(this.deadlineAt.toDate()) : true));
|
|
56
71
|
}
|
package/models/Offer/types.d.ts
CHANGED
|
@@ -1,20 +1,35 @@
|
|
|
1
|
-
import { Timestamp } from '@google-cloud/firestore';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { GeoPoint, Timestamp } from '@google-cloud/firestore';
|
|
2
|
+
import { DefaultInstrumentId } from '../../helpers/instruments';
|
|
3
|
+
import { Descendant } from '../../helpers/slate';
|
|
4
|
+
import { UserBasicData } from '../User/types';
|
|
4
5
|
export declare enum OfferType {
|
|
5
6
|
Group = "group",
|
|
6
7
|
Event = "event"
|
|
7
8
|
}
|
|
9
|
+
export interface OfferApplicantBasicData extends UserBasicData {
|
|
10
|
+
appliedAt: Timestamp;
|
|
11
|
+
viewedAt: Timestamp | null;
|
|
12
|
+
selectedAt: Timestamp | null;
|
|
13
|
+
discardedAt: Timestamp | null;
|
|
14
|
+
message: string | null;
|
|
15
|
+
}
|
|
16
|
+
export interface AOfferApplicantBasicData extends OfferApplicantBasicData {
|
|
17
|
+
id: string;
|
|
18
|
+
}
|
|
8
19
|
export interface OfferData {
|
|
9
20
|
title: string;
|
|
10
|
-
description:
|
|
11
|
-
instrument:
|
|
21
|
+
description: Descendant[];
|
|
22
|
+
instrument: DefaultInstrumentId;
|
|
23
|
+
locality: string;
|
|
24
|
+
location: GeoPoint;
|
|
25
|
+
country: string;
|
|
12
26
|
type: OfferType;
|
|
13
27
|
group: string;
|
|
14
28
|
event: string | null;
|
|
15
29
|
applicantsIds: string[];
|
|
16
30
|
applicants: Record<string, OfferApplicantBasicData>;
|
|
17
31
|
deadlineAt: Timestamp | null;
|
|
32
|
+
timezone: string;
|
|
18
33
|
selectionClosedAt: Timestamp | null;
|
|
19
34
|
selectionClosedBy: string | null;
|
|
20
35
|
updatedAt: Timestamp;
|
package/models/User/index.d.ts
CHANGED
package/models/User/index.js
CHANGED
package/models/User/types.d.ts
CHANGED
|
@@ -93,7 +93,6 @@ export interface UserData extends UserBasicData {
|
|
|
93
93
|
registerVia: UserRegisterVia;
|
|
94
94
|
lastAppLoginAt: Timestamp | null;
|
|
95
95
|
lastWebLoginAt: Timestamp | null;
|
|
96
|
-
appliedOffers: string[];
|
|
97
96
|
}
|
|
98
97
|
export interface AUserBasicData extends UserBasicData {
|
|
99
98
|
id: string;
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
}
|