@timardex/cluemart-shared 1.2.34 → 1.2.36
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/dist/{ad-CiYcsJB7.d.mts → ad-Bv5fLkN0.d.mts} +1 -1
- package/dist/{ad-BZylIpez.d.ts → ad-DDPNpx02.d.ts} +1 -1
- package/dist/{auth-DDtMJHZw.d.mts → auth-BVGs-5Vm.d.mts} +1 -1
- package/dist/{auth-CmaB99NK.d.ts → auth-BhUIvvZ2.d.ts} +1 -1
- package/dist/formFields/index.d.mts +1 -3
- package/dist/formFields/index.d.ts +1 -3
- package/dist/{global-DVYSZ6LR.d.ts → global-BA84KF8J.d.ts} +2 -148
- package/dist/{global-ExJZRDGR.d.mts → global-BEqzo5Z2.d.mts} +2 -148
- package/dist/graphql/index.d.mts +3 -5
- package/dist/graphql/index.d.ts +3 -5
- package/dist/hooks/index.d.mts +3 -5
- package/dist/hooks/index.d.ts +3 -5
- package/dist/hooks/index.mjs +5 -5
- package/dist/index.cjs +17 -1124
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +311 -821
- package/dist/index.d.ts +311 -821
- package/dist/index.mjs +17 -1096
- package/dist/index.mjs.map +1 -1
- package/dist/resourceActivities-0CdofGJp.d.mts +96 -0
- package/dist/resourceActivities-BjgH9TFc.d.ts +96 -0
- package/dist/types/index.cjs +2 -26
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.mts +4 -6
- package/dist/types/index.d.ts +4 -6
- package/dist/types/index.mjs +11 -8
- package/dist/types/index.mjs.map +1 -1
- package/dist/utils/index.d.mts +1 -3
- package/dist/utils/index.d.ts +1 -3
- package/package.json +1 -1
- package/dist/chunk-4OLDTZXH.mjs +0 -26
- package/dist/chunk-4OLDTZXH.mjs.map +0 -1
- package/dist/chunk-NPHPFWQH.mjs +0 -63
- package/dist/chunk-NPHPFWQH.mjs.map +0 -1
- package/dist/mongoose/index.cjs +0 -1085
- package/dist/mongoose/index.cjs.map +0 -1
- package/dist/mongoose/index.d.mts +0 -415
- package/dist/mongoose/index.d.ts +0 -415
- package/dist/mongoose/index.mjs +0 -862
- package/dist/mongoose/index.mjs.map +0 -1
- package/dist/resourceActivities-B4roVKtQ.d.ts +0 -34
- package/dist/resourceActivities-BIjtlOGp.d.mts +0 -34
- package/dist/service/index.cjs +0 -308
- package/dist/service/index.cjs.map +0 -1
- package/dist/service/index.d.mts +0 -27
- package/dist/service/index.d.ts +0 -27
- package/dist/service/index.mjs +0 -190
- package/dist/service/index.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -4691,7 +4691,7 @@ var socialMediaSchema = yup.object({
|
|
|
4691
4691
|
is: (name) => !!name,
|
|
4692
4692
|
// If name has a value
|
|
4693
4693
|
then: () => normalizedUrlTransform().required("Link is required when name is set").url("Link must be a valid URL").label("Social Media Link"),
|
|
4694
|
-
otherwise: (
|
|
4694
|
+
otherwise: (schema) => schema.notRequired()
|
|
4695
4695
|
})
|
|
4696
4696
|
});
|
|
4697
4697
|
var globalResourceSchema = yup.object().shape({
|
|
@@ -4764,21 +4764,21 @@ var paymentInfoSchema = yup2.object({
|
|
|
4764
4764
|
paymentMethod: yup2.mixed().oneOf(Object.values(EnumPaymentMethod)).required("Please select a Payment method"),
|
|
4765
4765
|
accountHolderName: yup2.string().when("paymentMethod", {
|
|
4766
4766
|
is: "bank_transfer" /* BANK_TRANSFER */,
|
|
4767
|
-
then: (
|
|
4768
|
-
otherwise: (
|
|
4767
|
+
then: (schema) => schema.required("Account holder name is required for bank transfer").trim(),
|
|
4768
|
+
otherwise: (schema) => schema.notRequired()
|
|
4769
4769
|
}),
|
|
4770
4770
|
accountNumber: yup2.string().when("paymentMethod", {
|
|
4771
4771
|
is: "bank_transfer" /* BANK_TRANSFER */,
|
|
4772
|
-
then: (
|
|
4772
|
+
then: (schema) => schema.required("Account number is required for bank transfer").matches(
|
|
4773
4773
|
nzBankAccountRegex,
|
|
4774
4774
|
"Account number must be in format: XX-XXXX-XXXXXXX-XX"
|
|
4775
4775
|
).trim(),
|
|
4776
|
-
otherwise: (
|
|
4776
|
+
otherwise: (schema) => schema.notRequired()
|
|
4777
4777
|
}),
|
|
4778
4778
|
link: yup2.string().when("paymentMethod", {
|
|
4779
4779
|
is: (val) => val !== "bank_transfer" /* BANK_TRANSFER */,
|
|
4780
4780
|
then: () => normalizedUrlTransform().url("Link must be a valid URL").required("Link is required for PayPal/Stripe"),
|
|
4781
|
-
otherwise: (
|
|
4781
|
+
otherwise: (schema) => schema.notRequired()
|
|
4782
4782
|
})
|
|
4783
4783
|
});
|
|
4784
4784
|
var eventInfoSchema = yup2.object().shape({
|
|
@@ -4958,7 +4958,7 @@ var adSchema = yup7.object().shape({
|
|
|
4958
4958
|
return endDate > now;
|
|
4959
4959
|
}).when("start", {
|
|
4960
4960
|
is: (val) => val && val.length > 0,
|
|
4961
|
-
then: (
|
|
4961
|
+
then: (schema) => schema.test(
|
|
4962
4962
|
"is-after-start",
|
|
4963
4963
|
"End date must be after start date",
|
|
4964
4964
|
function(value) {
|
|
@@ -5928,1067 +5928,6 @@ function useAdForm(data) {
|
|
|
5928
5928
|
};
|
|
5929
5929
|
}
|
|
5930
5930
|
|
|
5931
|
-
// src/mongoose/Ad.ts
|
|
5932
|
-
import mongoose5 from "mongoose";
|
|
5933
|
-
|
|
5934
|
-
// src/types/global.ts
|
|
5935
|
-
import mongoose from "mongoose";
|
|
5936
|
-
var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
|
|
5937
|
-
EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
|
|
5938
|
-
EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
|
|
5939
|
-
EnumPubSubEvents2["GET_NOTIFICATIONS_COUNT"] = "GET_NOTIFICATIONS_COUNT";
|
|
5940
|
-
EnumPubSubEvents2["USER_TYPING"] = "USER_TYPING";
|
|
5941
|
-
return EnumPubSubEvents2;
|
|
5942
|
-
})(EnumPubSubEvents || {});
|
|
5943
|
-
|
|
5944
|
-
// src/types/resourceActivities.ts
|
|
5945
|
-
var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
|
|
5946
|
-
EnumActivity2["FAVORITE"] = "FAVORITE";
|
|
5947
|
-
EnumActivity2["GOING"] = "GOING";
|
|
5948
|
-
EnumActivity2["INTERESTED"] = "INTERESTED";
|
|
5949
|
-
EnumActivity2["PRESENT"] = "PRESENT";
|
|
5950
|
-
EnumActivity2["VIEW"] = "VIEW";
|
|
5951
|
-
return EnumActivity2;
|
|
5952
|
-
})(EnumActivity || {});
|
|
5953
|
-
|
|
5954
|
-
// src/mongoose/global.ts
|
|
5955
|
-
import mongoose4 from "mongoose";
|
|
5956
|
-
|
|
5957
|
-
// src/mongoose/Relation.ts
|
|
5958
|
-
import mongoose3 from "mongoose";
|
|
5959
|
-
|
|
5960
|
-
// src/mongoose/event/EventInfo.ts
|
|
5961
|
-
import mongoose2 from "mongoose";
|
|
5962
|
-
var MongooseSchema = mongoose2.Schema;
|
|
5963
|
-
var StallTypeSchema = new MongooseSchema(
|
|
5964
|
-
{
|
|
5965
|
-
electricity: {
|
|
5966
|
-
price: { required: false, type: Number },
|
|
5967
|
-
selected: { required: false, type: Boolean }
|
|
5968
|
-
},
|
|
5969
|
-
label: { required: false, type: String },
|
|
5970
|
-
price: { required: false, type: Number },
|
|
5971
|
-
stallCapacity: { required: false, type: Number }
|
|
5972
|
-
},
|
|
5973
|
-
{
|
|
5974
|
-
_id: false
|
|
5975
|
-
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
5976
|
-
}
|
|
5977
|
-
);
|
|
5978
|
-
var dateTimeSchema2 = new MongooseSchema(
|
|
5979
|
-
{
|
|
5980
|
-
endDate: { required: true, type: String },
|
|
5981
|
-
endTime: { required: true, type: String },
|
|
5982
|
-
stallTypes: [StallTypeSchema],
|
|
5983
|
-
startDate: { required: true, type: String },
|
|
5984
|
-
startTime: { required: true, type: String }
|
|
5985
|
-
},
|
|
5986
|
-
{ _id: false }
|
|
5987
|
-
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
5988
|
-
);
|
|
5989
|
-
var paymentInfoSchema2 = new MongooseSchema(
|
|
5990
|
-
{
|
|
5991
|
-
accountHolderName: { required: false, type: String },
|
|
5992
|
-
accountNumber: { required: false, type: String },
|
|
5993
|
-
link: { required: false, type: String },
|
|
5994
|
-
paymentMethod: {
|
|
5995
|
-
enum: Object.values(EnumPaymentMethod),
|
|
5996
|
-
required: true,
|
|
5997
|
-
type: String
|
|
5998
|
-
}
|
|
5999
|
-
},
|
|
6000
|
-
{ _id: false }
|
|
6001
|
-
// Prevents Mongoose from creating an additional _id field
|
|
6002
|
-
);
|
|
6003
|
-
var requirementsSchema = new MongooseSchema(
|
|
6004
|
-
{
|
|
6005
|
-
category: { required: true, type: String },
|
|
6006
|
-
label: { required: true, type: String },
|
|
6007
|
-
value: { required: true, type: Boolean }
|
|
6008
|
-
},
|
|
6009
|
-
{
|
|
6010
|
-
_id: false
|
|
6011
|
-
// Prevents Mongoose from creating an additional _id field for
|
|
6012
|
-
}
|
|
6013
|
-
);
|
|
6014
|
-
var schema = new MongooseSchema(
|
|
6015
|
-
{
|
|
6016
|
-
applicationDeadlineHours: { required: true, type: Number },
|
|
6017
|
-
dateTime: [dateTimeSchema2],
|
|
6018
|
-
eventId: {
|
|
6019
|
-
ref: "Event",
|
|
6020
|
-
required: false,
|
|
6021
|
-
type: mongoose2.Schema.Types.ObjectId
|
|
6022
|
-
},
|
|
6023
|
-
packInTime: { required: true, type: Number },
|
|
6024
|
-
paymentDueHours: { required: true, type: Number },
|
|
6025
|
-
paymentInfo: [paymentInfoSchema2],
|
|
6026
|
-
requirements: [requirementsSchema]
|
|
6027
|
-
},
|
|
6028
|
-
{ timestamps: true }
|
|
6029
|
-
);
|
|
6030
|
-
var EventInfoModel = mongoose2.models.EventInfo || mongoose2.model("EventInfo", schema);
|
|
6031
|
-
|
|
6032
|
-
// src/mongoose/Relation.ts
|
|
6033
|
-
var MongooseSchema2 = mongoose3.Schema;
|
|
6034
|
-
var relationDatesSchema = new MongooseSchema2(
|
|
6035
|
-
{
|
|
6036
|
-
lastUpdateBy: {
|
|
6037
|
-
resourceId: { required: false, type: String },
|
|
6038
|
-
userEmail: { required: false, type: String }
|
|
6039
|
-
},
|
|
6040
|
-
paymentReference: { required: false, type: String },
|
|
6041
|
-
stallType: StallTypeSchema,
|
|
6042
|
-
startDate: { required: false, type: String },
|
|
6043
|
-
startTime: { required: false, type: String },
|
|
6044
|
-
status: {
|
|
6045
|
-
enum: Object.values(EnumInviteStatus),
|
|
6046
|
-
required: false,
|
|
6047
|
-
type: String
|
|
6048
|
-
}
|
|
6049
|
-
},
|
|
6050
|
-
{ _id: false }
|
|
6051
|
-
);
|
|
6052
|
-
var RelationTypeSchema = new MongooseSchema2(
|
|
6053
|
-
{
|
|
6054
|
-
active: { default: true, required: true, type: Boolean },
|
|
6055
|
-
chatId: {
|
|
6056
|
-
ref: "Chat",
|
|
6057
|
-
required: true,
|
|
6058
|
-
type: mongoose3.Schema.Types.ObjectId
|
|
6059
|
-
},
|
|
6060
|
-
deletedAt: { default: null, required: false, type: Date },
|
|
6061
|
-
eventId: {
|
|
6062
|
-
ref: "Event",
|
|
6063
|
-
required: true,
|
|
6064
|
-
type: mongoose3.Schema.Types.ObjectId
|
|
6065
|
-
},
|
|
6066
|
-
lastUpdateBy: {
|
|
6067
|
-
enum: Object.values(EnumResourceType),
|
|
6068
|
-
required: true,
|
|
6069
|
-
type: String
|
|
6070
|
-
},
|
|
6071
|
-
relationDates: [relationDatesSchema],
|
|
6072
|
-
relationType: {
|
|
6073
|
-
enum: Object.values(EnumRelationResource),
|
|
6074
|
-
required: true,
|
|
6075
|
-
type: String
|
|
6076
|
-
},
|
|
6077
|
-
vendorId: {
|
|
6078
|
-
ref: "Vendor",
|
|
6079
|
-
required: true,
|
|
6080
|
-
type: mongoose3.Schema.Types.ObjectId
|
|
6081
|
-
}
|
|
6082
|
-
},
|
|
6083
|
-
{ timestamps: true }
|
|
6084
|
-
);
|
|
6085
|
-
RelationTypeSchema.index({
|
|
6086
|
-
"relationDates.startDate": 1,
|
|
6087
|
-
"relationDates.startTime": 1,
|
|
6088
|
-
"relationDates.status": 1
|
|
6089
|
-
});
|
|
6090
|
-
var RelationModel = mongoose3.models.Relation || mongoose3.model("Relation", RelationTypeSchema);
|
|
6091
|
-
|
|
6092
|
-
// src/mongoose/global.ts
|
|
6093
|
-
var MongooseSchema3 = mongoose4.Schema;
|
|
6094
|
-
var OwnerTypeSchema = new MongooseSchema3(
|
|
6095
|
-
{
|
|
6096
|
-
email: { required: true, type: String },
|
|
6097
|
-
userId: {
|
|
6098
|
-
ref: "User",
|
|
6099
|
-
required: true,
|
|
6100
|
-
type: mongoose4.Schema.Types.ObjectId
|
|
6101
|
-
}
|
|
6102
|
-
},
|
|
6103
|
-
{ _id: false }
|
|
6104
|
-
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
6105
|
-
);
|
|
6106
|
-
var SocialMediaTypeSchema = new MongooseSchema3(
|
|
6107
|
-
{
|
|
6108
|
-
link: { required: true, type: String },
|
|
6109
|
-
name: { required: true, type: String }
|
|
6110
|
-
},
|
|
6111
|
-
{ _id: false }
|
|
6112
|
-
// Prevents Mongoose from creating an additional _id field
|
|
6113
|
-
);
|
|
6114
|
-
var ResourceImageTypeSchema = new MongooseSchema3(
|
|
6115
|
-
{
|
|
6116
|
-
source: { required: false, type: String },
|
|
6117
|
-
title: { required: false, type: String }
|
|
6118
|
-
},
|
|
6119
|
-
{ _id: false }
|
|
6120
|
-
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
6121
|
-
);
|
|
6122
|
-
var SubCategorySchema = new MongooseSchema3(
|
|
6123
|
-
{
|
|
6124
|
-
id: { required: false, type: String },
|
|
6125
|
-
items: [
|
|
6126
|
-
{
|
|
6127
|
-
id: { required: false, type: String },
|
|
6128
|
-
name: { required: false, type: String }
|
|
6129
|
-
}
|
|
6130
|
-
],
|
|
6131
|
-
name: { required: false, type: String }
|
|
6132
|
-
},
|
|
6133
|
-
{ _id: false }
|
|
6134
|
-
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
6135
|
-
);
|
|
6136
|
-
var CategorySchema = new MongooseSchema3(
|
|
6137
|
-
{
|
|
6138
|
-
id: { required: true, type: String },
|
|
6139
|
-
name: { required: true, type: String },
|
|
6140
|
-
subcategories: [SubCategorySchema]
|
|
6141
|
-
},
|
|
6142
|
-
{ _id: false }
|
|
6143
|
-
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
6144
|
-
);
|
|
6145
|
-
var PosterUsageTypeSchema = new MongooseSchema3(
|
|
6146
|
-
{
|
|
6147
|
-
count: { default: 0, required: false, type: Number },
|
|
6148
|
-
month: { required: false, type: String }
|
|
6149
|
-
},
|
|
6150
|
-
{ _id: false }
|
|
6151
|
-
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
6152
|
-
);
|
|
6153
|
-
var partnersSchema = new MongooseSchema3(
|
|
6154
|
-
{
|
|
6155
|
-
email: { required: false, type: String },
|
|
6156
|
-
licence: {
|
|
6157
|
-
enum: Object.values(EnumUserLicence),
|
|
6158
|
-
required: false,
|
|
6159
|
-
type: String
|
|
6160
|
-
},
|
|
6161
|
-
resourceId: {
|
|
6162
|
-
required: false,
|
|
6163
|
-
type: String
|
|
6164
|
-
},
|
|
6165
|
-
resourceType: {
|
|
6166
|
-
enum: Object.values(EnumResourceType),
|
|
6167
|
-
required: false,
|
|
6168
|
-
type: String
|
|
6169
|
-
}
|
|
6170
|
-
},
|
|
6171
|
-
{ _id: false }
|
|
6172
|
-
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
6173
|
-
);
|
|
6174
|
-
var ContactDetailsSchema = new MongooseSchema3(
|
|
6175
|
-
{
|
|
6176
|
-
email: { required: false, type: String },
|
|
6177
|
-
landlinePhone: { required: false, type: String },
|
|
6178
|
-
mobilePhone: { required: false, type: String }
|
|
6179
|
-
},
|
|
6180
|
-
{ _id: false }
|
|
6181
|
-
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
6182
|
-
);
|
|
6183
|
-
var termsAgreementSchema = new MongooseSchema3(
|
|
6184
|
-
{
|
|
6185
|
-
appBuildNumber: { required: true, type: String },
|
|
6186
|
-
appId: { required: true, type: String },
|
|
6187
|
-
appVersion: { required: true, type: String },
|
|
6188
|
-
brand: { required: true, type: String },
|
|
6189
|
-
deviceName: { required: true, type: String },
|
|
6190
|
-
installationId: { required: true, type: String },
|
|
6191
|
-
manufacturer: { required: true, type: String },
|
|
6192
|
-
modelName: { required: true, type: String },
|
|
6193
|
-
osName: { required: true, type: String },
|
|
6194
|
-
osVersion: { required: true, type: String },
|
|
6195
|
-
termVersion: { required: true, type: String },
|
|
6196
|
-
timestamp: { required: true, type: String }
|
|
6197
|
-
},
|
|
6198
|
-
{ _id: false }
|
|
6199
|
-
);
|
|
6200
|
-
var resourceRelationsSchema = new MongooseSchema3(
|
|
6201
|
-
{
|
|
6202
|
-
relationDates: {
|
|
6203
|
-
default: [],
|
|
6204
|
-
required: false,
|
|
6205
|
-
type: [relationDatesSchema]
|
|
6206
|
-
},
|
|
6207
|
-
relationId: {
|
|
6208
|
-
ref: "Relation",
|
|
6209
|
-
required: false,
|
|
6210
|
-
type: mongoose4.Schema.Types.ObjectId
|
|
6211
|
-
}
|
|
6212
|
-
},
|
|
6213
|
-
{ _id: false }
|
|
6214
|
-
);
|
|
6215
|
-
var baseResourceFields = {
|
|
6216
|
-
active: { default: false, required: true, type: Boolean },
|
|
6217
|
-
adIds: {
|
|
6218
|
-
ref: "Ad",
|
|
6219
|
-
required: false,
|
|
6220
|
-
type: [mongoose4.Schema.Types.ObjectId]
|
|
6221
|
-
},
|
|
6222
|
-
contactDetails: ContactDetailsSchema,
|
|
6223
|
-
cover: ResourceImageTypeSchema,
|
|
6224
|
-
deletedAt: { default: null, required: false, type: Date },
|
|
6225
|
-
description: { required: true, type: String },
|
|
6226
|
-
images: [ResourceImageTypeSchema],
|
|
6227
|
-
logo: ResourceImageTypeSchema,
|
|
6228
|
-
name: { required: true, type: String },
|
|
6229
|
-
owner: OwnerTypeSchema,
|
|
6230
|
-
partners: {
|
|
6231
|
-
required: false,
|
|
6232
|
-
type: [partnersSchema]
|
|
6233
|
-
},
|
|
6234
|
-
posterUsage: PosterUsageTypeSchema,
|
|
6235
|
-
promoCodes: { required: false, type: [String] },
|
|
6236
|
-
region: { required: true, type: String },
|
|
6237
|
-
relations: {
|
|
6238
|
-
default: [],
|
|
6239
|
-
required: false,
|
|
6240
|
-
type: [resourceRelationsSchema]
|
|
6241
|
-
},
|
|
6242
|
-
socialMedia: [SocialMediaTypeSchema],
|
|
6243
|
-
termsAgreement: termsAgreementSchema
|
|
6244
|
-
};
|
|
6245
|
-
|
|
6246
|
-
// src/mongoose/Ad.ts
|
|
6247
|
-
var MongooseSchema4 = mongoose5.Schema;
|
|
6248
|
-
var schema2 = new MongooseSchema4(
|
|
6249
|
-
{
|
|
6250
|
-
active: { default: true, type: Boolean },
|
|
6251
|
-
adStyle: {
|
|
6252
|
-
default: "Bloom" /* BLOOM */,
|
|
6253
|
-
enum: Object.values(EnumAdStyle),
|
|
6254
|
-
required: true,
|
|
6255
|
-
type: String
|
|
6256
|
-
},
|
|
6257
|
-
adType: {
|
|
6258
|
-
default: "Sponsored" /* SPONSORED */,
|
|
6259
|
-
enum: Object.values(EnumAdType),
|
|
6260
|
-
required: true,
|
|
6261
|
-
type: String
|
|
6262
|
-
},
|
|
6263
|
-
// TODO: similar to ViewSchema
|
|
6264
|
-
clicks: { default: 0, required: true, type: Number },
|
|
6265
|
-
clui: { required: false, type: String },
|
|
6266
|
-
end: { required: true, type: Date },
|
|
6267
|
-
// TODO: similar to ViewSchema
|
|
6268
|
-
impressions: { default: 0, required: true, type: Number },
|
|
6269
|
-
resourceCover: { required: true, type: String },
|
|
6270
|
-
resourceDescription: { required: true, type: String },
|
|
6271
|
-
resourceId: { required: true, type: String },
|
|
6272
|
-
resourceLogo: { required: false, type: String },
|
|
6273
|
-
resourceName: { required: true, type: String },
|
|
6274
|
-
resourceRegion: { required: true, type: String },
|
|
6275
|
-
resourceType: {
|
|
6276
|
-
enum: Object.values(EnumResourceType),
|
|
6277
|
-
required: true,
|
|
6278
|
-
type: String
|
|
6279
|
-
},
|
|
6280
|
-
showOn: {
|
|
6281
|
-
default: "Front_page" /* FRONT_PAGE */,
|
|
6282
|
-
enum: Object.values(EnumAdShowOn),
|
|
6283
|
-
required: true,
|
|
6284
|
-
type: String
|
|
6285
|
-
},
|
|
6286
|
-
socialMedia: [SocialMediaTypeSchema],
|
|
6287
|
-
start: { required: true, type: Date },
|
|
6288
|
-
status: {
|
|
6289
|
-
default: "Active" /* ACTIVE */,
|
|
6290
|
-
enum: Object.values(EnumAdStatus),
|
|
6291
|
-
required: true,
|
|
6292
|
-
type: String
|
|
6293
|
-
},
|
|
6294
|
-
targetRegion: { required: false, type: String }
|
|
6295
|
-
},
|
|
6296
|
-
{
|
|
6297
|
-
timestamps: true
|
|
6298
|
-
}
|
|
6299
|
-
);
|
|
6300
|
-
schema2.index({
|
|
6301
|
-
end: 1,
|
|
6302
|
-
start: 1,
|
|
6303
|
-
status: 1
|
|
6304
|
-
});
|
|
6305
|
-
var AdModel = mongoose5.models.Ad || mongoose5.model("Ad", schema2);
|
|
6306
|
-
|
|
6307
|
-
// src/mongoose/Chat.ts
|
|
6308
|
-
import mongoose6 from "mongoose";
|
|
6309
|
-
var MongooseSchema5 = mongoose6.Schema;
|
|
6310
|
-
var MessageSchema = new MongooseSchema5(
|
|
6311
|
-
{
|
|
6312
|
-
content: { required: true, type: String },
|
|
6313
|
-
senderAvatar: { required: false, type: String },
|
|
6314
|
-
senderId: {
|
|
6315
|
-
ref: "User",
|
|
6316
|
-
required: true,
|
|
6317
|
-
type: mongoose6.Schema.Types.ObjectId
|
|
6318
|
-
},
|
|
6319
|
-
senderName: { required: true, type: String }
|
|
6320
|
-
},
|
|
6321
|
-
{ timestamps: true }
|
|
6322
|
-
);
|
|
6323
|
-
var ParticipantSchema = new MongooseSchema5(
|
|
6324
|
-
{
|
|
6325
|
-
active: { default: true, required: true, type: Boolean },
|
|
6326
|
-
email: { required: true, type: String },
|
|
6327
|
-
userId: {
|
|
6328
|
-
ref: "User",
|
|
6329
|
-
required: true,
|
|
6330
|
-
type: mongoose6.Schema.Types.ObjectId
|
|
6331
|
-
}
|
|
6332
|
-
},
|
|
6333
|
-
{ _id: false }
|
|
6334
|
-
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
6335
|
-
);
|
|
6336
|
-
var ChatSchema = new MongooseSchema5(
|
|
6337
|
-
{
|
|
6338
|
-
active: { default: true, required: true, type: Boolean },
|
|
6339
|
-
chatName: { required: true, type: String },
|
|
6340
|
-
chatType: {
|
|
6341
|
-
enum: Object.values(EnumChatType),
|
|
6342
|
-
required: true,
|
|
6343
|
-
type: String
|
|
6344
|
-
},
|
|
6345
|
-
deletedAt: { default: null, required: false, type: Date },
|
|
6346
|
-
messages: [MessageSchema],
|
|
6347
|
-
participants: [ParticipantSchema],
|
|
6348
|
-
resourceInfo: {
|
|
6349
|
-
eventId: {
|
|
6350
|
-
ref: "Event",
|
|
6351
|
-
required: false,
|
|
6352
|
-
type: mongoose6.Schema.Types.ObjectId
|
|
6353
|
-
},
|
|
6354
|
-
vendorId: {
|
|
6355
|
-
ref: "Vendor",
|
|
6356
|
-
required: false,
|
|
6357
|
-
type: mongoose6.Schema.Types.ObjectId
|
|
6358
|
-
}
|
|
6359
|
-
}
|
|
6360
|
-
},
|
|
6361
|
-
{
|
|
6362
|
-
timestamps: true
|
|
6363
|
-
}
|
|
6364
|
-
);
|
|
6365
|
-
var ChatModel = mongoose6.models.Chat || mongoose6.model("Chat", ChatSchema);
|
|
6366
|
-
|
|
6367
|
-
// src/mongoose/Notification.ts
|
|
6368
|
-
import mongoose7 from "mongoose";
|
|
6369
|
-
var MongooseSchema6 = mongoose7.Schema;
|
|
6370
|
-
var schema3 = new MongooseSchema6(
|
|
6371
|
-
{
|
|
6372
|
-
data: {
|
|
6373
|
-
resourceId: { required: true, type: String },
|
|
6374
|
-
resourceName: { required: true, type: String },
|
|
6375
|
-
resourceType: {
|
|
6376
|
-
enum: Object.values(EnumNotificationResourceType),
|
|
6377
|
-
required: true,
|
|
6378
|
-
type: String
|
|
6379
|
-
}
|
|
6380
|
-
},
|
|
6381
|
-
isRead: { default: false, index: true, required: true, type: Boolean },
|
|
6382
|
-
message: { required: true, type: String },
|
|
6383
|
-
title: { required: true, type: String },
|
|
6384
|
-
type: {
|
|
6385
|
-
default: "system" /* SYSTEM */,
|
|
6386
|
-
enum: Object.values(EnumNotificationType),
|
|
6387
|
-
required: true,
|
|
6388
|
-
type: String
|
|
6389
|
-
},
|
|
6390
|
-
userId: {
|
|
6391
|
-
ref: "User",
|
|
6392
|
-
required: true,
|
|
6393
|
-
type: mongoose7.Schema.Types.ObjectId
|
|
6394
|
-
}
|
|
6395
|
-
},
|
|
6396
|
-
{ timestamps: true }
|
|
6397
|
-
);
|
|
6398
|
-
schema3.index({ isRead: 1, userId: 1 });
|
|
6399
|
-
schema3.index({ createdAt: -1, userId: 1 });
|
|
6400
|
-
var NotificationModel = mongoose7.models.Notification || mongoose7.model("Notification", schema3);
|
|
6401
|
-
|
|
6402
|
-
// src/mongoose/PushToken.ts
|
|
6403
|
-
import mongoose8 from "mongoose";
|
|
6404
|
-
var MongooseSchema7 = mongoose8.Schema;
|
|
6405
|
-
var schema4 = new MongooseSchema7(
|
|
6406
|
-
{
|
|
6407
|
-
platform: {
|
|
6408
|
-
enum: Object.values(EnumOSPlatform),
|
|
6409
|
-
required: true,
|
|
6410
|
-
type: String
|
|
6411
|
-
},
|
|
6412
|
-
token: { required: true, type: String },
|
|
6413
|
-
userId: { required: true, type: mongoose8.Schema.Types.ObjectId }
|
|
6414
|
-
},
|
|
6415
|
-
{ timestamps: true }
|
|
6416
|
-
);
|
|
6417
|
-
var PushTokenModel = mongoose8.models.PushToken || mongoose8.model("PushToken", schema4);
|
|
6418
|
-
|
|
6419
|
-
// src/mongoose/ResourceActivity.ts
|
|
6420
|
-
import mongoose9 from "mongoose";
|
|
6421
|
-
var MongooseSchema8 = mongoose9.Schema;
|
|
6422
|
-
var ActivitySchema = new MongooseSchema8(
|
|
6423
|
-
{
|
|
6424
|
-
activityType: {
|
|
6425
|
-
enum: Object.values(EnumActivity),
|
|
6426
|
-
required: true,
|
|
6427
|
-
type: String
|
|
6428
|
-
},
|
|
6429
|
-
location: {
|
|
6430
|
-
coordinates: {
|
|
6431
|
-
required: false,
|
|
6432
|
-
type: [Number]
|
|
6433
|
-
},
|
|
6434
|
-
type: {
|
|
6435
|
-
default: "Point",
|
|
6436
|
-
enum: ["Point"],
|
|
6437
|
-
required: false,
|
|
6438
|
-
type: String
|
|
6439
|
-
}
|
|
6440
|
-
},
|
|
6441
|
-
startDate: { required: false, type: String },
|
|
6442
|
-
startTime: { required: false, type: String },
|
|
6443
|
-
timestamp: { default: Date.now, type: Date },
|
|
6444
|
-
userAgent: {
|
|
6445
|
-
enum: Object.values(EnumOSPlatform),
|
|
6446
|
-
required: true,
|
|
6447
|
-
type: String
|
|
6448
|
-
},
|
|
6449
|
-
userId: { required: false, type: String }
|
|
6450
|
-
},
|
|
6451
|
-
{ _id: false }
|
|
6452
|
-
);
|
|
6453
|
-
var schema5 = new MongooseSchema8(
|
|
6454
|
-
{
|
|
6455
|
-
activity: { default: [], type: [ActivitySchema] },
|
|
6456
|
-
resourceId: { required: true, type: String },
|
|
6457
|
-
resourceType: {
|
|
6458
|
-
enum: Object.values(EnumResourceType),
|
|
6459
|
-
required: true,
|
|
6460
|
-
type: String
|
|
6461
|
-
}
|
|
6462
|
-
},
|
|
6463
|
-
{ timestamps: true }
|
|
6464
|
-
);
|
|
6465
|
-
schema5.index({ resourceId: 1, resourceType: 1 }, { unique: true });
|
|
6466
|
-
schema5.index({ "views.location": "2dsphere" });
|
|
6467
|
-
var ResourceActivityModel = mongoose9.models.ResourceActivity || mongoose9.model("ResourceActivity", schema5);
|
|
6468
|
-
|
|
6469
|
-
// src/mongoose/Testers.ts
|
|
6470
|
-
import mongoose10 from "mongoose";
|
|
6471
|
-
var MongooseSchema9 = mongoose10.Schema;
|
|
6472
|
-
var TesterSchema = new MongooseSchema9(
|
|
6473
|
-
{
|
|
6474
|
-
active: { default: false, required: true, type: Boolean },
|
|
6475
|
-
categories: [CategorySchema],
|
|
6476
|
-
companyName: { required: true, type: String },
|
|
6477
|
-
email: { required: true, type: String },
|
|
6478
|
-
firstName: { required: true, type: String },
|
|
6479
|
-
lastName: { required: true, type: String },
|
|
6480
|
-
osType: {
|
|
6481
|
-
enum: Object.values(EnumOSPlatform),
|
|
6482
|
-
required: true,
|
|
6483
|
-
type: String
|
|
6484
|
-
},
|
|
6485
|
-
region: { required: true, type: String },
|
|
6486
|
-
resourceType: {
|
|
6487
|
-
enum: Object.values(EnumResourceType),
|
|
6488
|
-
required: true,
|
|
6489
|
-
type: String
|
|
6490
|
-
}
|
|
6491
|
-
},
|
|
6492
|
-
{
|
|
6493
|
-
timestamps: true
|
|
6494
|
-
}
|
|
6495
|
-
);
|
|
6496
|
-
var TesterModel = mongoose10.models.Tester || mongoose10.model("Tester", TesterSchema);
|
|
6497
|
-
|
|
6498
|
-
// src/mongoose/User.ts
|
|
6499
|
-
import mongoose11 from "mongoose";
|
|
6500
|
-
var MongooseSchema10 = mongoose11.Schema;
|
|
6501
|
-
var userActivityEventSchema = new MongooseSchema10(
|
|
6502
|
-
{
|
|
6503
|
-
resourceId: {
|
|
6504
|
-
ref: "Event",
|
|
6505
|
-
required: false,
|
|
6506
|
-
type: mongoose11.Schema.Types.ObjectId
|
|
6507
|
-
},
|
|
6508
|
-
startDate: { required: false, type: String },
|
|
6509
|
-
startTime: { required: false, type: String }
|
|
6510
|
-
},
|
|
6511
|
-
{ _id: false }
|
|
6512
|
-
);
|
|
6513
|
-
var userActivityFavouritesSchema = new MongooseSchema10(
|
|
6514
|
-
{
|
|
6515
|
-
events: {
|
|
6516
|
-
ref: "Event",
|
|
6517
|
-
required: false,
|
|
6518
|
-
type: [mongoose11.Schema.Types.ObjectId]
|
|
6519
|
-
},
|
|
6520
|
-
vendors: {
|
|
6521
|
-
ref: "Vendor",
|
|
6522
|
-
required: false,
|
|
6523
|
-
type: [mongoose11.Schema.Types.ObjectId]
|
|
6524
|
-
}
|
|
6525
|
-
},
|
|
6526
|
-
{ _id: false }
|
|
6527
|
-
);
|
|
6528
|
-
var schema6 = new MongooseSchema10(
|
|
6529
|
-
{
|
|
6530
|
-
active: { default: false, required: true, type: Boolean },
|
|
6531
|
-
avatar: ResourceImageTypeSchema,
|
|
6532
|
-
deletedAt: { default: null, required: false, type: Date },
|
|
6533
|
-
email: { required: true, type: String },
|
|
6534
|
-
events: {
|
|
6535
|
-
ref: "Event",
|
|
6536
|
-
required: false,
|
|
6537
|
-
type: [mongoose11.Schema.Types.ObjectId]
|
|
6538
|
-
},
|
|
6539
|
-
firstName: { required: true, type: String },
|
|
6540
|
-
isTester: { default: false, required: false, type: Boolean },
|
|
6541
|
-
lastName: { required: true, type: String },
|
|
6542
|
-
licences: {
|
|
6543
|
-
enum: Object.values(EnumUserLicence),
|
|
6544
|
-
required: false,
|
|
6545
|
-
type: [String]
|
|
6546
|
-
},
|
|
6547
|
-
partners: {
|
|
6548
|
-
required: false,
|
|
6549
|
-
type: [partnersSchema]
|
|
6550
|
-
},
|
|
6551
|
-
password: { required: true, type: String },
|
|
6552
|
-
platform: {
|
|
6553
|
-
enum: Object.values(EnumOSPlatform),
|
|
6554
|
-
required: false,
|
|
6555
|
-
type: String
|
|
6556
|
-
},
|
|
6557
|
-
preferredRegion: {
|
|
6558
|
-
required: true,
|
|
6559
|
-
type: String
|
|
6560
|
-
},
|
|
6561
|
-
refreshToken: {
|
|
6562
|
-
required: false,
|
|
6563
|
-
type: String
|
|
6564
|
-
},
|
|
6565
|
-
role: {
|
|
6566
|
-
default: "customer" /* CUSTOMER */,
|
|
6567
|
-
enum: Object.values(EnumUserRole),
|
|
6568
|
-
required: true,
|
|
6569
|
-
type: String
|
|
6570
|
-
},
|
|
6571
|
-
termsAgreement: termsAgreementSchema,
|
|
6572
|
-
userActivity: {
|
|
6573
|
-
favourites: {
|
|
6574
|
-
default: () => ({ events: [], vendors: [] }),
|
|
6575
|
-
type: userActivityFavouritesSchema
|
|
6576
|
-
},
|
|
6577
|
-
going: {
|
|
6578
|
-
events: [userActivityEventSchema]
|
|
6579
|
-
},
|
|
6580
|
-
interested: {
|
|
6581
|
-
events: [userActivityEventSchema]
|
|
6582
|
-
},
|
|
6583
|
-
present: {
|
|
6584
|
-
events: [userActivityEventSchema]
|
|
6585
|
-
}
|
|
6586
|
-
},
|
|
6587
|
-
vendor: {
|
|
6588
|
-
ref: "Vendor",
|
|
6589
|
-
required: false,
|
|
6590
|
-
type: mongoose11.Schema.Types.ObjectId
|
|
6591
|
-
}
|
|
6592
|
-
},
|
|
6593
|
-
{ timestamps: true }
|
|
6594
|
-
);
|
|
6595
|
-
schema6.index({ "partners.email": 1 });
|
|
6596
|
-
var UserModel = mongoose11.models.User || mongoose11.model("User", schema6);
|
|
6597
|
-
|
|
6598
|
-
// src/mongoose/VerificationToken.ts
|
|
6599
|
-
import mongoose12 from "mongoose";
|
|
6600
|
-
var MongooseSchema11 = mongoose12.Schema;
|
|
6601
|
-
var schema7 = new MongooseSchema11(
|
|
6602
|
-
{
|
|
6603
|
-
createdAt: {
|
|
6604
|
-
default: Date.now,
|
|
6605
|
-
expires: 24 * 60 * 60,
|
|
6606
|
-
// 24 hours in seconds (MongoDB TTL expects seconds)
|
|
6607
|
-
required: true,
|
|
6608
|
-
type: Date
|
|
6609
|
-
},
|
|
6610
|
-
// Token expires after 1 day
|
|
6611
|
-
email: { required: true, type: String },
|
|
6612
|
-
verificationToken: { required: true, type: String }
|
|
6613
|
-
},
|
|
6614
|
-
{ timestamps: true }
|
|
6615
|
-
);
|
|
6616
|
-
var VerificationTokenModel = mongoose12.models.VerificationToken || mongoose12.model("VerificationToken", schema7);
|
|
6617
|
-
|
|
6618
|
-
// src/mongoose/vendor/Vendor.ts
|
|
6619
|
-
import mongoose13 from "mongoose";
|
|
6620
|
-
var MongooseSchema12 = mongoose13.Schema;
|
|
6621
|
-
var MenuTypeSchema = new MongooseSchema12(
|
|
6622
|
-
{
|
|
6623
|
-
description: { required: false, type: String },
|
|
6624
|
-
name: { required: false, type: String },
|
|
6625
|
-
price: { required: false, type: Number },
|
|
6626
|
-
productGroups: { required: false, type: [String] }
|
|
6627
|
-
},
|
|
6628
|
-
{ _id: false }
|
|
6629
|
-
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
6630
|
-
);
|
|
6631
|
-
var LocationsSchema = new MongooseSchema12(
|
|
6632
|
-
{
|
|
6633
|
-
dateTime: {
|
|
6634
|
-
endDate: { required: false, type: String },
|
|
6635
|
-
endTime: { required: false, type: String },
|
|
6636
|
-
startDate: { required: false, type: String },
|
|
6637
|
-
startTime: { required: false, type: String }
|
|
6638
|
-
},
|
|
6639
|
-
description: { required: false, type: String },
|
|
6640
|
-
location: {
|
|
6641
|
-
city: { required: false, type: String },
|
|
6642
|
-
coordinates: {
|
|
6643
|
-
required: false,
|
|
6644
|
-
type: [Number]
|
|
6645
|
-
// [longitude, latitude]
|
|
6646
|
-
},
|
|
6647
|
-
country: { required: false, type: String },
|
|
6648
|
-
fullAddress: { required: false, type: String },
|
|
6649
|
-
latitude: { required: false, type: Number },
|
|
6650
|
-
longitude: { required: false, type: Number },
|
|
6651
|
-
region: { required: false, type: String },
|
|
6652
|
-
type: { required: false, type: String }
|
|
6653
|
-
// Mongoose GeoJSON type
|
|
6654
|
-
}
|
|
6655
|
-
},
|
|
6656
|
-
{ _id: false }
|
|
6657
|
-
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
6658
|
-
);
|
|
6659
|
-
var schema8 = new MongooseSchema12(
|
|
6660
|
-
{
|
|
6661
|
-
...baseResourceFields,
|
|
6662
|
-
// Importing base resource fields from global.ts
|
|
6663
|
-
availability: {
|
|
6664
|
-
corporate: { default: false, required: false, type: Boolean },
|
|
6665
|
-
private: { default: false, required: false, type: Boolean },
|
|
6666
|
-
school: { default: false, required: false, type: Boolean }
|
|
6667
|
-
},
|
|
6668
|
-
categories: [CategorySchema],
|
|
6669
|
-
locations: [LocationsSchema],
|
|
6670
|
-
multiLocation: { required: true, type: Boolean },
|
|
6671
|
-
products: [MenuTypeSchema],
|
|
6672
|
-
vendorInfoId: {
|
|
6673
|
-
ref: "VendorInfo",
|
|
6674
|
-
required: false,
|
|
6675
|
-
type: mongoose13.Schema.Types.ObjectId
|
|
6676
|
-
},
|
|
6677
|
-
vendorType: {
|
|
6678
|
-
enum: Object.values(EnumVendorType),
|
|
6679
|
-
required: true,
|
|
6680
|
-
type: String
|
|
6681
|
-
}
|
|
6682
|
-
},
|
|
6683
|
-
{ timestamps: true }
|
|
6684
|
-
);
|
|
6685
|
-
schema8.index({ name: 1 });
|
|
6686
|
-
schema8.index({ description: 1 });
|
|
6687
|
-
schema8.index({ region: 1 });
|
|
6688
|
-
schema8.index({ "categories.name": 1 });
|
|
6689
|
-
schema8.index({ "partners.email": 1 });
|
|
6690
|
-
var VendorModel = mongoose13.models.Vendor || mongoose13.model("Vendor", schema8);
|
|
6691
|
-
|
|
6692
|
-
// src/mongoose/vendor/VendorInfo.ts
|
|
6693
|
-
import mongoose14 from "mongoose";
|
|
6694
|
-
var MongooseSchema13 = mongoose14.Schema;
|
|
6695
|
-
var AttributesSchema = new MongooseSchema13(
|
|
6696
|
-
{
|
|
6697
|
-
details: { required: false, type: String },
|
|
6698
|
-
isRequired: { default: false, required: true, type: Boolean }
|
|
6699
|
-
},
|
|
6700
|
-
{ _id: false }
|
|
6701
|
-
);
|
|
6702
|
-
var schema9 = new MongooseSchema13(
|
|
6703
|
-
{
|
|
6704
|
-
compliance: {
|
|
6705
|
-
foodBeverageLicense: { default: false, required: false, type: Boolean },
|
|
6706
|
-
liabilityInsurance: { default: false, required: false, type: Boolean }
|
|
6707
|
-
},
|
|
6708
|
-
documents: [ResourceImageTypeSchema],
|
|
6709
|
-
product: {
|
|
6710
|
-
foodFlavors: {
|
|
6711
|
-
enum: Object.values(EnumFoodFlavor),
|
|
6712
|
-
required: true,
|
|
6713
|
-
type: [String]
|
|
6714
|
-
},
|
|
6715
|
-
packaging: { required: true, type: [String] },
|
|
6716
|
-
priceRange: {
|
|
6717
|
-
max: { required: true, type: Number },
|
|
6718
|
-
min: { required: true, type: Number }
|
|
6719
|
-
},
|
|
6720
|
-
producedIn: { required: true, type: [String] }
|
|
6721
|
-
},
|
|
6722
|
-
requirements: {
|
|
6723
|
-
electricity: AttributesSchema,
|
|
6724
|
-
gazebo: AttributesSchema,
|
|
6725
|
-
table: AttributesSchema
|
|
6726
|
-
},
|
|
6727
|
-
stallInfo: {
|
|
6728
|
-
size: {
|
|
6729
|
-
depth: { required: true, type: Number },
|
|
6730
|
-
width: { required: true, type: Number }
|
|
6731
|
-
}
|
|
6732
|
-
},
|
|
6733
|
-
vendorId: {
|
|
6734
|
-
ref: "Vendor",
|
|
6735
|
-
required: true,
|
|
6736
|
-
type: mongoose14.Schema.Types.ObjectId
|
|
6737
|
-
}
|
|
6738
|
-
},
|
|
6739
|
-
{ timestamps: true }
|
|
6740
|
-
);
|
|
6741
|
-
var VendorInfoModel = mongoose14.models.VendorInfo || mongoose14.model("VendorInfo", schema9);
|
|
6742
|
-
|
|
6743
|
-
// src/mongoose/event/Event.ts
|
|
6744
|
-
import mongoose15 from "mongoose";
|
|
6745
|
-
var MongooseSchema14 = mongoose15.Schema;
|
|
6746
|
-
var locationsSchema = new MongooseSchema14(
|
|
6747
|
-
{
|
|
6748
|
-
city: { required: true, type: String },
|
|
6749
|
-
coordinates: {
|
|
6750
|
-
required: true,
|
|
6751
|
-
type: [Number]
|
|
6752
|
-
// [longitude, latitude]
|
|
6753
|
-
},
|
|
6754
|
-
country: { required: true, type: String },
|
|
6755
|
-
fullAddress: { required: true, type: String },
|
|
6756
|
-
latitude: { required: true, type: Number },
|
|
6757
|
-
longitude: { required: true, type: Number },
|
|
6758
|
-
region: { required: true, type: String },
|
|
6759
|
-
type: {
|
|
6760
|
-
default: "Point",
|
|
6761
|
-
enum: ["Point"],
|
|
6762
|
-
required: true,
|
|
6763
|
-
type: String
|
|
6764
|
-
}
|
|
6765
|
-
},
|
|
6766
|
-
{ _id: false }
|
|
6767
|
-
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
6768
|
-
);
|
|
6769
|
-
var dateTimeSchema3 = new MongooseSchema14(
|
|
6770
|
-
{
|
|
6771
|
-
endDate: { required: true, type: String },
|
|
6772
|
-
endTime: { required: true, type: String },
|
|
6773
|
-
startDate: { required: true, type: String },
|
|
6774
|
-
startTime: { required: true, type: String }
|
|
6775
|
-
},
|
|
6776
|
-
{ _id: false }
|
|
6777
|
-
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
6778
|
-
);
|
|
6779
|
-
var schema10 = new MongooseSchema14(
|
|
6780
|
-
{
|
|
6781
|
-
...baseResourceFields,
|
|
6782
|
-
// Importing base resource fields from global.ts
|
|
6783
|
-
dateTime: [dateTimeSchema3],
|
|
6784
|
-
eventInfoId: {
|
|
6785
|
-
ref: "EventInfo",
|
|
6786
|
-
required: false,
|
|
6787
|
-
type: mongoose15.Schema.Types.ObjectId
|
|
6788
|
-
},
|
|
6789
|
-
eventType: {
|
|
6790
|
-
enum: Object.values(EnumEventType),
|
|
6791
|
-
required: true,
|
|
6792
|
-
type: String
|
|
6793
|
-
},
|
|
6794
|
-
location: {
|
|
6795
|
-
required: true,
|
|
6796
|
-
type: locationsSchema
|
|
6797
|
-
},
|
|
6798
|
-
nzbn: { required: true, type: String },
|
|
6799
|
-
provider: { required: false, type: String },
|
|
6800
|
-
rainOrShine: { required: true, type: Boolean },
|
|
6801
|
-
tags: { required: true, type: [String] }
|
|
6802
|
-
},
|
|
6803
|
-
{ timestamps: true }
|
|
6804
|
-
);
|
|
6805
|
-
schema10.index({ name: 1 });
|
|
6806
|
-
schema10.index({ description: 1 });
|
|
6807
|
-
schema10.index({ region: 1 });
|
|
6808
|
-
schema10.index({ location: "2dsphere" });
|
|
6809
|
-
schema10.index({ tags: 1 });
|
|
6810
|
-
schema10.index({ "partners.email": 1 });
|
|
6811
|
-
var EventModel = mongoose15.models.Event || mongoose15.model("Event", schema10);
|
|
6812
|
-
|
|
6813
|
-
// src/service/database.ts
|
|
6814
|
-
import mongoose16 from "mongoose";
|
|
6815
|
-
|
|
6816
|
-
// src/service/timezonePlugin.ts
|
|
6817
|
-
import dayjs3 from "dayjs";
|
|
6818
|
-
import timezone2 from "dayjs/plugin/timezone";
|
|
6819
|
-
import utc2 from "dayjs/plugin/utc";
|
|
6820
|
-
dayjs3.extend(utc2);
|
|
6821
|
-
dayjs3.extend(timezone2);
|
|
6822
|
-
function timezonePlugin(schema11) {
|
|
6823
|
-
if (!schema11.get("timestamps")) return;
|
|
6824
|
-
const transform = (_doc, ret) => {
|
|
6825
|
-
if (ret.createdAt)
|
|
6826
|
-
ret.createdAt = dayjs3(ret.createdAt).tz("Pacific/Auckland").format();
|
|
6827
|
-
if (ret.updatedAt)
|
|
6828
|
-
ret.updatedAt = dayjs3(ret.updatedAt).tz("Pacific/Auckland").format();
|
|
6829
|
-
return ret;
|
|
6830
|
-
};
|
|
6831
|
-
schema11.set("toJSON", { transform });
|
|
6832
|
-
schema11.set("toObject", { transform });
|
|
6833
|
-
}
|
|
6834
|
-
|
|
6835
|
-
// src/service/database.ts
|
|
6836
|
-
mongoose16.plugin(timezonePlugin);
|
|
6837
|
-
var connectToDatabase = async ({
|
|
6838
|
-
appName,
|
|
6839
|
-
dbName,
|
|
6840
|
-
dbPassword,
|
|
6841
|
-
dbUser,
|
|
6842
|
-
mongodbUri
|
|
6843
|
-
}) => {
|
|
6844
|
-
try {
|
|
6845
|
-
const mongoUri = mongodbUri ? mongodbUri : (
|
|
6846
|
-
// Fallback to MongoDB Atlas connection string
|
|
6847
|
-
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
6848
|
-
);
|
|
6849
|
-
await mongoose16.connect(mongoUri);
|
|
6850
|
-
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
6851
|
-
console.log(
|
|
6852
|
-
`${connectionType} connected from server/src/service/database.ts`
|
|
6853
|
-
);
|
|
6854
|
-
} catch (err) {
|
|
6855
|
-
console.error("Error connecting to MongoDB:", err);
|
|
6856
|
-
throw err;
|
|
6857
|
-
}
|
|
6858
|
-
};
|
|
6859
|
-
|
|
6860
|
-
// src/service/saveNotificationsInDb.ts
|
|
6861
|
-
async function saveNotificationsInDb(payload) {
|
|
6862
|
-
const { data, message, title, type, userIds } = payload;
|
|
6863
|
-
try {
|
|
6864
|
-
const notifications = userIds.map((userId) => ({
|
|
6865
|
-
data,
|
|
6866
|
-
isRead: false,
|
|
6867
|
-
message,
|
|
6868
|
-
title,
|
|
6869
|
-
type,
|
|
6870
|
-
userId
|
|
6871
|
-
}));
|
|
6872
|
-
await NotificationModel.insertMany(notifications);
|
|
6873
|
-
console.log(
|
|
6874
|
-
`Created ${notifications.length} notifications for ${userIds.length} users`
|
|
6875
|
-
);
|
|
6876
|
-
return [...new Set(userIds)];
|
|
6877
|
-
} catch (error) {
|
|
6878
|
-
console.error("Failed to create notifications:", error);
|
|
6879
|
-
return [];
|
|
6880
|
-
}
|
|
6881
|
-
}
|
|
6882
|
-
|
|
6883
|
-
// src/service/sendPushNotifications.ts
|
|
6884
|
-
import { Expo } from "expo-server-sdk";
|
|
6885
|
-
var expo = new Expo();
|
|
6886
|
-
function extractTokensFromMessage(message) {
|
|
6887
|
-
return Array.isArray(message.to) ? message.to : [message.to];
|
|
6888
|
-
}
|
|
6889
|
-
function createPushMessages({
|
|
6890
|
-
tokens,
|
|
6891
|
-
message,
|
|
6892
|
-
title,
|
|
6893
|
-
data
|
|
6894
|
-
}) {
|
|
6895
|
-
const messages = [];
|
|
6896
|
-
const invalidTokens = [];
|
|
6897
|
-
for (const token of tokens) {
|
|
6898
|
-
if (!Expo.isExpoPushToken(token)) {
|
|
6899
|
-
invalidTokens.push(token);
|
|
6900
|
-
continue;
|
|
6901
|
-
}
|
|
6902
|
-
messages.push({
|
|
6903
|
-
body: message,
|
|
6904
|
-
data: { ...data },
|
|
6905
|
-
sound: "default",
|
|
6906
|
-
title,
|
|
6907
|
-
to: token
|
|
6908
|
-
});
|
|
6909
|
-
}
|
|
6910
|
-
return { invalidTokens, messages };
|
|
6911
|
-
}
|
|
6912
|
-
function processChunkResults(tickets, chunk) {
|
|
6913
|
-
let successCount = 0;
|
|
6914
|
-
const failedTokens = [];
|
|
6915
|
-
for (const [ticketIndex, ticket] of tickets.entries()) {
|
|
6916
|
-
if (ticket.status === "error") {
|
|
6917
|
-
const message = chunk[ticketIndex];
|
|
6918
|
-
if (message) {
|
|
6919
|
-
const tokens = extractTokensFromMessage(message);
|
|
6920
|
-
if (ticket.details?.error === "DeviceNotRegistered") {
|
|
6921
|
-
failedTokens.push(...tokens);
|
|
6922
|
-
}
|
|
6923
|
-
console.log("Push notification error", {
|
|
6924
|
-
error: ticket.details?.error,
|
|
6925
|
-
tokens
|
|
6926
|
-
});
|
|
6927
|
-
}
|
|
6928
|
-
} else {
|
|
6929
|
-
successCount++;
|
|
6930
|
-
}
|
|
6931
|
-
}
|
|
6932
|
-
return { failedTokens, successCount };
|
|
6933
|
-
}
|
|
6934
|
-
async function sendChunk(chunk, chunkIndex) {
|
|
6935
|
-
try {
|
|
6936
|
-
const tickets = await expo.sendPushNotificationsAsync(chunk);
|
|
6937
|
-
const { successCount, failedTokens } = processChunkResults(tickets, chunk);
|
|
6938
|
-
console.log(
|
|
6939
|
-
`Chunk ${chunkIndex + 1}: Sent ${successCount}/${chunk.length} notifications successfully`
|
|
6940
|
-
);
|
|
6941
|
-
return { failedTokens, successCount };
|
|
6942
|
-
} catch (error) {
|
|
6943
|
-
console.log("Error sending Expo push notification chunk", {
|
|
6944
|
-
chunkIndex,
|
|
6945
|
-
chunkSize: chunk.length,
|
|
6946
|
-
error: error instanceof Error ? error.message : String(error)
|
|
6947
|
-
});
|
|
6948
|
-
return { failedTokens: [], successCount: 0 };
|
|
6949
|
-
}
|
|
6950
|
-
}
|
|
6951
|
-
async function sendPushNotifications({
|
|
6952
|
-
data,
|
|
6953
|
-
message,
|
|
6954
|
-
title,
|
|
6955
|
-
userIds
|
|
6956
|
-
}) {
|
|
6957
|
-
const pushTokens = await PushTokenModel.find({ userId: { $in: userIds } });
|
|
6958
|
-
const expoTokens = pushTokens.map((token) => token.token);
|
|
6959
|
-
if (!data) return;
|
|
6960
|
-
const { messages, invalidTokens } = createPushMessages({
|
|
6961
|
-
data,
|
|
6962
|
-
message,
|
|
6963
|
-
title,
|
|
6964
|
-
tokens: expoTokens
|
|
6965
|
-
});
|
|
6966
|
-
if (invalidTokens.length > 0) {
|
|
6967
|
-
console.log(`Found ${invalidTokens.length} invalid push tokens`);
|
|
6968
|
-
}
|
|
6969
|
-
if (messages.length === 0) {
|
|
6970
|
-
console.log("No valid messages to send after filtering tokens");
|
|
6971
|
-
return;
|
|
6972
|
-
}
|
|
6973
|
-
const chunks = expo.chunkPushNotifications(messages);
|
|
6974
|
-
let totalSuccessCount = 0;
|
|
6975
|
-
const allFailedTokens = [];
|
|
6976
|
-
for (const [chunkIndex, chunk] of chunks.entries()) {
|
|
6977
|
-
const { successCount, failedTokens } = await sendChunk(
|
|
6978
|
-
chunk,
|
|
6979
|
-
chunkIndex + 1
|
|
6980
|
-
);
|
|
6981
|
-
totalSuccessCount += successCount;
|
|
6982
|
-
allFailedTokens.push(...failedTokens);
|
|
6983
|
-
}
|
|
6984
|
-
console.log(
|
|
6985
|
-
`Sent push notification to ${totalSuccessCount}/${messages.length} tokens across ${chunks.length} chunks`
|
|
6986
|
-
);
|
|
6987
|
-
if (allFailedTokens.length > 0) {
|
|
6988
|
-
console.log(`Found ${allFailedTokens.length} failed push tokens`);
|
|
6989
|
-
}
|
|
6990
|
-
}
|
|
6991
|
-
|
|
6992
5931
|
// src/storage/index.ts
|
|
6993
5932
|
var SAVED_PASSWORD_KEY = "savedPassword";
|
|
6994
5933
|
var SAVED_EMAIL_KEY = "savedEmail";
|
|
@@ -7033,10 +5972,17 @@ var fonts = {
|
|
|
7033
5972
|
fontWeight: "400"
|
|
7034
5973
|
}
|
|
7035
5974
|
};
|
|
5975
|
+
|
|
5976
|
+
// src/types/resourceActivities.ts
|
|
5977
|
+
var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
|
|
5978
|
+
EnumActivity2["FAVORITE"] = "FAVORITE";
|
|
5979
|
+
EnumActivity2["GOING"] = "GOING";
|
|
5980
|
+
EnumActivity2["INTERESTED"] = "INTERESTED";
|
|
5981
|
+
EnumActivity2["PRESENT"] = "PRESENT";
|
|
5982
|
+
EnumActivity2["VIEW"] = "VIEW";
|
|
5983
|
+
return EnumActivity2;
|
|
5984
|
+
})(EnumActivity || {});
|
|
7036
5985
|
export {
|
|
7037
|
-
AdModel,
|
|
7038
|
-
CategorySchema,
|
|
7039
|
-
ChatModel,
|
|
7040
5986
|
EnumActivity,
|
|
7041
5987
|
EnumAdShowOn,
|
|
7042
5988
|
EnumAdStatus,
|
|
@@ -7050,7 +5996,6 @@ export {
|
|
|
7050
5996
|
EnumNotificationType,
|
|
7051
5997
|
EnumOSPlatform,
|
|
7052
5998
|
EnumPaymentMethod,
|
|
7053
|
-
EnumPubSubEvents,
|
|
7054
5999
|
EnumRegions,
|
|
7055
6000
|
EnumRelationResource,
|
|
7056
6001
|
EnumResourceType,
|
|
@@ -7058,38 +6003,20 @@ export {
|
|
|
7058
6003
|
EnumUserLicence,
|
|
7059
6004
|
EnumUserRole,
|
|
7060
6005
|
EnumVendorType,
|
|
7061
|
-
EventInfoModel,
|
|
7062
|
-
EventModel,
|
|
7063
6006
|
ImageTypeEnum,
|
|
7064
|
-
NotificationModel,
|
|
7065
|
-
ParticipantSchema,
|
|
7066
|
-
PushTokenModel,
|
|
7067
|
-
RelationModel,
|
|
7068
|
-
RelationTypeSchema,
|
|
7069
|
-
ResourceActivityModel,
|
|
7070
|
-
ResourceImageTypeSchema,
|
|
7071
6007
|
SAVED_EMAIL_KEY,
|
|
7072
6008
|
SAVED_PASSWORD_KEY,
|
|
7073
6009
|
SAVED_REFRESH_TOKEN_KEY,
|
|
7074
6010
|
SAVED_TOKEN_KEY,
|
|
7075
|
-
SocialMediaTypeSchema,
|
|
7076
|
-
StallTypeSchema,
|
|
7077
|
-
TesterModel,
|
|
7078
6011
|
USER_STORAGE_KEY,
|
|
7079
|
-
UserModel,
|
|
7080
|
-
VendorInfoModel,
|
|
7081
|
-
VendorModel,
|
|
7082
|
-
VerificationTokenModel,
|
|
7083
6012
|
availableCategories,
|
|
7084
6013
|
availableCityOptions,
|
|
7085
6014
|
availableRegionOptions,
|
|
7086
6015
|
availableRegionTypes,
|
|
7087
6016
|
availableTagTypes,
|
|
7088
|
-
baseResourceFields,
|
|
7089
6017
|
capitalizeFirstLetter,
|
|
7090
6018
|
categoryColors,
|
|
7091
6019
|
companyContactFields,
|
|
7092
|
-
connectToDatabase,
|
|
7093
6020
|
contactUsFields,
|
|
7094
6021
|
darkColors,
|
|
7095
6022
|
dateFormat,
|
|
@@ -7115,28 +6042,22 @@ export {
|
|
|
7115
6042
|
loginFields,
|
|
7116
6043
|
mapArrayToOptions,
|
|
7117
6044
|
mapBaseResourceTypeToFormData,
|
|
7118
|
-
mongoose,
|
|
7119
6045
|
normalizeUrl,
|
|
7120
6046
|
packagingOptions,
|
|
7121
|
-
partnersSchema,
|
|
7122
6047
|
paymentMethodOptions,
|
|
7123
6048
|
producedIngOptions,
|
|
7124
6049
|
productLabelGroups,
|
|
7125
6050
|
profileFields,
|
|
7126
6051
|
registerFields,
|
|
7127
|
-
relationDatesSchema,
|
|
7128
6052
|
removeTypename,
|
|
7129
6053
|
requestPasswordResetFields,
|
|
7130
6054
|
requirementsOptions,
|
|
7131
6055
|
resetPasswordFields,
|
|
7132
|
-
saveNotificationsInDb,
|
|
7133
|
-
sendPushNotifications,
|
|
7134
6056
|
socialMediaFields,
|
|
7135
6057
|
sortDatesChronologically,
|
|
7136
6058
|
stallTypeOptions,
|
|
7137
6059
|
statusOptions,
|
|
7138
6060
|
tagOptions,
|
|
7139
|
-
termsAgreementSchema,
|
|
7140
6061
|
testersFields,
|
|
7141
6062
|
timeFormat,
|
|
7142
6063
|
truncateText,
|