@eeplatform/basic-edu 1.3.4 → 1.3.6
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/CHANGELOG.md +12 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -490,12 +490,13 @@ declare function modelSchool(value: TSchool): TSchool;
|
|
|
490
490
|
declare function useSchoolRepo(): {
|
|
491
491
|
createIndexes: () => Promise<void>;
|
|
492
492
|
add: (value: TSchool, session?: ClientSession, clearCache?: boolean) => Promise<ObjectId>;
|
|
493
|
-
getAll: ({ search, page, limit, sort, status, }?: {
|
|
493
|
+
getAll: ({ search, page, limit, sort, status, prefix, }?: {
|
|
494
494
|
search?: string | undefined;
|
|
495
495
|
page?: number | undefined;
|
|
496
496
|
limit?: number | undefined;
|
|
497
497
|
sort?: {} | undefined;
|
|
498
498
|
status?: string | undefined;
|
|
499
|
+
prefix?: string | undefined;
|
|
499
500
|
}) => Promise<Record<string, any> | {
|
|
500
501
|
items: any[];
|
|
501
502
|
pages: number;
|
package/dist/index.js
CHANGED
|
@@ -4508,6 +4508,7 @@ function useSchoolRepo() {
|
|
|
4508
4508
|
{ key: { name: 1 } },
|
|
4509
4509
|
{ key: { createdAt: 1 } },
|
|
4510
4510
|
{ key: { name: "text" } },
|
|
4511
|
+
{ key: { cityMunicipalityPSGC: 1 }, unique: true, name: "unique_psgc" },
|
|
4511
4512
|
{ key: { id: 1, status: 1 }, unique: true, name: "unique_school_id" }
|
|
4512
4513
|
]);
|
|
4513
4514
|
} catch (error) {
|
|
@@ -4564,7 +4565,8 @@ function useSchoolRepo() {
|
|
|
4564
4565
|
page = 1,
|
|
4565
4566
|
limit = 10,
|
|
4566
4567
|
sort = {},
|
|
4567
|
-
status = "active"
|
|
4568
|
+
status = "active",
|
|
4569
|
+
prefix = ""
|
|
4568
4570
|
} = {}) {
|
|
4569
4571
|
page = page > 0 ? page - 1 : 0;
|
|
4570
4572
|
const query = {
|
|
@@ -4578,6 +4580,10 @@ function useSchoolRepo() {
|
|
|
4578
4580
|
limit,
|
|
4579
4581
|
sort: JSON.stringify(sort)
|
|
4580
4582
|
};
|
|
4583
|
+
if (prefix) {
|
|
4584
|
+
query.cityMunicipalityPSGC = { $regex: `^${prefix}` };
|
|
4585
|
+
cacheKeyOptions.prefix = prefix;
|
|
4586
|
+
}
|
|
4581
4587
|
if (search) {
|
|
4582
4588
|
query.$text = { $search: search };
|
|
4583
4589
|
cacheKeyOptions.search = search;
|
|
@@ -33393,7 +33399,8 @@ function useSchoolController() {
|
|
|
33393
33399
|
status: import_joi11.default.string().optional().allow(null, ""),
|
|
33394
33400
|
org: import_joi11.default.string().hex().optional().allow(null, ""),
|
|
33395
33401
|
app: import_joi11.default.string().optional().allow(null, ""),
|
|
33396
|
-
search: import_joi11.default.string().optional().allow(null, "")
|
|
33402
|
+
search: import_joi11.default.string().optional().allow(null, ""),
|
|
33403
|
+
psgc: import_joi11.default.string().optional().allow(null, "")
|
|
33397
33404
|
});
|
|
33398
33405
|
const { error } = validation.validate(req.query);
|
|
33399
33406
|
if (error) {
|
|
@@ -33413,13 +33420,15 @@ function useSchoolController() {
|
|
|
33413
33420
|
}
|
|
33414
33421
|
const status = req.query.status ?? "active";
|
|
33415
33422
|
const search = req.query.search ?? "";
|
|
33423
|
+
const psgc = req.query.psgc ?? "";
|
|
33416
33424
|
try {
|
|
33417
33425
|
const schools = await _getAll({
|
|
33418
33426
|
page,
|
|
33419
33427
|
limit,
|
|
33420
33428
|
sort: sortObj,
|
|
33421
33429
|
status,
|
|
33422
|
-
search
|
|
33430
|
+
search,
|
|
33431
|
+
prefix: psgc
|
|
33423
33432
|
});
|
|
33424
33433
|
res.status(200).json(schools);
|
|
33425
33434
|
return;
|