@eeplatform/basic-edu 1.10.19 → 1.10.20

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @eeplatform/basic-edu
2
2
 
3
+ ## 1.10.20
4
+
5
+ ### Patch Changes
6
+
7
+ - 149fe29: Add getById handler to school controller
8
+
3
9
  ## 1.10.19
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -698,6 +698,7 @@ declare function useSchoolController(): {
698
698
  updateFieldById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
699
699
  updateById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
700
700
  deleteById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
701
+ getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
701
702
  };
702
703
 
703
704
  type TAsset = {
package/dist/index.js CHANGED
@@ -34650,7 +34650,8 @@ function useSchoolController() {
34650
34650
  updateStatusById: _updateStatusById,
34651
34651
  updateFieldById: _updateFieldById,
34652
34652
  updateById: _updateById,
34653
- deleteById: _deleteById
34653
+ deleteById: _deleteById,
34654
+ getById: _getById
34654
34655
  } = useSchoolRepo();
34655
34656
  const {
34656
34657
  add: _addSchool,
@@ -34891,6 +34892,22 @@ function useSchoolController() {
34891
34892
  next(error2);
34892
34893
  }
34893
34894
  }
34895
+ async function getById(req, res, next) {
34896
+ const schoolId = req.params.id;
34897
+ const validation = import_joi15.default.string().hex().required();
34898
+ const { error } = validation.validate(schoolId);
34899
+ if (error) {
34900
+ next(new import_nodejs_utils24.BadRequestError(`Validation error: ${error.message}`));
34901
+ return;
34902
+ }
34903
+ try {
34904
+ const school = await _getById(schoolId);
34905
+ res.status(200).json(school);
34906
+ return;
34907
+ } catch (error2) {
34908
+ next(error2);
34909
+ }
34910
+ }
34894
34911
  return {
34895
34912
  add,
34896
34913
  getAll,
@@ -34901,7 +34918,8 @@ function useSchoolController() {
34901
34918
  addBulk,
34902
34919
  updateFieldById,
34903
34920
  updateById,
34904
- deleteById
34921
+ deleteById,
34922
+ getById
34905
34923
  };
34906
34924
  }
34907
34925