@heyhru/business-dms-approval 0.8.0 → 0.9.0

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.
@@ -2,6 +2,7 @@ import { type FastifyRequest, type FastifyReply } from "fastify";
2
2
  interface AuthenticatedRequest extends FastifyRequest {
3
3
  user: {
4
4
  id: string;
5
+ role: string;
5
6
  };
6
7
  }
7
8
  export declare function approvalList(req: AuthenticatedRequest, reply: FastifyReply): Promise<never>;
@@ -1 +1 @@
1
- {"version":3,"file":"approvals.service.d.ts","sourceRoot":"","sources":["../src/approvals.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAA0B,MAAM,SAAS,CAAC;AAazF,UAAU,oBAAqB,SAAQ,cAAc;IACnD,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;CACtB;AAED,wBAAsB,YAAY,CAAC,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,YAAY,kBAUhF;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBAKzE;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,YAAY,kBAWlF;AAkBD,wBAAsB,eAAe,CAAC,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,YAAY,kBAUnF;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,YAAY,kBAUlF;AAED,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,IACrC,KAAK,oBAAoB,EAAE,OAAO,YAAY,oBAY7D"}
1
+ {"version":3,"file":"approvals.service.d.ts","sourceRoot":"","sources":["../src/approvals.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAA0B,MAAM,SAAS,CAAC;AAazF,UAAU,oBAAqB,SAAQ,cAAc;IACnD,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACpC;AAED,wBAAsB,YAAY,CAAC,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,YAAY,kBAWhF;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBAKzE;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,YAAY,kBAWlF;AAkBD,wBAAsB,eAAe,CAAC,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,YAAY,kBAUnF;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,YAAY,kBAUlF;AAED,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,IACrC,KAAK,oBAAoB,EAAE,OAAO,YAAY,oBAY7D"}
package/dist/index.js CHANGED
@@ -113,9 +113,10 @@ function setExecuteResult(id, status, result) {
113
113
  // src/approvals.service.ts
114
114
  async function approvalList(req, reply) {
115
115
  const { status, mine, limit, offset } = req.body ?? {};
116
+ const ownOnly = req.user.role === "developer" || req.user.role === "maintainer" || String(mine) === "true";
116
117
  const filters = {
117
118
  status,
118
- submittedBy: mine === "true" ? req.user.id : void 0,
119
+ submittedBy: ownOnly ? req.user.id : void 0,
119
120
  limit: limit ? Number(limit) : void 0,
120
121
  offset: offset ? Number(offset) : void 0
121
122
  };
package/dist/index.mjs CHANGED
@@ -79,9 +79,10 @@ function setExecuteResult(id, status, result) {
79
79
  // src/approvals.service.ts
80
80
  async function approvalList(req, reply) {
81
81
  const { status, mine, limit, offset } = req.body ?? {};
82
+ const ownOnly = req.user.role === "developer" || req.user.role === "maintainer" || String(mine) === "true";
82
83
  const filters = {
83
84
  status,
84
- submittedBy: mine === "true" ? req.user.id : void 0,
85
+ submittedBy: ownOnly ? req.user.id : void 0,
85
86
  limit: limit ? Number(limit) : void 0,
86
87
  offset: offset ? Number(offset) : void 0
87
88
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.8.0",
6
+ "version": "0.9.0",
7
7
  "description": "DMS approval workflow domain logic: service, model, sql",
8
8
  "main": "./dist/index.js",
9
9
  "module": "./dist/index.mjs",
@@ -36,5 +36,5 @@
36
36
  "typescript": "^6.0.2",
37
37
  "vitest": "^4.1.4"
38
38
  },
39
- "gitHead": "63975371f0229a1e097295daabe992835ef4249d"
39
+ "gitHead": "1ad4a5b30669088bc6ba28277f384cf0b88e67f0"
40
40
  }