@timardex/cluemart-server-shared 1.0.132 → 1.0.134
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-AMB6NVKD.mjs} +220 -100
- package/dist/chunk-AMB6NVKD.mjs.map +1 -0
- package/dist/index.cjs +226 -104
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +102 -60
- package/dist/index.d.ts +102 -60
- package/dist/index.mjs +224 -104
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +220 -98
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +102 -60
- package/dist/mongoose/index.d.ts +102 -60
- package/dist/mongoose/index.mjs +5 -1
- package/dist/service/index.cjs +218 -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,80 @@ 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
|
+
overallPoints
|
|
10153
|
+
region
|
|
10154
|
+
studentCount
|
|
10155
|
+
socialMedia {
|
|
10156
|
+
...SocialMediaFields
|
|
10157
|
+
}
|
|
10158
|
+
termsAgreement {
|
|
10159
|
+
...TermsAgreementFields
|
|
10160
|
+
}
|
|
10161
|
+
updatedAt
|
|
10162
|
+
}
|
|
10163
|
+
${OWNER_FIELDS_FRAGMENT}
|
|
10164
|
+
${LOCATION_FIELDS_FRAGMENT}
|
|
10165
|
+
${RESOURCE_IMAGE_FIELDS_FRAGMENT}
|
|
10166
|
+
${CONTACT_DETAILS_FIELDS_FRAGMENT}
|
|
10167
|
+
${TERMS_AGREEMENT_FIELDS_FRAGMENT}
|
|
10168
|
+
${SOCIAL_MEDIA_FIELDS_FRAGMENT}
|
|
10169
|
+
`;
|
|
10170
|
+
var GET_SCHOOL = gql`
|
|
10171
|
+
query getSchool($_id: ID!) {
|
|
10172
|
+
school(_id: $_id) {
|
|
10173
|
+
...SchoolFields
|
|
10174
|
+
}
|
|
10175
|
+
}
|
|
10176
|
+
${SCHOOL}
|
|
10177
|
+
`;
|
|
10178
|
+
var GET_SCHOOLS = gql`
|
|
10179
|
+
query getSchools {
|
|
10180
|
+
schools {
|
|
10181
|
+
...SchoolFields
|
|
10182
|
+
}
|
|
10183
|
+
}
|
|
10184
|
+
${SCHOOL}
|
|
10185
|
+
`;
|
|
10186
|
+
var CREATE_SCHOOL_MUTATION = gql`
|
|
10187
|
+
mutation createSchool($input: SchoolInputType!) {
|
|
10188
|
+
createSchool(input: $input) {
|
|
10189
|
+
...SchoolFields
|
|
10190
|
+
}
|
|
10191
|
+
}
|
|
10192
|
+
${SCHOOL}
|
|
10193
|
+
`;
|
|
10194
|
+
var UPDATE_SCHOOL_MUTATION = gql`
|
|
10195
|
+
mutation updateSchool($_id: ID!, $input: SchoolInputType!) {
|
|
10196
|
+
updateSchool(_id: $_id, input: $input) {
|
|
10197
|
+
...SchoolFields
|
|
10198
|
+
}
|
|
10199
|
+
}
|
|
10200
|
+
${SCHOOL}
|
|
10201
|
+
`;
|
|
10202
|
+
var DELETE_SCHOOL_MUTATION = gql`
|
|
10203
|
+
mutation deleteSchool($_id: ID!) {
|
|
10204
|
+
deleteSchool(_id: $_id)
|
|
10205
|
+
}
|
|
10206
|
+
`;
|
|
10131
10207
|
var nzBankAccountRegex = /^\d{2}-\d{4}-\d{7}-\d{2}$/;
|
|
10132
10208
|
var nzbnRegex = /^94\d{11}$/;
|
|
10133
10209
|
var normalizedUrlTransform = () => create$6().trim().transform(
|
|
@@ -10279,7 +10355,7 @@ var socialMediaSchema = create$3({
|
|
|
10279
10355
|
is: (name) => !!name,
|
|
10280
10356
|
// If name has a value
|
|
10281
10357
|
then: () => normalizedUrlTransform().required("Link is required when name is set").url("Link must be a valid URL").label("Social Media Link"),
|
|
10282
|
-
otherwise: (
|
|
10358
|
+
otherwise: (schema16) => schema16.notRequired()
|
|
10283
10359
|
})
|
|
10284
10360
|
});
|
|
10285
10361
|
var globalResourceSchema = create$3().shape({
|
|
@@ -10355,21 +10431,21 @@ var paymentInfoSchema = create$3({
|
|
|
10355
10431
|
).required("Please select a Payment method"),
|
|
10356
10432
|
accountHolderName: create$6().when("paymentMethod", {
|
|
10357
10433
|
is: "bank_transfer",
|
|
10358
|
-
then: (
|
|
10359
|
-
otherwise: (
|
|
10434
|
+
then: (schema16) => schema16.required("Account holder name is required for bank transfer").trim(),
|
|
10435
|
+
otherwise: (schema16) => schema16.notRequired()
|
|
10360
10436
|
}),
|
|
10361
10437
|
accountNumber: create$6().when("paymentMethod", {
|
|
10362
10438
|
is: "bank_transfer",
|
|
10363
|
-
then: (
|
|
10439
|
+
then: (schema16) => schema16.required("Account number is required for bank transfer").matches(
|
|
10364
10440
|
nzBankAccountRegex,
|
|
10365
10441
|
"Account number must be in format: XX-XXXX-XXXXXXX-XX"
|
|
10366
10442
|
).trim(),
|
|
10367
|
-
otherwise: (
|
|
10443
|
+
otherwise: (schema16) => schema16.notRequired()
|
|
10368
10444
|
}),
|
|
10369
10445
|
link: create$6().when("paymentMethod", {
|
|
10370
10446
|
is: (val) => val === "paypal" || val === "stripe",
|
|
10371
10447
|
then: () => normalizedUrlTransform().url("Link must be a valid URL").required("Link is required for PayPal/Stripe"),
|
|
10372
|
-
otherwise: (
|
|
10448
|
+
otherwise: (schema16) => schema16.notRequired()
|
|
10373
10449
|
})
|
|
10374
10450
|
});
|
|
10375
10451
|
var eventInfoSchema = create$3().shape({
|
|
@@ -10519,16 +10595,16 @@ var vendorInfoSchema = create$3().shape({
|
|
|
10519
10595
|
var userSchema = create$3().shape({
|
|
10520
10596
|
active: create$7().required("Active is required"),
|
|
10521
10597
|
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"),
|
|
10598
|
+
firstName: create$6().label("First Name").trim().required("First name is required"),
|
|
10599
|
+
lastName: create$6().label("Last Name").trim().required("Last name is required"),
|
|
10524
10600
|
isTester: create$7().required("Tester status is required"),
|
|
10525
10601
|
password: create$6().nullable().trim().label("Password").min(8, "Password must be at least 8 characters long").notRequired(),
|
|
10526
10602
|
preferredRegion: create$6().label("Preferred Region").required("Preferred region is required"),
|
|
10527
10603
|
confirmPassword: create$6().nullable().trim().label("Confirm Password").when("password", {
|
|
10528
10604
|
is: (val) => !!val,
|
|
10529
10605
|
// only necessary if password typed
|
|
10530
|
-
then: (
|
|
10531
|
-
otherwise: (
|
|
10606
|
+
then: (schema16) => schema16.required("Confirm Password is required").oneOf([create$9("password")], "Passwords must match"),
|
|
10607
|
+
otherwise: (schema16) => schema16.notRequired()
|
|
10532
10608
|
}),
|
|
10533
10609
|
role: create$8().oneOf(Object.values(EnumUserRole)).required("Role is required")
|
|
10534
10610
|
});
|
|
@@ -10599,7 +10675,7 @@ var adSchema = create$3().shape({
|
|
|
10599
10675
|
return endDate > now;
|
|
10600
10676
|
}).when("start", {
|
|
10601
10677
|
is: (val) => val && val.length > 0,
|
|
10602
|
-
then: (
|
|
10678
|
+
then: (schema16) => schema16.test(
|
|
10603
10679
|
"is-after-start",
|
|
10604
10680
|
"End date must be after start date",
|
|
10605
10681
|
function(value) {
|
|
@@ -10743,6 +10819,15 @@ var contactUsSchema = create$3().shape({
|
|
|
10743
10819
|
lastName: create$6().label("Last Name").required("Last name is required"),
|
|
10744
10820
|
message: create$6().label("Message").required("Message is required")
|
|
10745
10821
|
});
|
|
10822
|
+
var schoolSchema = create$3().shape({
|
|
10823
|
+
active: create$7().required("Active is required"),
|
|
10824
|
+
contactDetails: contactDetailsSchema,
|
|
10825
|
+
location: locationSchema,
|
|
10826
|
+
name: create$6().trim().required("Name is required"),
|
|
10827
|
+
region: create$6().trim().required("Region is required"),
|
|
10828
|
+
socialMedia: create$2().of(socialMediaSchema).nullable().default(null),
|
|
10829
|
+
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"))
|
|
10830
|
+
});
|
|
10746
10831
|
var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
|
|
10747
10832
|
EnumActivity2["FAVORITE"] = "FAVORITE";
|
|
10748
10833
|
EnumActivity2["GOING"] = "GOING";
|
|
@@ -11310,27 +11395,27 @@ var baseResourceFields = {
|
|
|
11310
11395
|
required: false,
|
|
11311
11396
|
type: [associatesSchema]
|
|
11312
11397
|
},
|
|
11313
|
-
contactDetails: ContactDetailsSchema,
|
|
11398
|
+
contactDetails: { required: false, type: ContactDetailsSchema },
|
|
11314
11399
|
cover: {
|
|
11315
11400
|
required: true,
|
|
11316
11401
|
type: ResourceImageTypeSchema
|
|
11317
11402
|
},
|
|
11318
11403
|
deletedAt: { default: null, required: false, type: Date },
|
|
11319
11404
|
description: { required: true, type: String },
|
|
11320
|
-
images: [ResourceImageTypeSchema],
|
|
11321
|
-
logo: ResourceImageTypeSchema,
|
|
11405
|
+
images: { required: false, type: [ResourceImageTypeSchema] },
|
|
11406
|
+
logo: { required: false, type: ResourceImageTypeSchema },
|
|
11322
11407
|
name: { required: true, type: String },
|
|
11323
11408
|
owner: {
|
|
11324
11409
|
required: false,
|
|
11325
11410
|
type: OwnerTypeSchema
|
|
11326
11411
|
},
|
|
11327
|
-
posterUsage: PosterUsageTypeSchema,
|
|
11412
|
+
posterUsage: { required: false, type: PosterUsageTypeSchema },
|
|
11328
11413
|
promoCodes: { required: false, type: [String] },
|
|
11329
11414
|
rating: { required: false, type: Number },
|
|
11330
11415
|
region: { required: true, type: String },
|
|
11331
11416
|
reviewCount: { required: false, type: Number },
|
|
11332
|
-
socialMedia: [SocialMediaTypeSchema],
|
|
11333
|
-
termsAgreement: termsAgreementSchema
|
|
11417
|
+
socialMedia: { required: false, type: [SocialMediaTypeSchema] },
|
|
11418
|
+
termsAgreement: { required: true, type: termsAgreementSchema }
|
|
11334
11419
|
};
|
|
11335
11420
|
|
|
11336
11421
|
// src/mongoose/GoogleImportedMarket.ts
|
|
@@ -11643,6 +11728,11 @@ var schema7 = new MongooseSchema11(
|
|
|
11643
11728
|
required: true,
|
|
11644
11729
|
type: String
|
|
11645
11730
|
},
|
|
11731
|
+
school: {
|
|
11732
|
+
ref: "School",
|
|
11733
|
+
required: false,
|
|
11734
|
+
type: mongoose11.Schema.Types.ObjectId
|
|
11735
|
+
},
|
|
11646
11736
|
stripe: {
|
|
11647
11737
|
required: false,
|
|
11648
11738
|
type: stripeSchema
|
|
@@ -12033,9 +12123,9 @@ var gameDataSchemas = {
|
|
|
12033
12123
|
[EnumGameType.DAILY_CLUE]: schemaDailyClue
|
|
12034
12124
|
};
|
|
12035
12125
|
var gameDataDefinition = Object.fromEntries(
|
|
12036
|
-
Object.entries(gameDataSchemas).map(([key,
|
|
12126
|
+
Object.entries(gameDataSchemas).map(([key, schema16]) => [
|
|
12037
12127
|
key,
|
|
12038
|
-
{ default: null, required: false, type:
|
|
12128
|
+
{ default: null, required: false, type: schema16 }
|
|
12039
12129
|
])
|
|
12040
12130
|
);
|
|
12041
12131
|
var gameHistorySchema = new MongooseSchema19(
|
|
@@ -12083,8 +12173,36 @@ var schema14 = new MongooseSchema19(
|
|
|
12083
12173
|
);
|
|
12084
12174
|
var GameModel = mongoose19.models.Game || mongoose19.model("Game", schema14);
|
|
12085
12175
|
|
|
12086
|
-
// src/
|
|
12176
|
+
// src/mongoose/School.ts
|
|
12087
12177
|
import mongoose20 from "mongoose";
|
|
12178
|
+
var MongooseSchema20 = mongoose20.Schema;
|
|
12179
|
+
var schema15 = new MongooseSchema20(
|
|
12180
|
+
{
|
|
12181
|
+
active: { default: false, required: true, type: Boolean },
|
|
12182
|
+
contactDetails: { required: false, type: ContactDetailsSchema },
|
|
12183
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
12184
|
+
location: {
|
|
12185
|
+
required: true,
|
|
12186
|
+
type: locationsSchema
|
|
12187
|
+
},
|
|
12188
|
+
logo: { required: false, type: ResourceImageTypeSchema },
|
|
12189
|
+
name: { required: true, type: String },
|
|
12190
|
+
overallPoints: { default: 0, required: false, type: Number },
|
|
12191
|
+
owner: {
|
|
12192
|
+
required: true,
|
|
12193
|
+
type: OwnerTypeSchema
|
|
12194
|
+
},
|
|
12195
|
+
region: { required: true, type: String },
|
|
12196
|
+
socialMedia: { required: false, type: [SocialMediaTypeSchema] },
|
|
12197
|
+
studentCount: { required: true, type: Number },
|
|
12198
|
+
termsAgreement: { required: true, type: termsAgreementSchema }
|
|
12199
|
+
},
|
|
12200
|
+
{ timestamps: true }
|
|
12201
|
+
);
|
|
12202
|
+
var SchoolModel = mongoose20.models.School || mongoose20.model("School", schema15);
|
|
12203
|
+
|
|
12204
|
+
// src/service/database.ts
|
|
12205
|
+
import mongoose21 from "mongoose";
|
|
12088
12206
|
var connectToDatabase = async ({
|
|
12089
12207
|
appName,
|
|
12090
12208
|
dbName,
|
|
@@ -12097,7 +12215,7 @@ var connectToDatabase = async ({
|
|
|
12097
12215
|
// Fallback to MongoDB Atlas connection string
|
|
12098
12216
|
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
12099
12217
|
);
|
|
12100
|
-
await
|
|
12218
|
+
await mongoose21.connect(mongoUri);
|
|
12101
12219
|
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
12102
12220
|
console.log(
|
|
12103
12221
|
`${connectionType} connected from server/src/service/database.ts`
|
|
@@ -12333,12 +12451,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
|
|
|
12333
12451
|
}
|
|
12334
12452
|
|
|
12335
12453
|
// src/service/objectIdToString.ts
|
|
12336
|
-
import
|
|
12454
|
+
import mongoose22 from "mongoose";
|
|
12337
12455
|
function convertObjectIdsToStrings(obj) {
|
|
12338
12456
|
if (obj === null || obj === void 0) {
|
|
12339
12457
|
return obj;
|
|
12340
12458
|
}
|
|
12341
|
-
if (obj instanceof
|
|
12459
|
+
if (obj instanceof mongoose22.Types.ObjectId) {
|
|
12342
12460
|
return obj.toString();
|
|
12343
12461
|
}
|
|
12344
12462
|
if (Array.isArray(obj)) {
|
|
@@ -12369,7 +12487,7 @@ async function findEventOrImportedMarketById(resourceId) {
|
|
|
12369
12487
|
|
|
12370
12488
|
// src/types/index.ts
|
|
12371
12489
|
import express from "express";
|
|
12372
|
-
import
|
|
12490
|
+
import mongoose23 from "mongoose";
|
|
12373
12491
|
var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
|
|
12374
12492
|
EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
|
|
12375
12493
|
EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
|
|
@@ -12384,6 +12502,7 @@ export {
|
|
|
12384
12502
|
CategorySchema,
|
|
12385
12503
|
ChatModel,
|
|
12386
12504
|
ChatReportModel,
|
|
12505
|
+
ContactDetailsSchema,
|
|
12387
12506
|
EnumPubSubEvents,
|
|
12388
12507
|
EventInfoModel,
|
|
12389
12508
|
EventModel,
|
|
@@ -12399,6 +12518,7 @@ export {
|
|
|
12399
12518
|
RelationTypeSchema,
|
|
12400
12519
|
ResourceActivityModel,
|
|
12401
12520
|
ResourceImageTypeSchema,
|
|
12521
|
+
SchoolModel,
|
|
12402
12522
|
SocialMediaTypeSchema,
|
|
12403
12523
|
StallTypeSchema,
|
|
12404
12524
|
UserModel,
|
|
@@ -12414,7 +12534,7 @@ export {
|
|
|
12414
12534
|
findEventOrImportedMarketById,
|
|
12415
12535
|
locationGeoSchema,
|
|
12416
12536
|
locationsSchema,
|
|
12417
|
-
|
|
12537
|
+
mongoose23 as mongoose,
|
|
12418
12538
|
refundPolicySchema,
|
|
12419
12539
|
relationDatesSchema,
|
|
12420
12540
|
resourceRelationsSchema,
|