@meridianjs/issue 0.1.2 → 0.1.3

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.js CHANGED
@@ -166,11 +166,11 @@ var IssueModuleService = class extends (0, import_framework_utils6.MeridianServi
166
166
  if (!project) {
167
167
  throw Object.assign(new Error(`Project ${input.project_id} not found`), { status: 404 });
168
168
  }
169
- const existing = await issueRepo.find({ project_id: input.project_id });
170
- const maxNumber = existing.reduce(
171
- (max, issue2) => Math.max(max, issue2.number ?? 0),
172
- 0
169
+ const [highest] = await issueRepo.find(
170
+ { project_id: input.project_id },
171
+ { orderBy: { number: "DESC" }, limit: 1 }
173
172
  );
173
+ const maxNumber = highest?.number ?? 0;
174
174
  const nextNumber = maxNumber + 1;
175
175
  const identifier = `${project.identifier}-${nextNumber}`;
176
176
  const issue = issueRepo.create({
package/dist/index.mjs CHANGED
@@ -140,11 +140,11 @@ var IssueModuleService = class extends MeridianService({
140
140
  if (!project) {
141
141
  throw Object.assign(new Error(`Project ${input.project_id} not found`), { status: 404 });
142
142
  }
143
- const existing = await issueRepo.find({ project_id: input.project_id });
144
- const maxNumber = existing.reduce(
145
- (max, issue2) => Math.max(max, issue2.number ?? 0),
146
- 0
143
+ const [highest] = await issueRepo.find(
144
+ { project_id: input.project_id },
145
+ { orderBy: { number: "DESC" }, limit: 1 }
147
146
  );
147
+ const maxNumber = highest?.number ?? 0;
148
148
  const nextNumber = maxNumber + 1;
149
149
  const identifier = `${project.identifier}-${nextNumber}`;
150
150
  const issue = issueRepo.create({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meridianjs/issue",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Meridian issue module — Issue and Comment domain models",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",