@eeplatform/basic-edu 1.10.39 → 1.10.41

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.
@@ -17,23 +17,22 @@ jobs:
17
17
  runs-on: ubuntu-latest
18
18
  steps:
19
19
  - uses: actions/checkout@v4
20
+ with:
21
+ fetch-depth: 0
20
22
 
21
23
  - uses: actions/setup-node@v4
22
24
  with:
23
25
  node-version: 20.x
24
- cache: "yarn" # Use yarn for caching
25
- cache-dependency-path: yarn.lock # Cache Yarn lockfile
26
-
27
- - run: yarn install --immutable # Install dependencies with immutable lockfile
26
+ cache: "yarn"
27
+ cache-dependency-path: yarn.lock
28
28
 
29
- - name: Create .npmrc for publishing
30
- run: |
31
- echo '//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}' > ~/.npmrc
29
+ - run: yarn install --immutable
32
30
 
33
31
  - name: Create Release Pull Request or Publish
34
32
  id: changesets
35
33
  uses: changesets/action@v1
36
34
  with:
37
- publish: yarn release # Use yarn for publishing
35
+ publish: yarn release
38
36
  env:
39
37
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @eeplatform/basic-edu
2
2
 
3
+ ## 1.10.41
4
+
5
+ ### Patch Changes
6
+
7
+ - e72b0b8: Update dependencies
8
+
9
+ ## 1.10.40
10
+
11
+ ### Patch Changes
12
+
13
+ - ef02db4: Update dependencies
14
+
3
15
  ## 1.10.39
4
16
 
5
17
  ### Patch Changes
package/CLAUDE.md CHANGED
@@ -63,7 +63,7 @@ Multi-word resource names use dot notation in file names: `finance.journal.confi
63
63
 
64
64
  ## Error Handling
65
65
 
66
- Always use the typed error classes from `@goweekdays/utils` — never throw a generic `new Error()`.
66
+ Always use the typed error classes from `@eeplatform/nodejs-utils` — never throw a generic `new Error()`.
67
67
 
68
68
  - `BadRequestError` — invalid input or a violated business rule
69
69
  - `NotFoundError` — resource does not exist
@@ -104,171 +104,3 @@ Transactions belong in the service layer only — never in a controller or repos
104
104
  - **No generic `Error` throws** — use the typed error classes above
105
105
  - **No Zod** — validation is done with Joi throughout this module
106
106
  - **No extra fields into the DB** — always validate the full request body before using any of it
107
-
108
- # Monthly Account Balance Tracking — Instruction Set
109
-
110
- ## Objective
111
-
112
- Maintain a monthly balance tracker for each account using the structure:
113
-
114
- (accountId, fiscalYear, month)
115
-
116
- Each record must contain:
117
-
118
- - openingDebit
119
- - openingCredit
120
- - movementDebit
121
- - movementCredit
122
- - closingDebit
123
- - closingCredit
124
- - netBalance
125
-
126
- ---
127
-
128
- # 1. When Posting a Journal Entry
129
-
130
- For each journal line in a transaction:
131
-
132
- 1. Identify:
133
-
134
- - accountId
135
- - transactionDate
136
- - month
137
- - fiscalYear
138
- - debitAmount
139
- - creditAmount
140
-
141
- 2. Locate the balance record:
142
-
143
- (accountId, fiscalYear, month)
144
-
145
- ---
146
-
147
- # 2. If Balance Record Exists
148
-
149
- Update the movement values.
150
-
151
- If the journal line is debit:
152
-
153
- movementDebit += debitAmount
154
-
155
- If the journal line is credit:
156
-
157
- movementCredit += creditAmount
158
-
159
- Then recompute the closing balance.
160
-
161
- ---
162
-
163
- # 3. If Balance Record Does NOT Exist
164
-
165
- Create a new balance record.
166
-
167
- Determine the opening balance using the following rules.
168
-
169
- ## Rule A — Previous Month Record Exists
170
-
171
- Find the latest previous balance record for the same account.
172
-
173
- (accountId, previousMonth, fiscalYear)
174
-
175
- Set the opening balance:
176
-
177
- openingDebit = previousRecord.closingDebit
178
- openingCredit = previousRecord.closingCredit
179
-
180
- ## Rule B — No Previous Record Exists
181
-
182
- This means the account is used for the first time.
183
-
184
- Set:
185
-
186
- openingDebit = 0
187
- openingCredit = 0
188
-
189
- ## Initialize Movement
190
-
191
- After determining the opening balance:
192
-
193
- movementDebit = debitAmount
194
- movementCredit = creditAmount
195
-
196
- ---
197
-
198
- # 4. Recompute Closing Balance
199
-
200
- After movement updates, compute the net balance.
201
-
202
- netBalance = (openingDebit + movementDebit) - (openingCredit + movementCredit)
203
-
204
- If netBalance > 0:
205
-
206
- closingDebit = netBalance
207
- closingCredit = 0
208
-
209
- If netBalance < 0:
210
-
211
- closingDebit = 0
212
- closingCredit = abs(netBalance)
213
-
214
- If netBalance == 0:
215
-
216
- closingDebit = 0
217
- closingCredit = 0
218
-
219
- The `netBalance` field should always store the computed value so the system can quickly determine whether the account has a debit or credit balance without recalculating.
220
-
221
- ---
222
-
223
- # 5. Month-to-Month Carry Forward Rule
224
-
225
- When a new month record is created:
226
-
227
- opening balance = previous month closing balance
228
-
229
- Example:
230
-
231
- January closing = 8,000 debit
232
- February opening = 8,000 debit
233
-
234
- ---
235
-
236
- # 6. Summary of Posting Flow
237
-
238
- For each journal line:
239
-
240
- 1. Determine account, fiscalYear, and month
241
- 2. Find balance record
242
- 3. If record exists → update movement
243
- 4. If record does not exist
244
-
245
- - find previous balance record
246
- - set opening = previous closing (or zero)
247
- - create new balance record
248
-
249
- 5. Update movement values
250
- 6. Recompute closing balance
251
-
252
- ---
253
-
254
- # 7. Important Principle
255
-
256
- Opening balance always represents:
257
-
258
- balance before the period starts
259
-
260
- Therefore:
261
-
262
- opening = previous closing
263
-
264
- If no previous record exists:
265
-
266
- opening = 0
267
-
268
- ---
269
-
270
- This logic ensures:
271
-
272
- - continuous balance tracking
273
- - correct month-to-month carry over
274
- - efficient financial reporting without recalculating all journal entries
package/dist/index.js CHANGED
@@ -35222,12 +35222,11 @@ function useSchoolService() {
35222
35222
  const roleName = "Admin";
35223
35223
  const roleId = await addRole(
35224
35224
  {
35225
- id,
35226
- type: roleType,
35225
+ org: id,
35226
+ app: roleType,
35227
35227
  name: roleName,
35228
35228
  permissions: ["*"],
35229
- status: "active",
35230
- default: true
35229
+ status: "active"
35231
35230
  },
35232
35231
  session
35233
35232
  );
@@ -35280,12 +35279,11 @@ function useSchoolService() {
35280
35279
  const roleName = "Admin";
35281
35280
  const roleId = await addRole(
35282
35281
  {
35283
- id: schoolId.toString(),
35284
- type: roleType,
35282
+ org: schoolId.toString(),
35283
+ app: roleType,
35285
35284
  name: roleName,
35286
35285
  permissions: ["*"],
35287
- status: "active",
35288
- default: true
35286
+ status: "active"
35289
35287
  },
35290
35288
  session
35291
35289
  );
@@ -35440,12 +35438,11 @@ ${errors.slice(0, 5).join("\n")}${errors.length > 5 ? `
35440
35438
  const schoolId = await addSchool(school, session, false);
35441
35439
  await addRole(
35442
35440
  {
35443
- id: schoolId.toString(),
35444
- type: "basic-edu-school",
35441
+ org: schoolId.toString(),
35442
+ app: "basic-edu-school",
35445
35443
  name: "Admin",
35446
35444
  permissions: ["*"],
35447
- status: "active",
35448
- default: true
35445
+ status: "active"
35449
35446
  },
35450
35447
  session,
35451
35448
  false
@@ -36924,12 +36921,11 @@ function useDivisionService() {
36924
36921
  const division = await _add(value, session);
36925
36922
  await addRole(
36926
36923
  {
36927
- id: division.toString(),
36924
+ org: division.toString(),
36928
36925
  name: "Admin",
36929
- type: "basic-edu-sdo",
36926
+ app: "basic-edu-sdo",
36930
36927
  permissions: ["*"],
36931
- status: "active",
36932
- default: true
36928
+ status: "active"
36933
36929
  },
36934
36930
  session
36935
36931
  );