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