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