@eeplatform/basic-edu 1.3.5 → 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/dist/index.mjs CHANGED
@@ -4518,6 +4518,7 @@ function useSchoolRepo() {
4518
4518
  { key: { name: 1 } },
4519
4519
  { key: { createdAt: 1 } },
4520
4520
  { key: { name: "text" } },
4521
+ { key: { cityMunicipalityPSGC: 1 }, unique: true, name: "unique_psgc" },
4521
4522
  { key: { id: 1, status: 1 }, unique: true, name: "unique_school_id" }
4522
4523
  ]);
4523
4524
  } catch (error) {
@@ -4574,7 +4575,8 @@ function useSchoolRepo() {
4574
4575
  page = 1,
4575
4576
  limit = 10,
4576
4577
  sort = {},
4577
- status = "active"
4578
+ status = "active",
4579
+ prefix = ""
4578
4580
  } = {}) {
4579
4581
  page = page > 0 ? page - 1 : 0;
4580
4582
  const query = {
@@ -4588,6 +4590,10 @@ function useSchoolRepo() {
4588
4590
  limit,
4589
4591
  sort: JSON.stringify(sort)
4590
4592
  };
4593
+ if (prefix) {
4594
+ query.cityMunicipalityPSGC = { $regex: `^${prefix}` };
4595
+ cacheKeyOptions.prefix = prefix;
4596
+ }
4591
4597
  if (search) {
4592
4598
  query.$text = { $search: search };
4593
4599
  cacheKeyOptions.search = search;
@@ -33408,7 +33414,8 @@ function useSchoolController() {
33408
33414
  status: Joi11.string().optional().allow(null, ""),
33409
33415
  org: Joi11.string().hex().optional().allow(null, ""),
33410
33416
  app: Joi11.string().optional().allow(null, ""),
33411
- search: Joi11.string().optional().allow(null, "")
33417
+ search: Joi11.string().optional().allow(null, ""),
33418
+ psgc: Joi11.string().optional().allow(null, "")
33412
33419
  });
33413
33420
  const { error } = validation.validate(req.query);
33414
33421
  if (error) {
@@ -33428,13 +33435,15 @@ function useSchoolController() {
33428
33435
  }
33429
33436
  const status = req.query.status ?? "active";
33430
33437
  const search = req.query.search ?? "";
33438
+ const psgc = req.query.psgc ?? "";
33431
33439
  try {
33432
33440
  const schools = await _getAll({
33433
33441
  page,
33434
33442
  limit,
33435
33443
  sort: sortObj,
33436
33444
  status,
33437
- search
33445
+ search,
33446
+ prefix: psgc
33438
33447
  });
33439
33448
  res.status(200).json(schools);
33440
33449
  return;