diff --git a/packages/backend/drizzle/0006_wise_kree.sql b/packages/backend/drizzle/0006_wise_kree.sql new file mode 100644 index 0000000..9e95a49 --- /dev/null +++ b/packages/backend/drizzle/0006_wise_kree.sql @@ -0,0 +1 @@ +ALTER TABLE "Project" RENAME COLUMN "blob" TO "key"; \ No newline at end of file diff --git a/packages/backend/drizzle/meta/0006_snapshot.json b/packages/backend/drizzle/meta/0006_snapshot.json new file mode 100644 index 0000000..0bd1dc0 --- /dev/null +++ b/packages/backend/drizzle/meta/0006_snapshot.json @@ -0,0 +1,431 @@ +{ + "id": "e65db5fa-6d8f-43f1-aea1-154a085302bc", + "prevId": "c7a99155-1dc7-414d-88b6-8f485daa0c58", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.Issue": { + "name": "Issue", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "Issue_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "projectId": { + "name": "projectId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "number": { + "name": "number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(256)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(2048)", + "primaryKey": false, + "notNull": true + }, + "assigneeId": { + "name": "assigneeId", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "unique_project_issue_number": { + "name": "unique_project_issue_number", + "columns": [ + { + "expression": "projectId", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "Issue_projectId_Project_id_fk": { + "name": "Issue_projectId_Project_id_fk", + "tableFrom": "Issue", + "tableTo": "Project", + "columnsFrom": [ + "projectId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "Issue_assigneeId_User_id_fk": { + "name": "Issue_assigneeId_User_id_fk", + "tableFrom": "Issue", + "tableTo": "User", + "columnsFrom": [ + "assigneeId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.Organisation": { + "name": "Organisation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "Organisation_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(256)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "slug": { + "name": "slug", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "Organisation_slug_unique": { + "name": "Organisation_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.OrganisationMember": { + "name": "OrganisationMember", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "OrganisationMember_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "organisationId": { + "name": "organisationId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "OrganisationMember_organisationId_Organisation_id_fk": { + "name": "OrganisationMember_organisationId_Organisation_id_fk", + "tableFrom": "OrganisationMember", + "tableTo": "Organisation", + "columnsFrom": [ + "organisationId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "OrganisationMember_userId_User_id_fk": { + "name": "OrganisationMember_userId_User_id_fk", + "tableFrom": "OrganisationMember", + "tableTo": "User", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.Project": { + "name": "Project", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "Project_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "key": { + "name": "key", + "type": "varchar(4)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(256)", + "primaryKey": false, + "notNull": true + }, + "organisationId": { + "name": "organisationId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "creatorId": { + "name": "creatorId", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "Project_organisationId_Organisation_id_fk": { + "name": "Project_organisationId_Organisation_id_fk", + "tableFrom": "Project", + "tableTo": "Organisation", + "columnsFrom": [ + "organisationId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "Project_creatorId_User_id_fk": { + "name": "Project_creatorId_User_id_fk", + "tableFrom": "Project", + "tableTo": "User", + "columnsFrom": [ + "creatorId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.User": { + "name": "User", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "User_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(256)", + "primaryKey": false, + "notNull": true + }, + "username": { + "name": "username", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true + }, + "passwordHash": { + "name": "passwordHash", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "User_username_unique": { + "name": "User_username_unique", + "nullsNotDistinct": false, + "columns": [ + "username" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/packages/backend/drizzle/meta/_journal.json b/packages/backend/drizzle/meta/_journal.json index dcde1a6..50328c3 100644 --- a/packages/backend/drizzle/meta/_journal.json +++ b/packages/backend/drizzle/meta/_journal.json @@ -43,6 +43,13 @@ "when": 1766433489198, "tag": "0005_great_timeslip", "breakpoints": true + }, + { + "idx": 6, + "version": "7", + "when": 1766988874206, + "tag": "0006_wise_kree", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/backend/src/db/queries/projects.ts b/packages/backend/src/db/queries/projects.ts index b29b111..54e14f5 100644 --- a/packages/backend/src/db/queries/projects.ts +++ b/packages/backend/src/db/queries/projects.ts @@ -2,11 +2,11 @@ import { Issue, Organisation, Project, User } from "@issue/shared"; import { eq } from "drizzle-orm"; import { db } from "../client"; -export async function createProject(blob: string, name: string, creatorId: number, organisationId: number) { +export async function createProject(key: string, name: string, creatorId: number, organisationId: number) { const [project] = await db .insert(Project) .values({ - blob, + key, name, creatorId, organisationId, @@ -17,7 +17,7 @@ export async function createProject(blob: string, name: string, creatorId: numbe export async function updateProject( projectId: number, - updates: { blob?: string; name?: string; creatorId?: number; organisationId?: number }, + updates: { key?: string; name?: string; creatorId?: number; organisationId?: number }, ) { const [project] = await db.update(Project).set(updates).where(eq(Project.id, projectId)).returning(); return project; @@ -35,8 +35,8 @@ export async function getProjectByID(projectId: number) { return project; } -export async function getProjectByBlob(projectBlob: string) { - const [project] = await db.select().from(Project).where(eq(Project.blob, projectBlob)); +export async function getProjectByKey(projectKey: string) { + const [project] = await db.select().from(Project).where(eq(Project.key, projectKey)); return project; } diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts index 47f0c83..2e3c9f0 100644 --- a/packages/backend/src/index.ts +++ b/packages/backend/src/index.ts @@ -20,7 +20,7 @@ const main = async () => { "/issue/create": withCors(withAuth(routes.issueCreate)), "/issue/update": withCors(withAuth(routes.issueUpdate)), "/issue/delete": withCors(withAuth(routes.issueDelete)), - "/issues/:projectBlob": withCors(withAuth(routes.issuesInProject)), + "/issues/:projectKey": withCors(withAuth(routes.issuesInProject)), "/issues/all": withCors(withAuth(routes.issues)), "/organisation/create": withCors(withAuth(routes.organisationCreate)), diff --git a/packages/backend/src/routes/index.ts b/packages/backend/src/routes/index.ts index 9934a76..6c7d4ef 100644 --- a/packages/backend/src/routes/index.ts +++ b/packages/backend/src/routes/index.ts @@ -4,7 +4,7 @@ import authRegister from "./auth/register"; import issueCreate from "./issue/create"; import issueDelete from "./issue/delete"; import issueUpdate from "./issue/update"; -import issuesInProject from "./issues/[projectBlob]"; +import issuesInProject from "./issues/[projectKey]"; import issues from "./issues/all"; import organisationAddMember from "./organisation/add-member"; import organisationById from "./organisation/by-id"; diff --git a/packages/backend/src/routes/issue/create.ts b/packages/backend/src/routes/issue/create.ts index 91cf0bd..0dab5a3 100644 --- a/packages/backend/src/routes/issue/create.ts +++ b/packages/backend/src/routes/issue/create.ts @@ -1,24 +1,24 @@ import type { BunRequest } from "bun"; -import { createIssue, getProjectByID, getProjectByBlob } from "../../db/queries"; +import { createIssue, getProjectByID, getProjectByKey } from "../../db/queries"; // /issue/create?projectId=1&title=Testing&description=Description // OR -// /issue/create?projectBlob=projectBlob&title=Testing&description=Description +// /issue/create?projectKey=projectKey&title=Testing&description=Description export default async function issueCreate(req: BunRequest) { const url = new URL(req.url); const projectId = url.searchParams.get("projectId"); - const projectBlob = url.searchParams.get("projectBlob"); + const projectKey = url.searchParams.get("projectKey"); let project = null; if (projectId) { project = await getProjectByID(Number(projectId)); - } else if (projectBlob) { - project = await getProjectByBlob(projectBlob); + } else if (projectKey) { + project = await getProjectByKey(projectKey); } else { - return new Response("missing project blob or project id", { status: 400 }); + return new Response("missing project key or project id", { status: 400 }); } if (!project) { - return new Response(`project not found: provided ${projectId ?? projectBlob}`, { status: 404 }); + return new Response(`project not found: provided ${projectId ?? projectKey}`, { status: 404 }); } const title = url.searchParams.get("title") || "Untitled Issue"; diff --git a/packages/backend/src/routes/issues/[projectBlob].ts b/packages/backend/src/routes/issues/[projectKey].ts similarity index 56% rename from packages/backend/src/routes/issues/[projectBlob].ts rename to packages/backend/src/routes/issues/[projectKey].ts index b5ff3cb..90bcc6a 100644 --- a/packages/backend/src/routes/issues/[projectBlob].ts +++ b/packages/backend/src/routes/issues/[projectKey].ts @@ -1,12 +1,12 @@ import type { BunRequest } from "bun"; -import { getIssuesWithAssigneeByProject, getProjectByBlob } from "../../db/queries"; +import { getIssuesWithAssigneeByProject, getProjectByKey } from "../../db/queries"; -export default async function issuesInProject(req: BunRequest<"/issues/:projectBlob">) { - const { projectBlob } = req.params; +export default async function issuesInProject(req: BunRequest<"/issues/:projectKey">) { + const { projectKey } = req.params; - const project = await getProjectByBlob(projectBlob); + const project = await getProjectByKey(projectKey); if (!project) { - return new Response(`project not found: provided ${projectBlob}`, { status: 404 }); + return new Response(`project not found: provided ${projectKey}`, { status: 404 }); } const issues = await getIssuesWithAssigneeByProject(project.id); diff --git a/packages/backend/src/routes/project/create.ts b/packages/backend/src/routes/project/create.ts index 76535ef..ca954c0 100644 --- a/packages/backend/src/routes/project/create.ts +++ b/packages/backend/src/routes/project/create.ts @@ -1,25 +1,25 @@ import type { BunRequest } from "bun"; -import { createProject, getProjectByBlob, getUserById } from "../../db/queries"; +import { createProject, getProjectByKey, getUserById } from "../../db/queries"; -// /project/create?blob=BLOB&name=Testing&creatorId=1&organisationId=1 +// /project/create?key=KEY&name=Testing&creatorId=1&organisationId=1 export default async function projectCreate(req: BunRequest) { const url = new URL(req.url); - const blob = url.searchParams.get("blob"); + const key = url.searchParams.get("key"); const name = url.searchParams.get("name"); const creatorId = url.searchParams.get("creatorId"); const organisationId = url.searchParams.get("organisationId"); - if (!blob || !name || !creatorId || !organisationId) { + if (!key || !name || !creatorId || !organisationId) { return new Response( - `missing parameters: ${!blob ? "blob " : ""}${!name ? "name " : ""}${!creatorId ? "creatorId " : ""}${!organisationId ? "organisationId" : ""}`, + `missing parameters: ${!key ? "key " : ""}${!name ? "name " : ""}${!creatorId ? "creatorId " : ""}${!organisationId ? "organisationId" : ""}`, { status: 400 }, ); } - // check if project with blob already exists in the organisation - const existingProject = await getProjectByBlob(blob); + // check if project with key already exists in the organisation + const existingProject = await getProjectByKey(key); if (existingProject?.organisationId === parseInt(organisationId, 10)) { - return new Response(`project with blob ${blob} already exists`, { status: 400 }); + return new Response(`project with key ${key} already exists`, { status: 400 }); } const creator = await getUserById(parseInt(creatorId, 10)); @@ -27,7 +27,7 @@ export default async function projectCreate(req: BunRequest) { return new Response(`creator with id ${creatorId} not found`, { status: 404 }); } - const project = await createProject(blob, name, creator.id, parseInt(organisationId, 10)); + const project = await createProject(key, name, creator.id, parseInt(organisationId, 10)); return Response.json(project); } diff --git a/packages/backend/src/routes/project/update.ts b/packages/backend/src/routes/project/update.ts index fc40a78..23ffd73 100644 --- a/packages/backend/src/routes/project/update.ts +++ b/packages/backend/src/routes/project/update.ts @@ -1,11 +1,11 @@ import type { BunRequest } from "bun"; -import { getProjectByBlob, getProjectByID, getUserById, updateProject } from "../../db/queries"; +import { getProjectByID, getProjectByKey, getUserById, updateProject } from "../../db/queries"; -// /project/update?id=1&blob=NEW&name=new%20name&creatorId=1&organisationId=1 +// /project/update?id=1&key=NEW&name=new%20name&creatorId=1&organisationId=1 export default async function projectUpdate(req: BunRequest) { const url = new URL(req.url); const id = url.searchParams.get("id"); - const blob = url.searchParams.get("blob") || undefined; + const key = url.searchParams.get("key") || undefined; const name = url.searchParams.get("name") || undefined; const creatorId = url.searchParams.get("creatorId") || undefined; const organisationId = url.searchParams.get("organisationId") || undefined; @@ -19,15 +19,15 @@ export default async function projectUpdate(req: BunRequest) { return new Response(`project with id ${id} does not exist`, { status: 404 }); } - if (!blob && !name && !creatorId && !organisationId) { - return new Response(`at least one of blob, name, creatorId, or organisationId must be provided`, { + if (!key && !name && !creatorId && !organisationId) { + return new Response(`at least one of key, name, creatorId, or organisationId must be provided`, { status: 400, }); } - const projectWithBlob = blob ? await getProjectByBlob(blob) : null; - if (projectWithBlob && projectWithBlob.id !== Number(id)) { - return new Response(`a project with blob "${blob}" already exists`, { status: 400 }); + const projectWithKey = key ? await getProjectByKey(key) : null; + if (projectWithKey && projectWithKey.id !== Number(id)) { + return new Response(`a project with key "${key}" already exists`, { status: 400 }); } const newCreator = creatorId ? await getUserById(Number(creatorId)) : null; @@ -36,8 +36,8 @@ export default async function projectUpdate(req: BunRequest) { } const project = await updateProject(Number(id), { - blob: blob, - name: name, + key, + name, creatorId: newCreator?.id, organisationId: organisationId ? Number(organisationId) : undefined, }); diff --git a/packages/frontend/src/Index.tsx b/packages/frontend/src/Index.tsx index ec12311..a937587 100644 --- a/packages/frontend/src/Index.tsx +++ b/packages/frontend/src/Index.tsx @@ -130,7 +130,7 @@ function Index() { useEffect(() => { if (!selectedProject) return; - fetch(`${serverURL}/issues/${selectedProject.Project.blob}`, { headers: getAuthHeaders() }) + fetch(`${serverURL}/issues/${selectedProject.Project.key}`, { headers: getAuthHeaders() }) .then((res) => res.json()) .then((data: IssueResponse[]) => { setIssues(data); diff --git a/packages/frontend/src/components/create-project.tsx b/packages/frontend/src/components/create-project.tsx index 6097fdf..a5eb401 100644 --- a/packages/frontend/src/components/create-project.tsx +++ b/packages/frontend/src/components/create-project.tsx @@ -12,7 +12,7 @@ import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { cn, getAuthHeaders } from "@/lib/utils"; -const blobify = (value: string) => +const keyify = (value: string) => value .toUpperCase() .replace(/[^A-Z0-9]/g, "") @@ -33,11 +33,11 @@ export function CreateProject({ const [open, setOpen] = useState(false); const [name, setName] = useState(""); - const [blob, setBlob] = useState(""); + const [key, setKey] = useState(""); const [nameTouched, setNameTouched] = useState(false); - const [blobTouched, setBlobTouched] = useState(false); - const [blobManuallyEdited, setBlobManuallyEdited] = useState(false); + const [keyTouched, setKeyTouched] = useState(false); + const [keyManuallyEdited, setKeyManuallyEdited] = useState(false); const [submitAttempted, setSubmitAttempted] = useState(false); const [submitting, setSubmitting] = useState(false); @@ -48,20 +48,20 @@ export function CreateProject({ [nameTouched, submitAttempted, name], ); - const blobInvalid = useMemo(() => { - if (!(blobTouched || submitAttempted)) return ""; - if (blob.trim() === "") return "Cannot be empty"; - if (blob.length > 4) return "Must be 4 or less characters"; + const keyInvalid = useMemo(() => { + if (!(keyTouched || submitAttempted)) return ""; + if (key.trim() === "") return "Cannot be empty"; + if (key.length > 4) return "Must be 4 or less characters"; return ""; - }, [blobTouched, submitAttempted, blob]); + }, [keyTouched, submitAttempted, key]); const reset = () => { setName(""); - setBlob(""); + setKey(""); setNameTouched(false); - setBlobTouched(false); - setBlobManuallyEdited(false); + setKeyTouched(false); + setKeyManuallyEdited(false); setSubmitAttempted(false); setSubmitting(false); @@ -80,7 +80,7 @@ export function CreateProject({ setError(null); setSubmitAttempted(true); - if (name.trim() === "" || blob.length > 4) { + if (name.trim() === "" || key.length > 4) { return; } @@ -97,7 +97,7 @@ export function CreateProject({ setSubmitting(true); try { const url = new URL(`${serverURL}/project/create`); - url.searchParams.set("blob", blob); + url.searchParams.set("key", key); url.searchParams.set("name", name.trim()); url.searchParams.set("creatorId", `${userId}`); url.searchParams.set("organisationId", `${organisationId}`); @@ -161,8 +161,8 @@ export function CreateProject({ const nextName = e.target.value; setName(nextName); - if (!blobManuallyEdited) { - setBlob(blobify(nextName)); + if (!keyManuallyEdited) { + setKey(keyify(nextName)); } }} onBlur={() => setNameTouched(true)} @@ -180,23 +180,23 @@ export function CreateProject({
- + { - setBlob(blobify(e.target.value)); - setBlobManuallyEdited(true); + setKey(keyify(e.target.value)); + setKeyManuallyEdited(true); }} - onBlur={() => setBlobTouched(true)} - aria-invalid={blobInvalid !== ""} + onBlur={() => setKeyTouched(true)} + aria-invalid={keyInvalid !== ""} placeholder="DEMO" required />
- {blobInvalid !== "" ? ( - + {keyInvalid !== "" ? ( + ) : ( )} @@ -219,7 +219,7 @@ export function CreateProject({ diff --git a/packages/frontend/src/components/issue-detail-pane.tsx b/packages/frontend/src/components/issue-detail-pane.tsx index 0194352..b962d69 100644 --- a/packages/frontend/src/components/issue-detail-pane.tsx +++ b/packages/frontend/src/components/issue-detail-pane.tsx @@ -18,7 +18,7 @@ export function IssueDetailPane({

- {issueID(project.Project.blob, issueData.Issue.number)} + {issueID(project.Project.key, issueData.Issue.number)}

diff --git a/packages/frontend/src/lib/utils.ts b/packages/frontend/src/lib/utils.ts index 0077a83..89d7c3f 100644 --- a/packages/frontend/src/lib/utils.ts +++ b/packages/frontend/src/lib/utils.ts @@ -5,8 +5,8 @@ export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } -export function issueID(blob: string, num: number) { - return `${blob}-${num.toString().padStart(3, "0")}`; +export function issueID(key: string, num: number) { + return `${key}-${num.toString().padStart(3, "0")}`; } export function getAuthHeaders(): HeadersInit { diff --git a/packages/shared/src/schema.ts b/packages/shared/src/schema.ts index 7bc9b3e..cf38ff5 100644 --- a/packages/shared/src/schema.ts +++ b/packages/shared/src/schema.ts @@ -34,7 +34,7 @@ export const OrganisationMember = pgTable("OrganisationMember", { export const Project = pgTable("Project", { id: integer().primaryKey().generatedAlwaysAsIdentity(), - blob: varchar({ length: 4 }).notNull(), + key: varchar({ length: 4 }).notNull(), name: varchar({ length: 256 }).notNull(), organisationId: integer() .notNull() diff --git a/todo.md b/todo.md index 8e2a57f..2e6f777 100644 --- a/todo.md +++ b/todo.md @@ -1,4 +1,3 @@ - user settings/profile page - create issue - add/invite user(s) to org -- rename Project.blob to Project.key