Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/app/api/issues/move/route.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib/prisma";
import { updateIssueLabels, removeIssueLabel, addIssueLabel } from "@/lib/github";
import { STATUS_LABELS, StatusLabel } from "@/types";
import { STATUS_LABELS, isStatusLabel } from "@/types";
import { authorizeRequest, getAuthorizedActor } from "@/lib/auth";

function isStatusLabel(label: string): label is StatusLabel {
return (STATUS_LABELS as readonly string[]).includes(label);
}

export async function POST(request: Request) {
const auth = await authorizeRequest(request);
if (!auth.authorized) {
Expand Down
6 changes: 1 addition & 5 deletions src/app/api/issues/status/route.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib/prisma";
import { removeIssueLabel, addIssueLabel } from "@/lib/github";
import { STATUS_LABELS, StatusLabel } from "@/types";
import { STATUS_LABELS, StatusLabel, isStatusLabel } from "@/types";
import { authorizeRequest, getAuthorizedActor } from "@/lib/auth";

function isStatusLabel(label: string): label is StatusLabel {
return (STATUS_LABELS as readonly string[]).includes(label);
}

export async function POST(request: Request) {
const auth = await authorizeRequest(request);
if (!auth.authorized) {
Expand Down
5 changes: 5 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ export const BOARD_COLUMNS: BoardColumn[] = [

export const STATUS_LABELS: StatusLabel[] = BOARD_COLUMNS.map((col) => col.id);
export const PRIORITY_LABELS: PriorityLabel[] = ["priority/p0", "priority/p1", "priority/p2", "priority/p3"];

/** Type guard: is `label` one of the allowed `status/*` labels? */
export function isStatusLabel(label: string): label is StatusLabel {
return (STATUS_LABELS as readonly string[]).includes(label);
}
export const PROJECT_PREFIX = "project/";
export const AGENT_PREFIX = "agent/";
export const OWNER_PREFIX = "owner/";
Expand Down