baton-issue-tracker 1.13.1 → 1.13.2
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/package.json
CHANGED
|
@@ -84,6 +84,21 @@ export function createIssue({
|
|
|
84
84
|
} = {}) {
|
|
85
85
|
|
|
86
86
|
const db = getDB();
|
|
87
|
+
|
|
88
|
+
// Normalize priority argument
|
|
89
|
+
if (priority !== undefined) {
|
|
90
|
+
const priorityValues = Object.values(Priority);
|
|
91
|
+
const match = priorityValues.find(v => v.toLowerCase() === priority.trim().toLowerCase());
|
|
92
|
+
priority = match || priority;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Validate before inserting
|
|
96
|
+
const proposed = new Issue({ title, priority, tokenLimit, description, assigneeId });
|
|
97
|
+
const { isValid, errors } = proposed.validate();
|
|
98
|
+
if (!isValid) {
|
|
99
|
+
throw new Error(`Validation failed: ${errors.join(', ')}`);
|
|
100
|
+
}
|
|
101
|
+
|
|
87
102
|
const result = db.insert(issuesTable)
|
|
88
103
|
.values({
|
|
89
104
|
title: title?.trim() || "PENDING",
|