@meridianjs/issue 0.1.1 → 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
@@ -58,7 +58,9 @@ var Issue = import_framework_utils.model.define("issue", {
58
58
  start_date: import_framework_utils.model.date().nullable(),
59
59
  due_date: import_framework_utils.model.date().nullable(),
60
60
  /** Story point estimate */
61
- estimate: import_framework_utils.model.number().nullable()
61
+ estimate: import_framework_utils.model.number().nullable(),
62
+ /** Arbitrary key/value storage for custom integrations */
63
+ metadata: import_framework_utils.model.json().nullable()
62
64
  }, [
63
65
  { columns: ["project_id"] },
64
66
  { columns: ["workspace_id"] },
@@ -73,7 +75,9 @@ var Comment = import_framework_utils2.model.define("comment", {
73
75
  body: import_framework_utils2.model.text(),
74
76
  issue_id: import_framework_utils2.model.text(),
75
77
  author_id: import_framework_utils2.model.text(),
76
- edited_at: import_framework_utils2.model.date().nullable()
78
+ edited_at: import_framework_utils2.model.date().nullable(),
79
+ /** Arbitrary key/value storage for custom integrations */
80
+ metadata: import_framework_utils2.model.json().nullable()
77
81
  });
78
82
  var comment_default = Comment;
79
83
 
@@ -162,11 +166,11 @@ var IssueModuleService = class extends (0, import_framework_utils6.MeridianServi
162
166
  if (!project) {
163
167
  throw Object.assign(new Error(`Project ${input.project_id} not found`), { status: 404 });
164
168
  }
165
- const existing = await issueRepo.find({ project_id: input.project_id });
166
- const maxNumber = existing.reduce(
167
- (max, issue2) => Math.max(max, issue2.number ?? 0),
168
- 0
169
+ const [highest] = await issueRepo.find(
170
+ { project_id: input.project_id },
171
+ { orderBy: { number: "DESC" }, limit: 1 }
169
172
  );
173
+ const maxNumber = highest?.number ?? 0;
170
174
  const nextNumber = maxNumber + 1;
171
175
  const identifier = `${project.identifier}-${nextNumber}`;
172
176
  const issue = issueRepo.create({
package/dist/index.mjs CHANGED
@@ -32,7 +32,9 @@ var Issue = model.define("issue", {
32
32
  start_date: model.date().nullable(),
33
33
  due_date: model.date().nullable(),
34
34
  /** Story point estimate */
35
- estimate: model.number().nullable()
35
+ estimate: model.number().nullable(),
36
+ /** Arbitrary key/value storage for custom integrations */
37
+ metadata: model.json().nullable()
36
38
  }, [
37
39
  { columns: ["project_id"] },
38
40
  { columns: ["workspace_id"] },
@@ -47,7 +49,9 @@ var Comment = model2.define("comment", {
47
49
  body: model2.text(),
48
50
  issue_id: model2.text(),
49
51
  author_id: model2.text(),
50
- edited_at: model2.date().nullable()
52
+ edited_at: model2.date().nullable(),
53
+ /** Arbitrary key/value storage for custom integrations */
54
+ metadata: model2.json().nullable()
51
55
  });
52
56
  var comment_default = Comment;
53
57
 
@@ -136,11 +140,11 @@ var IssueModuleService = class extends MeridianService({
136
140
  if (!project) {
137
141
  throw Object.assign(new Error(`Project ${input.project_id} not found`), { status: 404 });
138
142
  }
139
- const existing = await issueRepo.find({ project_id: input.project_id });
140
- const maxNumber = existing.reduce(
141
- (max, issue2) => Math.max(max, issue2.number ?? 0),
142
- 0
143
+ const [highest] = await issueRepo.find(
144
+ { project_id: input.project_id },
145
+ { orderBy: { number: "DESC" }, limit: 1 }
143
146
  );
147
+ const maxNumber = highest?.number ?? 0;
144
148
  const nextNumber = maxNumber + 1;
145
149
  const identifier = `${project.identifier}-${nextNumber}`;
146
150
  const issue = issueRepo.create({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meridianjs/issue",
3
- "version": "0.1.1",
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",