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