@timardex/cluemart-server-shared 1.0.132 → 1.0.133
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/{chunk-OBW4LAAG.mjs → chunk-JDM7WL6D.mjs} +212 -100
- package/dist/chunk-JDM7WL6D.mjs.map +1 -0
- package/dist/index.cjs +218 -104
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +101 -60
- package/dist/index.d.ts +101 -60
- package/dist/index.mjs +216 -104
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +212 -98
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +101 -60
- package/dist/mongoose/index.d.ts +101 -60
- package/dist/mongoose/index.mjs +5 -1
- package/dist/service/index.cjs +210 -100
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-OBW4LAAG.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -4677,10 +4677,10 @@ var Condition = class _Condition {
|
|
|
4677
4677
|
otherwise
|
|
4678
4678
|
} = config;
|
|
4679
4679
|
let check = typeof is === "function" ? is : (...values) => values.every((value) => value === is);
|
|
4680
|
-
return new _Condition(refs, (values,
|
|
4680
|
+
return new _Condition(refs, (values, schema16) => {
|
|
4681
4681
|
var _branch;
|
|
4682
4682
|
let branch = check(...values) ? then : otherwise;
|
|
4683
|
-
return (_branch = branch == null ? void 0 : branch(
|
|
4683
|
+
return (_branch = branch == null ? void 0 : branch(schema16)) != null ? _branch : schema16;
|
|
4684
4684
|
});
|
|
4685
4685
|
}
|
|
4686
4686
|
constructor(refs, builder) {
|
|
@@ -4694,13 +4694,13 @@ var Condition = class _Condition {
|
|
|
4694
4694
|
// TODO: ? operator here?
|
|
4695
4695
|
ref.getValue(options == null ? void 0 : options.value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context)
|
|
4696
4696
|
));
|
|
4697
|
-
let
|
|
4698
|
-
if (
|
|
4699
|
-
|
|
4697
|
+
let schema16 = this.fn(values, base, options);
|
|
4698
|
+
if (schema16 === void 0 || // @ts-ignore this can be base
|
|
4699
|
+
schema16 === base) {
|
|
4700
4700
|
return base;
|
|
4701
4701
|
}
|
|
4702
|
-
if (!isSchema(
|
|
4703
|
-
return
|
|
4702
|
+
if (!isSchema(schema16)) throw new TypeError("conditions must return a schema object");
|
|
4703
|
+
return schema16.resolve(options);
|
|
4704
4704
|
}
|
|
4705
4705
|
};
|
|
4706
4706
|
var prefixes = {
|
|
@@ -4770,7 +4770,7 @@ function createValidation(config) {
|
|
|
4770
4770
|
path = "",
|
|
4771
4771
|
options,
|
|
4772
4772
|
originalValue,
|
|
4773
|
-
schema:
|
|
4773
|
+
schema: schema16
|
|
4774
4774
|
}, panic, next) {
|
|
4775
4775
|
const {
|
|
4776
4776
|
name,
|
|
@@ -4782,8 +4782,8 @@ function createValidation(config) {
|
|
|
4782
4782
|
let {
|
|
4783
4783
|
parent,
|
|
4784
4784
|
context,
|
|
4785
|
-
abortEarly =
|
|
4786
|
-
disableStackTrace =
|
|
4785
|
+
abortEarly = schema16.spec.abortEarly,
|
|
4786
|
+
disableStackTrace = schema16.spec.disableStackTrace
|
|
4787
4787
|
} = options;
|
|
4788
4788
|
function resolve(item) {
|
|
4789
4789
|
return Reference.isRef(item) ? item.getValue(value, parent, context) : item;
|
|
@@ -4792,9 +4792,9 @@ function createValidation(config) {
|
|
|
4792
4792
|
const nextParams = Object.assign({
|
|
4793
4793
|
value,
|
|
4794
4794
|
originalValue,
|
|
4795
|
-
label:
|
|
4795
|
+
label: schema16.spec.label,
|
|
4796
4796
|
path: overrides.path || path,
|
|
4797
|
-
spec:
|
|
4797
|
+
spec: schema16.spec,
|
|
4798
4798
|
disableStackTrace: overrides.disableStackTrace || disableStackTrace
|
|
4799
4799
|
}, params, overrides.params);
|
|
4800
4800
|
for (const key of Object.keys(nextParams)) nextParams[key] = resolve(nextParams[key]);
|
|
@@ -4812,7 +4812,7 @@ function createValidation(config) {
|
|
|
4812
4812
|
resolve,
|
|
4813
4813
|
options,
|
|
4814
4814
|
originalValue,
|
|
4815
|
-
schema:
|
|
4815
|
+
schema: schema16
|
|
4816
4816
|
};
|
|
4817
4817
|
const handleResult = (validOrError) => {
|
|
4818
4818
|
if (ValidationError.isError(validOrError)) invalid(validOrError);
|
|
@@ -4846,42 +4846,42 @@ function createValidation(config) {
|
|
|
4846
4846
|
validate.OPTIONS = config;
|
|
4847
4847
|
return validate;
|
|
4848
4848
|
}
|
|
4849
|
-
function getIn(
|
|
4849
|
+
function getIn(schema16, path, value, context = value) {
|
|
4850
4850
|
let parent, lastPart, lastPartDebug;
|
|
4851
4851
|
if (!path) return {
|
|
4852
4852
|
parent,
|
|
4853
4853
|
parentPath: path,
|
|
4854
|
-
schema:
|
|
4854
|
+
schema: schema16
|
|
4855
4855
|
};
|
|
4856
4856
|
(0, import_property_expr.forEach)(path, (_part, isBracket, isArray) => {
|
|
4857
4857
|
let part = isBracket ? _part.slice(1, _part.length - 1) : _part;
|
|
4858
|
-
|
|
4858
|
+
schema16 = schema16.resolve({
|
|
4859
4859
|
context,
|
|
4860
4860
|
parent,
|
|
4861
4861
|
value
|
|
4862
4862
|
});
|
|
4863
|
-
let isTuple =
|
|
4863
|
+
let isTuple = schema16.type === "tuple";
|
|
4864
4864
|
let idx = isArray ? parseInt(part, 10) : 0;
|
|
4865
|
-
if (
|
|
4865
|
+
if (schema16.innerType || isTuple) {
|
|
4866
4866
|
if (isTuple && !isArray) throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${lastPartDebug}" must contain an index to the tuple element, e.g. "${lastPartDebug}[0]"`);
|
|
4867
4867
|
if (value && idx >= value.length) {
|
|
4868
4868
|
throw new Error(`Yup.reach cannot resolve an array item at index: ${_part}, in the path: ${path}. because there is no value at that index. `);
|
|
4869
4869
|
}
|
|
4870
4870
|
parent = value;
|
|
4871
4871
|
value = value && value[idx];
|
|
4872
|
-
|
|
4872
|
+
schema16 = isTuple ? schema16.spec.types[idx] : schema16.innerType;
|
|
4873
4873
|
}
|
|
4874
4874
|
if (!isArray) {
|
|
4875
|
-
if (!
|
|
4875
|
+
if (!schema16.fields || !schema16.fields[part]) throw new Error(`The schema does not contain the path: ${path}. (failed at: ${lastPartDebug} which is a type: "${schema16.type}")`);
|
|
4876
4876
|
parent = value;
|
|
4877
4877
|
value = value && value[part];
|
|
4878
|
-
|
|
4878
|
+
schema16 = schema16.fields[part];
|
|
4879
4879
|
}
|
|
4880
4880
|
lastPart = part;
|
|
4881
4881
|
lastPartDebug = isBracket ? "[" + _part + "]" : "." + _part;
|
|
4882
4882
|
});
|
|
4883
4883
|
return {
|
|
4884
|
-
schema:
|
|
4884
|
+
schema: schema16,
|
|
4885
4885
|
parent,
|
|
4886
4886
|
parentPath: lastPart
|
|
4887
4887
|
};
|
|
@@ -5018,20 +5018,20 @@ var Schema = class {
|
|
|
5018
5018
|
this._mutate = before;
|
|
5019
5019
|
return result;
|
|
5020
5020
|
}
|
|
5021
|
-
concat(
|
|
5022
|
-
if (!
|
|
5023
|
-
if (
|
|
5021
|
+
concat(schema16) {
|
|
5022
|
+
if (!schema16 || schema16 === this) return this;
|
|
5023
|
+
if (schema16.type !== this.type && this.type !== "mixed") throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${schema16.type}`);
|
|
5024
5024
|
let base = this;
|
|
5025
|
-
let combined =
|
|
5025
|
+
let combined = schema16.clone();
|
|
5026
5026
|
const mergedSpec = Object.assign({}, base.spec, combined.spec);
|
|
5027
5027
|
combined.spec = mergedSpec;
|
|
5028
5028
|
combined.internalTests = Object.assign({}, base.internalTests, combined.internalTests);
|
|
5029
|
-
combined._whitelist = base._whitelist.merge(
|
|
5030
|
-
combined._blacklist = base._blacklist.merge(
|
|
5029
|
+
combined._whitelist = base._whitelist.merge(schema16._whitelist, schema16._blacklist);
|
|
5030
|
+
combined._blacklist = base._blacklist.merge(schema16._blacklist, schema16._whitelist);
|
|
5031
5031
|
combined.tests = base.tests;
|
|
5032
5032
|
combined.exclusiveTests = base.exclusiveTests;
|
|
5033
5033
|
combined.withMutation((next) => {
|
|
5034
|
-
|
|
5034
|
+
schema16.tests.forEach((fn) => {
|
|
5035
5035
|
next.test(fn.OPTIONS);
|
|
5036
5036
|
});
|
|
5037
5037
|
});
|
|
@@ -5047,15 +5047,15 @@ var Schema = class {
|
|
|
5047
5047
|
return this._typeCheck(v);
|
|
5048
5048
|
}
|
|
5049
5049
|
resolve(options) {
|
|
5050
|
-
let
|
|
5051
|
-
if (
|
|
5052
|
-
let conditions =
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5050
|
+
let schema16 = this;
|
|
5051
|
+
if (schema16.conditions.length) {
|
|
5052
|
+
let conditions = schema16.conditions;
|
|
5053
|
+
schema16 = schema16.clone();
|
|
5054
|
+
schema16.conditions = [];
|
|
5055
|
+
schema16 = conditions.reduce((prevSchema, condition) => condition.resolve(prevSchema, options), schema16);
|
|
5056
|
+
schema16 = schema16.resolve(options);
|
|
5057
5057
|
}
|
|
5058
|
-
return
|
|
5058
|
+
return schema16;
|
|
5059
5059
|
}
|
|
5060
5060
|
resolveOptions(options) {
|
|
5061
5061
|
var _options$strict, _options$abortEarly, _options$recursive, _options$disableStack;
|
|
@@ -5209,11 +5209,11 @@ attempted value: ${formattedValue}
|
|
|
5209
5209
|
}
|
|
5210
5210
|
validate(value, options) {
|
|
5211
5211
|
var _options$disableStack2;
|
|
5212
|
-
let
|
|
5212
|
+
let schema16 = this.resolve(Object.assign({}, options, {
|
|
5213
5213
|
value
|
|
5214
5214
|
}));
|
|
5215
|
-
let disableStackTrace = (_options$disableStack2 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack2 :
|
|
5216
|
-
return new Promise((resolve, reject) =>
|
|
5215
|
+
let disableStackTrace = (_options$disableStack2 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack2 : schema16.spec.disableStackTrace;
|
|
5216
|
+
return new Promise((resolve, reject) => schema16._validate(value, options, (error, parsed) => {
|
|
5217
5217
|
if (ValidationError.isError(error)) error.value = parsed;
|
|
5218
5218
|
reject(error);
|
|
5219
5219
|
}, (errors, validated) => {
|
|
@@ -5223,12 +5223,12 @@ attempted value: ${formattedValue}
|
|
|
5223
5223
|
}
|
|
5224
5224
|
validateSync(value, options) {
|
|
5225
5225
|
var _options$disableStack3;
|
|
5226
|
-
let
|
|
5226
|
+
let schema16 = this.resolve(Object.assign({}, options, {
|
|
5227
5227
|
value
|
|
5228
5228
|
}));
|
|
5229
5229
|
let result;
|
|
5230
|
-
let disableStackTrace = (_options$disableStack3 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack3 :
|
|
5231
|
-
|
|
5230
|
+
let disableStackTrace = (_options$disableStack3 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack3 : schema16.spec.disableStackTrace;
|
|
5231
|
+
schema16._validate(value, Object.assign({}, options, {
|
|
5232
5232
|
sync: true
|
|
5233
5233
|
}), (error, parsed) => {
|
|
5234
5234
|
if (ValidationError.isError(error)) error.value = parsed;
|
|
@@ -5262,8 +5262,8 @@ attempted value: ${formattedValue}
|
|
|
5262
5262
|
return typeof defaultValue === "function" ? defaultValue.call(this, options) : clone(defaultValue);
|
|
5263
5263
|
}
|
|
5264
5264
|
getDefault(options) {
|
|
5265
|
-
let
|
|
5266
|
-
return
|
|
5265
|
+
let schema16 = this.resolve(options || {});
|
|
5266
|
+
return schema16._getDefault(options);
|
|
5267
5267
|
}
|
|
5268
5268
|
default(def) {
|
|
5269
5269
|
if (arguments.length === 0) {
|
|
@@ -5498,9 +5498,9 @@ for (const method of ["validate", "validateSync"]) Schema.prototype[`${method}At
|
|
|
5498
5498
|
const {
|
|
5499
5499
|
parent,
|
|
5500
5500
|
parentPath,
|
|
5501
|
-
schema:
|
|
5501
|
+
schema: schema16
|
|
5502
5502
|
} = getIn(this, path, value, options.context);
|
|
5503
|
-
return
|
|
5503
|
+
return schema16[method](parent && parent[parentPath], Object.assign({}, options, {
|
|
5504
5504
|
parent,
|
|
5505
5505
|
path
|
|
5506
5506
|
}));
|
|
@@ -5674,7 +5674,7 @@ var StringSchema = class extends Schema {
|
|
|
5674
5674
|
});
|
|
5675
5675
|
}
|
|
5676
5676
|
required(message) {
|
|
5677
|
-
return super.required(message).withMutation((
|
|
5677
|
+
return super.required(message).withMutation((schema16) => schema16.test({
|
|
5678
5678
|
message: message || mixed.required,
|
|
5679
5679
|
name: "required",
|
|
5680
5680
|
skipAbsent: true,
|
|
@@ -5682,9 +5682,9 @@ var StringSchema = class extends Schema {
|
|
|
5682
5682
|
}));
|
|
5683
5683
|
}
|
|
5684
5684
|
notRequired() {
|
|
5685
|
-
return super.notRequired().withMutation((
|
|
5686
|
-
|
|
5687
|
-
return
|
|
5685
|
+
return super.notRequired().withMutation((schema16) => {
|
|
5686
|
+
schema16.tests = schema16.tests.filter((t) => t.OPTIONS.name !== "required");
|
|
5687
|
+
return schema16;
|
|
5688
5688
|
});
|
|
5689
5689
|
}
|
|
5690
5690
|
length(length, message = string.length) {
|
|
@@ -6073,28 +6073,28 @@ var parseJson = (value, _, ctx) => {
|
|
|
6073
6073
|
}
|
|
6074
6074
|
return ctx.isType(parsed) ? parsed : value;
|
|
6075
6075
|
};
|
|
6076
|
-
function deepPartial(
|
|
6077
|
-
if ("fields" in
|
|
6076
|
+
function deepPartial(schema16) {
|
|
6077
|
+
if ("fields" in schema16) {
|
|
6078
6078
|
const partial = {};
|
|
6079
|
-
for (const [key, fieldSchema] of Object.entries(
|
|
6079
|
+
for (const [key, fieldSchema] of Object.entries(schema16.fields)) {
|
|
6080
6080
|
partial[key] = deepPartial(fieldSchema);
|
|
6081
6081
|
}
|
|
6082
|
-
return
|
|
6082
|
+
return schema16.setFields(partial);
|
|
6083
6083
|
}
|
|
6084
|
-
if (
|
|
6085
|
-
const nextArray =
|
|
6084
|
+
if (schema16.type === "array") {
|
|
6085
|
+
const nextArray = schema16.optional();
|
|
6086
6086
|
if (nextArray.innerType) nextArray.innerType = deepPartial(nextArray.innerType);
|
|
6087
6087
|
return nextArray;
|
|
6088
6088
|
}
|
|
6089
|
-
if (
|
|
6090
|
-
return
|
|
6091
|
-
types:
|
|
6089
|
+
if (schema16.type === "tuple") {
|
|
6090
|
+
return schema16.optional().clone({
|
|
6091
|
+
types: schema16.spec.types.map(deepPartial)
|
|
6092
6092
|
});
|
|
6093
6093
|
}
|
|
6094
|
-
if ("optional" in
|
|
6095
|
-
return
|
|
6094
|
+
if ("optional" in schema16) {
|
|
6095
|
+
return schema16.optional();
|
|
6096
6096
|
}
|
|
6097
|
-
return
|
|
6097
|
+
return schema16;
|
|
6098
6098
|
}
|
|
6099
6099
|
var deepHas = (obj, p) => {
|
|
6100
6100
|
const path = [...(0, import_property_expr.normalizePath)(p)];
|
|
@@ -6228,8 +6228,8 @@ var ObjectSchema = class extends Schema {
|
|
|
6228
6228
|
next._sortErrors = this._sortErrors;
|
|
6229
6229
|
return next;
|
|
6230
6230
|
}
|
|
6231
|
-
concat(
|
|
6232
|
-
let next = super.concat(
|
|
6231
|
+
concat(schema16) {
|
|
6232
|
+
let next = super.concat(schema16);
|
|
6233
6233
|
let nextFields = next.fields;
|
|
6234
6234
|
for (let [field, schemaOrRef] of Object.entries(this.fields)) {
|
|
6235
6235
|
const target = nextFields[field];
|
|
@@ -6237,7 +6237,7 @@ var ObjectSchema = class extends Schema {
|
|
|
6237
6237
|
}
|
|
6238
6238
|
return next.withMutation((s) => (
|
|
6239
6239
|
// XXX: excludes here is wrong
|
|
6240
|
-
s.setFields(nextFields, [...this._excludedEdges, ...
|
|
6240
|
+
s.setFields(nextFields, [...this._excludedEdges, ...schema16._excludedEdges])
|
|
6241
6241
|
));
|
|
6242
6242
|
}
|
|
6243
6243
|
_getDefault(options) {
|
|
@@ -6282,8 +6282,8 @@ var ObjectSchema = class extends Schema {
|
|
|
6282
6282
|
}
|
|
6283
6283
|
partial() {
|
|
6284
6284
|
const partial = {};
|
|
6285
|
-
for (const [key,
|
|
6286
|
-
partial[key] = "optional" in
|
|
6285
|
+
for (const [key, schema16] of Object.entries(this.fields)) {
|
|
6286
|
+
partial[key] = "optional" in schema16 && schema16.optional instanceof Function ? schema16.optional() : schema16;
|
|
6287
6287
|
}
|
|
6288
6288
|
return this.setFields(partial);
|
|
6289
6289
|
}
|
|
@@ -6481,22 +6481,22 @@ var ArraySchema = class extends Schema {
|
|
|
6481
6481
|
json() {
|
|
6482
6482
|
return this.transform(parseJson);
|
|
6483
6483
|
}
|
|
6484
|
-
concat(
|
|
6485
|
-
let next = super.concat(
|
|
6484
|
+
concat(schema16) {
|
|
6485
|
+
let next = super.concat(schema16);
|
|
6486
6486
|
next.innerType = this.innerType;
|
|
6487
|
-
if (
|
|
6487
|
+
if (schema16.innerType)
|
|
6488
6488
|
next.innerType = next.innerType ? (
|
|
6489
6489
|
// @ts-expect-error Lazy doesn't have concat and will break
|
|
6490
|
-
next.innerType.concat(
|
|
6491
|
-
) :
|
|
6490
|
+
next.innerType.concat(schema16.innerType)
|
|
6491
|
+
) : schema16.innerType;
|
|
6492
6492
|
return next;
|
|
6493
6493
|
}
|
|
6494
|
-
of(
|
|
6494
|
+
of(schema16) {
|
|
6495
6495
|
let next = this.clone();
|
|
6496
|
-
if (!isSchema(
|
|
6497
|
-
next.innerType =
|
|
6496
|
+
if (!isSchema(schema16)) throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: " + printValue(schema16));
|
|
6497
|
+
next.innerType = schema16;
|
|
6498
6498
|
next.spec = Object.assign({}, next.spec, {
|
|
6499
|
-
types:
|
|
6499
|
+
types: schema16
|
|
6500
6500
|
});
|
|
6501
6501
|
return next;
|
|
6502
6502
|
}
|
|
@@ -6640,7 +6640,7 @@ var TupleSchema = class extends Schema {
|
|
|
6640
6640
|
describe(options) {
|
|
6641
6641
|
const next = (options ? this.resolve(options) : this).clone();
|
|
6642
6642
|
const base = super.describe(options);
|
|
6643
|
-
base.innerType = next.spec.types.map((
|
|
6643
|
+
base.innerType = next.spec.types.map((schema16, index) => {
|
|
6644
6644
|
var _innerOptions;
|
|
6645
6645
|
let innerOptions = options;
|
|
6646
6646
|
if ((_innerOptions = innerOptions) != null && _innerOptions.value) {
|
|
@@ -6649,7 +6649,7 @@ var TupleSchema = class extends Schema {
|
|
|
6649
6649
|
value: innerOptions.value[index]
|
|
6650
6650
|
});
|
|
6651
6651
|
}
|
|
6652
|
-
return
|
|
6652
|
+
return schema16.describe(innerOptions);
|
|
6653
6653
|
});
|
|
6654
6654
|
return base;
|
|
6655
6655
|
}
|
|
@@ -6666,6 +6666,7 @@ var import_react2 = __toESM(require_react(), 1);
|
|
|
6666
6666
|
var React8 = __toESM(require_react(), 1);
|
|
6667
6667
|
var import_react3 = __toESM(require_react(), 1);
|
|
6668
6668
|
var import_react4 = __toESM(require_react(), 1);
|
|
6669
|
+
var import_react5 = __toESM(require_react(), 1);
|
|
6669
6670
|
var EnumInviteStatus = /* @__PURE__ */ ((EnumInviteStatus22) => {
|
|
6670
6671
|
EnumInviteStatus22["ACCEPTED"] = "Accepted";
|
|
6671
6672
|
EnumInviteStatus22["COMPLETED"] = "Completed";
|
|
@@ -8290,6 +8291,7 @@ var USER_FIELDS_FRAGMENT = gql`
|
|
|
8290
8291
|
promoCodes
|
|
8291
8292
|
refreshToken
|
|
8292
8293
|
role
|
|
8294
|
+
school
|
|
8293
8295
|
termsAgreement {
|
|
8294
8296
|
...TermsAgreementFields
|
|
8295
8297
|
}
|
|
@@ -10128,6 +10130,75 @@ var UPDATE_DAILY_CLUE_MUTATION = gql`
|
|
|
10128
10130
|
}
|
|
10129
10131
|
${GAME_DOC_FIELDS_FRAGMENT}
|
|
10130
10132
|
`;
|
|
10133
|
+
var SCHOOL = gql`
|
|
10134
|
+
fragment SchoolFields on SchoolType {
|
|
10135
|
+
_id
|
|
10136
|
+
active
|
|
10137
|
+
contactDetails {
|
|
10138
|
+
...ContactDetailsFields
|
|
10139
|
+
}
|
|
10140
|
+
location {
|
|
10141
|
+
...LocationFields
|
|
10142
|
+
}
|
|
10143
|
+
createdAt
|
|
10144
|
+
deletedAt
|
|
10145
|
+
logo {
|
|
10146
|
+
...ResourceImageFields
|
|
10147
|
+
}
|
|
10148
|
+
name
|
|
10149
|
+
owner {
|
|
10150
|
+
...OwnerFields
|
|
10151
|
+
}
|
|
10152
|
+
region
|
|
10153
|
+
studentCount
|
|
10154
|
+
termsAgreement {
|
|
10155
|
+
...TermsAgreementFields
|
|
10156
|
+
}
|
|
10157
|
+
updatedAt
|
|
10158
|
+
}
|
|
10159
|
+
${OWNER_FIELDS_FRAGMENT}
|
|
10160
|
+
${LOCATION_FIELDS_FRAGMENT}
|
|
10161
|
+
${RESOURCE_IMAGE_FIELDS_FRAGMENT}
|
|
10162
|
+
${CONTACT_DETAILS_FIELDS_FRAGMENT}
|
|
10163
|
+
${TERMS_AGREEMENT_FIELDS_FRAGMENT}
|
|
10164
|
+
`;
|
|
10165
|
+
var GET_SCHOOL = gql`
|
|
10166
|
+
query getSchool($_id: ID!) {
|
|
10167
|
+
school(_id: $_id) {
|
|
10168
|
+
...SchoolFields
|
|
10169
|
+
}
|
|
10170
|
+
}
|
|
10171
|
+
${SCHOOL}
|
|
10172
|
+
`;
|
|
10173
|
+
var GET_SCHOOLS = gql`
|
|
10174
|
+
query getSchools {
|
|
10175
|
+
schools {
|
|
10176
|
+
...SchoolFields
|
|
10177
|
+
}
|
|
10178
|
+
}
|
|
10179
|
+
${SCHOOL}
|
|
10180
|
+
`;
|
|
10181
|
+
var CREATE_SCHOOL_MUTATION = gql`
|
|
10182
|
+
mutation createSchool($input: SchoolInputType!) {
|
|
10183
|
+
createSchool(input: $input) {
|
|
10184
|
+
...SchoolFields
|
|
10185
|
+
}
|
|
10186
|
+
}
|
|
10187
|
+
${SCHOOL}
|
|
10188
|
+
`;
|
|
10189
|
+
var UPDATE_SCHOOL_MUTATION = gql`
|
|
10190
|
+
mutation updateSchool($_id: ID!, $input: SchoolInputType!) {
|
|
10191
|
+
updateSchool(_id: $_id, input: $input) {
|
|
10192
|
+
...SchoolFields
|
|
10193
|
+
}
|
|
10194
|
+
}
|
|
10195
|
+
${SCHOOL}
|
|
10196
|
+
`;
|
|
10197
|
+
var DELETE_SCHOOL_MUTATION = gql`
|
|
10198
|
+
mutation deleteSchool($_id: ID!) {
|
|
10199
|
+
deleteSchool(_id: $_id)
|
|
10200
|
+
}
|
|
10201
|
+
`;
|
|
10131
10202
|
var nzBankAccountRegex = /^\d{2}-\d{4}-\d{7}-\d{2}$/;
|
|
10132
10203
|
var nzbnRegex = /^94\d{11}$/;
|
|
10133
10204
|
var normalizedUrlTransform = () => create$6().trim().transform(
|
|
@@ -10279,7 +10350,7 @@ var socialMediaSchema = create$3({
|
|
|
10279
10350
|
is: (name) => !!name,
|
|
10280
10351
|
// If name has a value
|
|
10281
10352
|
then: () => normalizedUrlTransform().required("Link is required when name is set").url("Link must be a valid URL").label("Social Media Link"),
|
|
10282
|
-
otherwise: (
|
|
10353
|
+
otherwise: (schema16) => schema16.notRequired()
|
|
10283
10354
|
})
|
|
10284
10355
|
});
|
|
10285
10356
|
var globalResourceSchema = create$3().shape({
|
|
@@ -10355,21 +10426,21 @@ var paymentInfoSchema = create$3({
|
|
|
10355
10426
|
).required("Please select a Payment method"),
|
|
10356
10427
|
accountHolderName: create$6().when("paymentMethod", {
|
|
10357
10428
|
is: "bank_transfer",
|
|
10358
|
-
then: (
|
|
10359
|
-
otherwise: (
|
|
10429
|
+
then: (schema16) => schema16.required("Account holder name is required for bank transfer").trim(),
|
|
10430
|
+
otherwise: (schema16) => schema16.notRequired()
|
|
10360
10431
|
}),
|
|
10361
10432
|
accountNumber: create$6().when("paymentMethod", {
|
|
10362
10433
|
is: "bank_transfer",
|
|
10363
|
-
then: (
|
|
10434
|
+
then: (schema16) => schema16.required("Account number is required for bank transfer").matches(
|
|
10364
10435
|
nzBankAccountRegex,
|
|
10365
10436
|
"Account number must be in format: XX-XXXX-XXXXXXX-XX"
|
|
10366
10437
|
).trim(),
|
|
10367
|
-
otherwise: (
|
|
10438
|
+
otherwise: (schema16) => schema16.notRequired()
|
|
10368
10439
|
}),
|
|
10369
10440
|
link: create$6().when("paymentMethod", {
|
|
10370
10441
|
is: (val) => val === "paypal" || val === "stripe",
|
|
10371
10442
|
then: () => normalizedUrlTransform().url("Link must be a valid URL").required("Link is required for PayPal/Stripe"),
|
|
10372
|
-
otherwise: (
|
|
10443
|
+
otherwise: (schema16) => schema16.notRequired()
|
|
10373
10444
|
})
|
|
10374
10445
|
});
|
|
10375
10446
|
var eventInfoSchema = create$3().shape({
|
|
@@ -10519,16 +10590,16 @@ var vendorInfoSchema = create$3().shape({
|
|
|
10519
10590
|
var userSchema = create$3().shape({
|
|
10520
10591
|
active: create$7().required("Active is required"),
|
|
10521
10592
|
email: emailRequiredSchema,
|
|
10522
|
-
firstName: create$6().label("First Name").required("First name is required"),
|
|
10523
|
-
lastName: create$6().label("Last Name").required("Last name is required"),
|
|
10593
|
+
firstName: create$6().label("First Name").trim().required("First name is required"),
|
|
10594
|
+
lastName: create$6().label("Last Name").trim().required("Last name is required"),
|
|
10524
10595
|
isTester: create$7().required("Tester status is required"),
|
|
10525
10596
|
password: create$6().nullable().trim().label("Password").min(8, "Password must be at least 8 characters long").notRequired(),
|
|
10526
10597
|
preferredRegion: create$6().label("Preferred Region").required("Preferred region is required"),
|
|
10527
10598
|
confirmPassword: create$6().nullable().trim().label("Confirm Password").when("password", {
|
|
10528
10599
|
is: (val) => !!val,
|
|
10529
10600
|
// only necessary if password typed
|
|
10530
|
-
then: (
|
|
10531
|
-
otherwise: (
|
|
10601
|
+
then: (schema16) => schema16.required("Confirm Password is required").oneOf([create$9("password")], "Passwords must match"),
|
|
10602
|
+
otherwise: (schema16) => schema16.notRequired()
|
|
10532
10603
|
}),
|
|
10533
10604
|
role: create$8().oneOf(Object.values(EnumUserRole)).required("Role is required")
|
|
10534
10605
|
});
|
|
@@ -10599,7 +10670,7 @@ var adSchema = create$3().shape({
|
|
|
10599
10670
|
return endDate > now;
|
|
10600
10671
|
}).when("start", {
|
|
10601
10672
|
is: (val) => val && val.length > 0,
|
|
10602
|
-
then: (
|
|
10673
|
+
then: (schema16) => schema16.test(
|
|
10603
10674
|
"is-after-start",
|
|
10604
10675
|
"End date must be after start date",
|
|
10605
10676
|
function(value) {
|
|
@@ -10743,6 +10814,14 @@ var contactUsSchema = create$3().shape({
|
|
|
10743
10814
|
lastName: create$6().label("Last Name").required("Last name is required"),
|
|
10744
10815
|
message: create$6().label("Message").required("Message is required")
|
|
10745
10816
|
});
|
|
10817
|
+
var schoolSchema = create$3().shape({
|
|
10818
|
+
active: create$7().required("Active is required"),
|
|
10819
|
+
contactDetails: contactDetailsSchema,
|
|
10820
|
+
location: locationSchema,
|
|
10821
|
+
name: create$6().trim().required("Name is required"),
|
|
10822
|
+
region: create$6().trim().required("Region is required"),
|
|
10823
|
+
studentCount: create$5().label("Student Count").min(0, "Student count cannot be negative").required("Student count is required").test("no-leading-zeros", "", noLeadingZeros("Student Count"))
|
|
10824
|
+
});
|
|
10746
10825
|
var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
|
|
10747
10826
|
EnumActivity2["FAVORITE"] = "FAVORITE";
|
|
10748
10827
|
EnumActivity2["GOING"] = "GOING";
|
|
@@ -11310,27 +11389,27 @@ var baseResourceFields = {
|
|
|
11310
11389
|
required: false,
|
|
11311
11390
|
type: [associatesSchema]
|
|
11312
11391
|
},
|
|
11313
|
-
contactDetails: ContactDetailsSchema,
|
|
11392
|
+
contactDetails: { required: false, type: ContactDetailsSchema },
|
|
11314
11393
|
cover: {
|
|
11315
11394
|
required: true,
|
|
11316
11395
|
type: ResourceImageTypeSchema
|
|
11317
11396
|
},
|
|
11318
11397
|
deletedAt: { default: null, required: false, type: Date },
|
|
11319
11398
|
description: { required: true, type: String },
|
|
11320
|
-
images: [ResourceImageTypeSchema],
|
|
11321
|
-
logo: ResourceImageTypeSchema,
|
|
11399
|
+
images: { required: false, type: [ResourceImageTypeSchema] },
|
|
11400
|
+
logo: { required: false, type: ResourceImageTypeSchema },
|
|
11322
11401
|
name: { required: true, type: String },
|
|
11323
11402
|
owner: {
|
|
11324
11403
|
required: false,
|
|
11325
11404
|
type: OwnerTypeSchema
|
|
11326
11405
|
},
|
|
11327
|
-
posterUsage: PosterUsageTypeSchema,
|
|
11406
|
+
posterUsage: { required: false, type: PosterUsageTypeSchema },
|
|
11328
11407
|
promoCodes: { required: false, type: [String] },
|
|
11329
11408
|
rating: { required: false, type: Number },
|
|
11330
11409
|
region: { required: true, type: String },
|
|
11331
11410
|
reviewCount: { required: false, type: Number },
|
|
11332
|
-
socialMedia: [SocialMediaTypeSchema],
|
|
11333
|
-
termsAgreement: termsAgreementSchema
|
|
11411
|
+
socialMedia: { required: false, type: [SocialMediaTypeSchema] },
|
|
11412
|
+
termsAgreement: { required: true, type: termsAgreementSchema }
|
|
11334
11413
|
};
|
|
11335
11414
|
|
|
11336
11415
|
// src/mongoose/GoogleImportedMarket.ts
|
|
@@ -11643,6 +11722,11 @@ var schema7 = new MongooseSchema11(
|
|
|
11643
11722
|
required: true,
|
|
11644
11723
|
type: String
|
|
11645
11724
|
},
|
|
11725
|
+
school: {
|
|
11726
|
+
ref: "School",
|
|
11727
|
+
required: false,
|
|
11728
|
+
type: mongoose11.Schema.Types.ObjectId
|
|
11729
|
+
},
|
|
11646
11730
|
stripe: {
|
|
11647
11731
|
required: false,
|
|
11648
11732
|
type: stripeSchema
|
|
@@ -12033,9 +12117,9 @@ var gameDataSchemas = {
|
|
|
12033
12117
|
[EnumGameType.DAILY_CLUE]: schemaDailyClue
|
|
12034
12118
|
};
|
|
12035
12119
|
var gameDataDefinition = Object.fromEntries(
|
|
12036
|
-
Object.entries(gameDataSchemas).map(([key,
|
|
12120
|
+
Object.entries(gameDataSchemas).map(([key, schema16]) => [
|
|
12037
12121
|
key,
|
|
12038
|
-
{ default: null, required: false, type:
|
|
12122
|
+
{ default: null, required: false, type: schema16 }
|
|
12039
12123
|
])
|
|
12040
12124
|
);
|
|
12041
12125
|
var gameHistorySchema = new MongooseSchema19(
|
|
@@ -12083,8 +12167,34 @@ var schema14 = new MongooseSchema19(
|
|
|
12083
12167
|
);
|
|
12084
12168
|
var GameModel = mongoose19.models.Game || mongoose19.model("Game", schema14);
|
|
12085
12169
|
|
|
12086
|
-
// src/
|
|
12170
|
+
// src/mongoose/School.ts
|
|
12087
12171
|
import mongoose20 from "mongoose";
|
|
12172
|
+
var MongooseSchema20 = mongoose20.Schema;
|
|
12173
|
+
var schema15 = new MongooseSchema20(
|
|
12174
|
+
{
|
|
12175
|
+
active: { default: false, required: true, type: Boolean },
|
|
12176
|
+
contactDetails: { required: false, type: ContactDetailsSchema },
|
|
12177
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
12178
|
+
location: {
|
|
12179
|
+
required: true,
|
|
12180
|
+
type: locationsSchema
|
|
12181
|
+
},
|
|
12182
|
+
logo: { required: false, type: ResourceImageTypeSchema },
|
|
12183
|
+
name: { required: true, type: String },
|
|
12184
|
+
owner: {
|
|
12185
|
+
required: true,
|
|
12186
|
+
type: OwnerTypeSchema
|
|
12187
|
+
},
|
|
12188
|
+
region: { required: true, type: String },
|
|
12189
|
+
studentCount: { required: true, type: Number },
|
|
12190
|
+
termsAgreement: { required: true, type: termsAgreementSchema }
|
|
12191
|
+
},
|
|
12192
|
+
{ timestamps: true }
|
|
12193
|
+
);
|
|
12194
|
+
var SchoolModel = mongoose20.models.School || mongoose20.model("School", schema15);
|
|
12195
|
+
|
|
12196
|
+
// src/service/database.ts
|
|
12197
|
+
import mongoose21 from "mongoose";
|
|
12088
12198
|
var connectToDatabase = async ({
|
|
12089
12199
|
appName,
|
|
12090
12200
|
dbName,
|
|
@@ -12097,7 +12207,7 @@ var connectToDatabase = async ({
|
|
|
12097
12207
|
// Fallback to MongoDB Atlas connection string
|
|
12098
12208
|
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
12099
12209
|
);
|
|
12100
|
-
await
|
|
12210
|
+
await mongoose21.connect(mongoUri);
|
|
12101
12211
|
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
12102
12212
|
console.log(
|
|
12103
12213
|
`${connectionType} connected from server/src/service/database.ts`
|
|
@@ -12333,12 +12443,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
|
|
|
12333
12443
|
}
|
|
12334
12444
|
|
|
12335
12445
|
// src/service/objectIdToString.ts
|
|
12336
|
-
import
|
|
12446
|
+
import mongoose22 from "mongoose";
|
|
12337
12447
|
function convertObjectIdsToStrings(obj) {
|
|
12338
12448
|
if (obj === null || obj === void 0) {
|
|
12339
12449
|
return obj;
|
|
12340
12450
|
}
|
|
12341
|
-
if (obj instanceof
|
|
12451
|
+
if (obj instanceof mongoose22.Types.ObjectId) {
|
|
12342
12452
|
return obj.toString();
|
|
12343
12453
|
}
|
|
12344
12454
|
if (Array.isArray(obj)) {
|
|
@@ -12369,7 +12479,7 @@ async function findEventOrImportedMarketById(resourceId) {
|
|
|
12369
12479
|
|
|
12370
12480
|
// src/types/index.ts
|
|
12371
12481
|
import express from "express";
|
|
12372
|
-
import
|
|
12482
|
+
import mongoose23 from "mongoose";
|
|
12373
12483
|
var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
|
|
12374
12484
|
EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
|
|
12375
12485
|
EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
|
|
@@ -12384,6 +12494,7 @@ export {
|
|
|
12384
12494
|
CategorySchema,
|
|
12385
12495
|
ChatModel,
|
|
12386
12496
|
ChatReportModel,
|
|
12497
|
+
ContactDetailsSchema,
|
|
12387
12498
|
EnumPubSubEvents,
|
|
12388
12499
|
EventInfoModel,
|
|
12389
12500
|
EventModel,
|
|
@@ -12399,6 +12510,7 @@ export {
|
|
|
12399
12510
|
RelationTypeSchema,
|
|
12400
12511
|
ResourceActivityModel,
|
|
12401
12512
|
ResourceImageTypeSchema,
|
|
12513
|
+
SchoolModel,
|
|
12402
12514
|
SocialMediaTypeSchema,
|
|
12403
12515
|
StallTypeSchema,
|
|
12404
12516
|
UserModel,
|
|
@@ -12414,7 +12526,7 @@ export {
|
|
|
12414
12526
|
findEventOrImportedMarketById,
|
|
12415
12527
|
locationGeoSchema,
|
|
12416
12528
|
locationsSchema,
|
|
12417
|
-
|
|
12529
|
+
mongoose23 as mongoose,
|
|
12418
12530
|
refundPolicySchema,
|
|
12419
12531
|
relationDatesSchema,
|
|
12420
12532
|
resourceRelationsSchema,
|