mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 10:33:01 +00:00
issue types (task/bug)
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
ISSUE_DESCRIPTION_MAX_LENGTH,
|
||||
ISSUE_STATUS_MAX_LENGTH,
|
||||
ISSUE_TITLE_MAX_LENGTH,
|
||||
ISSUE_TYPE_MAX_LENGTH,
|
||||
ORG_DESCRIPTION_MAX_LENGTH,
|
||||
ORG_NAME_MAX_LENGTH,
|
||||
ORG_SLUG_MAX_LENGTH,
|
||||
@@ -66,9 +67,10 @@ export type AuthResponse = z.infer<typeof AuthResponseSchema>;
|
||||
|
||||
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(),
|
||||
title: z.string().min(1, "Title is required").max(ISSUE_TITLE_MAX_LENGTH),
|
||||
description: z.string().max(ISSUE_DESCRIPTION_MAX_LENGTH).default(""),
|
||||
status: z.string().max(ISSUE_STATUS_MAX_LENGTH).optional(),
|
||||
assigneeIds: z.array(z.number().int().positive()).optional(),
|
||||
sprintId: z.number().int().positive().nullable().optional(),
|
||||
});
|
||||
@@ -77,9 +79,10 @@ export type IssueCreateRequest = z.infer<typeof IssueCreateRequestSchema>;
|
||||
|
||||
export const IssueUpdateRequestSchema = z.object({
|
||||
id: z.number().int().positive("id must be a positive integer"),
|
||||
type: z.string().max(ISSUE_TYPE_MAX_LENGTH).optional(),
|
||||
status: z.string().max(ISSUE_STATUS_MAX_LENGTH).optional(),
|
||||
title: z.string().min(1, "Title must be at least 1 character").max(ISSUE_TITLE_MAX_LENGTH).optional(),
|
||||
description: z.string().max(ISSUE_DESCRIPTION_MAX_LENGTH).optional(),
|
||||
status: z.string().max(ISSUE_STATUS_MAX_LENGTH).optional(),
|
||||
assigneeIds: z.array(z.number().int().positive()).nullable().optional(),
|
||||
sprintId: z.number().int().positive().nullable().optional(),
|
||||
});
|
||||
@@ -388,9 +391,10 @@ export const IssueRecordSchema = z.object({
|
||||
id: z.number(),
|
||||
projectId: z.number(),
|
||||
number: z.number(),
|
||||
type: z.string(),
|
||||
status: z.string(),
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
status: z.string(),
|
||||
creatorId: z.number(),
|
||||
sprintId: z.number().nullable(),
|
||||
});
|
||||
|
||||
@@ -11,5 +11,6 @@ export const PROJECT_SLUG_MAX_LENGTH = 64;
|
||||
|
||||
export const ISSUE_TITLE_MAX_LENGTH = 64;
|
||||
export const ISSUE_DESCRIPTION_MAX_LENGTH = 2048;
|
||||
export const ISSUE_TYPE_MAX_LENGTH = 16;
|
||||
export const ISSUE_STATUS_MAX_LENGTH = 24;
|
||||
export const ISSUE_COMMENT_MAX_LENGTH = 2048;
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
ISSUE_DESCRIPTION_MAX_LENGTH,
|
||||
ISSUE_STATUS_MAX_LENGTH,
|
||||
ISSUE_TITLE_MAX_LENGTH,
|
||||
ISSUE_TYPE_MAX_LENGTH,
|
||||
ORG_DESCRIPTION_MAX_LENGTH,
|
||||
ORG_NAME_MAX_LENGTH,
|
||||
ORG_SLUG_MAX_LENGTH,
|
||||
@@ -28,9 +29,15 @@ export const DEFAULT_STATUS_COLOURS: Record<string, string> = {
|
||||
MERGED: DEFAULT_STATUS_COLOUR,
|
||||
};
|
||||
|
||||
export const DEFAULT_ISSUE_TYPES: Record<string, { icon: string; color: string }> = {
|
||||
Task: { icon: "checkBox", color: "#e4bd47" },
|
||||
Bug: { icon: "bug", color: "#ef4444" },
|
||||
};
|
||||
|
||||
export const DEFAULT_FEATURES: Record<string, boolean> = {
|
||||
userAvatars: true,
|
||||
|
||||
issueTypes: true,
|
||||
issueStatus: true,
|
||||
issueDescriptions: true,
|
||||
issueTimeTracking: true,
|
||||
@@ -63,6 +70,10 @@ export const Organisation = pgTable("Organisation", {
|
||||
slug: varchar({ length: ORG_SLUG_MAX_LENGTH }).notNull().unique(),
|
||||
iconURL: varchar({ length: 512 }),
|
||||
statuses: json("statuses").$type<Record<string, string>>().notNull().default(DEFAULT_STATUS_COLOURS),
|
||||
issueTypes: json("issueTypes")
|
||||
.$type<Record<string, { icon: string; color: string }>>()
|
||||
.notNull()
|
||||
.default(DEFAULT_ISSUE_TYPES),
|
||||
features: json("features").$type<Record<string, boolean>>().notNull().default(DEFAULT_FEATURES),
|
||||
createdAt: timestamp({ withTimezone: false }).defaultNow(),
|
||||
updatedAt: timestamp({ withTimezone: false }).defaultNow(),
|
||||
@@ -135,9 +146,10 @@ export const Issue = pgTable(
|
||||
|
||||
number: integer("number").notNull(),
|
||||
|
||||
type: varchar({ length: ISSUE_TYPE_MAX_LENGTH }).notNull().default("Task"),
|
||||
status: varchar({ length: ISSUE_STATUS_MAX_LENGTH }).notNull().default("TO DO"),
|
||||
title: varchar({ length: ISSUE_TITLE_MAX_LENGTH }).notNull(),
|
||||
description: varchar({ length: ISSUE_DESCRIPTION_MAX_LENGTH }).notNull(),
|
||||
status: varchar({ length: ISSUE_STATUS_MAX_LENGTH }).notNull().default("TO DO"),
|
||||
|
||||
creatorId: integer()
|
||||
.notNull()
|
||||
|
||||
Reference in New Issue
Block a user