@eeplatform/nuxt-layer-common 1.2.0 → 1.2.1

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/nuxt-layer-common
2
2
 
3
+ ## 1.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - e217ab9: Admin school management adjustment
8
+
3
9
  ## 1.2.0
4
10
 
5
11
  ### Minor Changes
@@ -50,7 +50,7 @@ const prop = defineProps({
50
50
  route: {
51
51
  type: Object,
52
52
  default() {
53
- return { name: "", params: {} };
53
+ return { name: "", params: {}, query: {} };
54
54
  },
55
55
  },
56
56
  children: {
@@ -114,7 +114,7 @@ const props = defineProps({
114
114
  type: Object,
115
115
  default: () => ({}),
116
116
  },
117
- org: {
117
+ id: {
118
118
  type: String,
119
119
  default: "",
120
120
  },
@@ -150,7 +150,7 @@ async function submit() {
150
150
  name: name.value,
151
151
  permissions: selectedPermissions.value,
152
152
  type: type.value,
153
- org: props.org,
153
+ id: props.id,
154
154
  });
155
155
 
156
156
  if (createMore.value) {
@@ -82,7 +82,7 @@
82
82
  <RolePermissionFormCreate
83
83
  @cancel="createDialog = false"
84
84
  :permissions="props.permissions"
85
- :org="props.orgId"
85
+ :id="props.id"
86
86
  @success="success()"
87
87
  v-model:type="type"
88
88
  :types="props.types"
@@ -144,7 +144,7 @@
144
144
 
145
145
  <script setup lang="ts">
146
146
  const props = defineProps({
147
- orgId: {
147
+ id: {
148
148
  type: String,
149
149
  default: "",
150
150
  },
@@ -224,7 +224,7 @@ const {
224
224
  page: page.value,
225
225
  search: headerSearch.value,
226
226
  type: type.value,
227
- org: props.orgId,
227
+ id: props.id,
228
228
  }),
229
229
  {
230
230
  watch: [page, headerSearch],
@@ -0,0 +1,64 @@
1
+ export default function useDivision() {
2
+ function getAll({ page = 1, search = "", limit = 20, region = "" } = {}) {
3
+ return useNuxtApp().$api<Record<string, any>>("/api/divisions", {
4
+ method: "GET",
5
+ query: {
6
+ page,
7
+ search,
8
+ limit,
9
+ region,
10
+ },
11
+ });
12
+ }
13
+
14
+ function getById(id = "") {
15
+ return useNuxtApp().$api<Record<string, any>>(`/api/divisions/id/${id}`, {
16
+ method: "GET",
17
+ });
18
+ }
19
+
20
+ function getByName(name = "") {
21
+ return useNuxtApp().$api(`/api/divisions/name/${name}`, {
22
+ method: "GET",
23
+ });
24
+ }
25
+
26
+ function createDivision(data: Record<string, any>) {
27
+ return useNuxtApp().$api("/api/divisions", {
28
+ method: "POST",
29
+ body: data,
30
+ });
31
+ }
32
+
33
+ function updateDivisionField(id: string, field: string, value: string) {
34
+ return useNuxtApp().$api(`/api/divisions/${id}`, {
35
+ method: "PATCH",
36
+ body: { field, value },
37
+ });
38
+ }
39
+
40
+ function deleteDivision(id: string) {
41
+ return useNuxtApp().$api(`/api/divisions/${id}`, {
42
+ method: "DELETE",
43
+ });
44
+ }
45
+
46
+ const division = ref({
47
+ _id: "",
48
+ name: "",
49
+ region: "",
50
+ regionName: "",
51
+ superintendent: "",
52
+ superintendentName: "",
53
+ });
54
+
55
+ return {
56
+ division,
57
+ getAll,
58
+ getById,
59
+ getByName,
60
+ createDivision,
61
+ updateDivisionField,
62
+ deleteDivision,
63
+ };
64
+ }
@@ -0,0 +1,62 @@
1
+ export default function useRegion() {
2
+ function getAll({ page = 1, search = "", limit = 20 } = {}) {
3
+ return useNuxtApp().$api<Record<string, any>>("/api/regions", {
4
+ method: "GET",
5
+ query: {
6
+ page,
7
+ search,
8
+ limit,
9
+ },
10
+ });
11
+ }
12
+
13
+ function getById(id = "") {
14
+ return useNuxtApp().$api<Record<string, any>>(`/api/regions/id/${id}`, {
15
+ method: "GET",
16
+ });
17
+ }
18
+
19
+ function getByName(name = "") {
20
+ return useNuxtApp().$api(`/api/regions/name/${name}`, {
21
+ method: "GET",
22
+ });
23
+ }
24
+
25
+ function createRegion(data: Record<string, any>) {
26
+ return useNuxtApp().$api("/api/regions", {
27
+ method: "POST",
28
+ body: data,
29
+ });
30
+ }
31
+
32
+ function updateRegionField(id: string, field: string, value: string) {
33
+ return useNuxtApp().$api(`/api/regions/${id}`, {
34
+ method: "PATCH",
35
+ body: { field, value },
36
+ });
37
+ }
38
+
39
+ function deleteRegion(id: string) {
40
+ return useNuxtApp().$api(`/api/regions/${id}`, {
41
+ method: "DELETE",
42
+ });
43
+ }
44
+
45
+ const region = ref({
46
+ _id: "",
47
+ name: "",
48
+ director: "",
49
+ directorName: "",
50
+ });
51
+
52
+ return {
53
+ region,
54
+ getAll,
55
+ getById,
56
+ getByName,
57
+ createRegion,
58
+ updateRegionField,
59
+ deleteRegion,
60
+ };
61
+ }
62
+
@@ -1,15 +1,15 @@
1
1
  export default function useRole() {
2
2
  function createRole(
3
- { name, permissions, type, org } = {} as {
3
+ { name, permissions, type, id } = {} as {
4
4
  name: string;
5
5
  permissions: Array<string>;
6
6
  type: string;
7
- org: string;
7
+ id: string;
8
8
  }
9
9
  ) {
10
10
  return useNuxtApp().$api("/api/roles", {
11
11
  method: "POST",
12
- body: { name, permissions, type, org },
12
+ body: { name, permissions, type, id },
13
13
  });
14
14
  }
15
15
 
@@ -18,11 +18,11 @@ export default function useRole() {
18
18
  page = 1,
19
19
  limit = 20,
20
20
  type = "",
21
- org = "",
21
+ id = "",
22
22
  } = {}) {
23
23
  return useNuxtApp().$api<Record<string, any>>("/api/roles", {
24
24
  method: "GET",
25
- query: { search, page, limit, type, org },
25
+ query: { search, page, limit, type, id },
26
26
  });
27
27
  }
28
28
 
@@ -67,7 +67,7 @@ export default function useRole() {
67
67
  return {
68
68
  _id: "",
69
69
  name: "",
70
- org: "",
70
+ id: "",
71
71
  permissions: [],
72
72
  createdAt: "",
73
73
  updatedAt: "",
@@ -0,0 +1,46 @@
1
+ export default function useSchool() {
2
+ function registerSchool(school: TSchool) {
3
+ return useNuxtApp().$api("/api/schools/register", {
4
+ method: "POST",
5
+ body: school,
6
+ });
7
+ }
8
+
9
+ function getPendingByCreatedBy(createdBy: string) {
10
+ return useNuxtApp().$api<Record<string, any>>(
11
+ `/api/schools/createdBy/${createdBy}`,
12
+ {
13
+ method: "GET",
14
+ }
15
+ );
16
+ }
17
+
18
+ function approvedById(id: string) {
19
+ return useNuxtApp().$api<Record<string, any>>(
20
+ `/api/schools/approve/${id}`,
21
+ {
22
+ method: "PATCH",
23
+ }
24
+ );
25
+ }
26
+
27
+ function getAll({
28
+ page = 1,
29
+ status = "active",
30
+ search = "",
31
+ region = "",
32
+ division = "",
33
+ } = {}) {
34
+ return useNuxtApp().$api<Record<string, any>>("/api/schools", {
35
+ method: "GET",
36
+ query: { page, status, search, region, division },
37
+ });
38
+ }
39
+
40
+ return {
41
+ registerSchool,
42
+ getPendingByCreatedBy,
43
+ getAll,
44
+ approvedById,
45
+ };
46
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@eeplatform/nuxt-layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "1.2.0",
5
+ "version": "1.2.1",
6
6
  "main": "./nuxt.config.ts",
7
7
  "publishConfig": {
8
8
  "access": "public"
package/types/local.d.ts CHANGED
@@ -6,7 +6,8 @@ declare type TToken = {
6
6
 
7
7
  declare type TNavigationRoute = {
8
8
  name: string;
9
- params?: TKeyValuePair;
9
+ params?: Record<string, any>;
10
+ query?: Record<string, any>;
10
11
  };
11
12
 
12
13
  declare type TNavigationItem = {
@@ -16,10 +17,3 @@ declare type TNavigationItem = {
16
17
  children?: TNavigationItem[];
17
18
  disabled?: boolean;
18
19
  };
19
-
20
- declare type TKeyValuePair<
21
- K extends string | number | symbol = string,
22
- V = string | number | object | Array | TKeyValuePair
23
- > = {
24
- [key in K]: V;
25
- };
package/types/role.d.ts CHANGED
@@ -3,7 +3,7 @@ declare type TRole = {
3
3
  name?: string;
4
4
  permissions?: Array<string>;
5
5
  type?: string;
6
- org?: string;
6
+ id?: string;
7
7
  status?: string;
8
8
  default?: boolean;
9
9
  createdBy?: string;
@@ -0,0 +1,23 @@
1
+ declare type TSchool = {
2
+ _id?: string;
3
+ id: string;
4
+ name: string;
5
+ country: string;
6
+ address: string;
7
+ continuedAddress: string;
8
+ city: string;
9
+ province: string;
10
+ postalCode: string;
11
+ courses: Array<string>;
12
+ principalName: string;
13
+ principalEmail: string;
14
+ principalNumber: string;
15
+ region: string;
16
+ regionName?: string;
17
+ division: string;
18
+ divisionName?: string;
19
+ status?: string;
20
+ createdAt?: string;
21
+ updatedAt?: string;
22
+ createdBy?: string;
23
+ };