mirror of
https://github.com/hex248/sprint.git
synced 2026-02-07 18:23:03 +00:00
Merge: FIX: Issue type not working during creation
This commit is contained in:
@@ -7,9 +7,10 @@ export async function createIssue(
|
||||
title: string,
|
||||
description: string,
|
||||
creatorId: number,
|
||||
status: string,
|
||||
type: string,
|
||||
sprintId?: number,
|
||||
assigneeIds?: number[],
|
||||
status?: string,
|
||||
) {
|
||||
// prevents two issues with the same unique number
|
||||
return await db.transaction(async (tx) => {
|
||||
@@ -31,7 +32,8 @@ export async function createIssue(
|
||||
number: nextNumber,
|
||||
creatorId,
|
||||
sprintId,
|
||||
...(status && { status }),
|
||||
status,
|
||||
type,
|
||||
})
|
||||
.returning();
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ export default async function issueCreate(req: AuthedRequest) {
|
||||
const parsed = await parseJsonBody(req, IssueCreateRequestSchema);
|
||||
if ("error" in parsed) return parsed.error;
|
||||
|
||||
const { projectId, title, description = "", status, assigneeIds, sprintId } = parsed.data;
|
||||
const { projectId, title, description = "", status, assigneeIds, sprintId, type } = parsed.data;
|
||||
|
||||
const project = await getProjectByID(projectId);
|
||||
if (!project) {
|
||||
@@ -51,9 +51,10 @@ export default async function issueCreate(req: AuthedRequest) {
|
||||
title,
|
||||
description,
|
||||
req.userId,
|
||||
status,
|
||||
type,
|
||||
sprintId ?? undefined,
|
||||
assigneeIds,
|
||||
status,
|
||||
);
|
||||
|
||||
return Response.json(issue);
|
||||
|
||||
@@ -125,8 +125,8 @@ export function IssueForm({ trigger }: { trigger?: React.ReactNode }) {
|
||||
description,
|
||||
sprintId: sprintId === "unassigned" ? null : Number(sprintId),
|
||||
assigneeIds: assigneeIds.filter((id) => id !== "unassigned").map((id) => Number(id)),
|
||||
status: status.trim() === "" ? undefined : status,
|
||||
type: type.trim() === "" ? undefined : type,
|
||||
status: status.trim(),
|
||||
type: type.trim(),
|
||||
});
|
||||
setOpen(false);
|
||||
reset();
|
||||
|
||||
@@ -79,8 +79,8 @@ export type VerifyEmailRequest = z.infer<typeof VerifyEmailRequestSchema>;
|
||||
|
||||
export const IssueCreateRequestSchema = z.object({
|
||||
projectId: z.number().int().positive("projectId must be a positive integer"),
|
||||
type: z.string().max(ISSUE_TYPE_MAX_LENGTH).optional(),
|
||||
status: z.string().max(ISSUE_STATUS_MAX_LENGTH).optional(),
|
||||
type: z.string().max(ISSUE_TYPE_MAX_LENGTH),
|
||||
status: z.string().max(ISSUE_STATUS_MAX_LENGTH),
|
||||
title: z.string().min(1, "Title is required").max(ISSUE_TITLE_MAX_LENGTH),
|
||||
description: z.string().max(ISSUE_DESCRIPTION_MAX_LENGTH).default(""),
|
||||
assigneeIds: z.array(z.number().int().positive()).optional(),
|
||||
|
||||
Reference in New Issue
Block a user