replaced per-endpoint helpers with ts-rest contract and typed client

This commit is contained in:
2026-01-28 13:01:28 +00:00
parent aa24de2e8e
commit d6af2032db
71 changed files with 1042 additions and 1075 deletions

View File

@@ -1,4 +1,4 @@
import { Issue, IssueComment, type IssueCommentResponse, Project, User } from "@sprint/shared";
import { Issue, IssueComment, type IssueCommentResponseRecord, Project, User } from "@sprint/shared";
import { asc, eq } from "drizzle-orm";
import { db } from "../client";
@@ -23,7 +23,7 @@ export async function getIssueCommentById(id: number) {
return comment;
}
export async function getIssueCommentsByIssueId(issueId: number): Promise<IssueCommentResponse[]> {
export async function getIssueCommentsByIssueId(issueId: number): Promise<IssueCommentResponseRecord[]> {
const comments = await db
.select({
Comment: IssueComment,

View File

@@ -1,4 +1,4 @@
import { Issue, IssueAssignee, type IssueResponse, User, type UserRecord } from "@sprint/shared";
import { Issue, IssueAssignee, type IssueResponseRecord, User, type UserRecord } from "@sprint/shared";
import { aliasedTable, and, eq, inArray, sql } from "drizzle-orm";
import { db } from "../client";
@@ -97,7 +97,7 @@ export async function getIssueByID(id: number) {
return issue;
}
export async function getIssueWithUsersById(issueId: number): Promise<IssueResponse | null> {
export async function getIssueWithUsersById(issueId: number): Promise<IssueResponseRecord | null> {
const Creator = aliasedTable(User, "Creator");
const [issueWithCreator] = await db
@@ -212,7 +212,7 @@ export async function replaceIssueType(organisationId: number, oldType: string,
return { updated: result.rowCount ?? 0 };
}
export async function getIssuesWithUsersByProject(projectId: number): Promise<IssueResponse[]> {
export async function getIssuesWithUsersByProject(projectId: number): Promise<IssueResponseRecord[]> {
const Creator = aliasedTable(User, "Creator");
const issuesWithCreators = await db