mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 02:33:01 +00:00
replaced per-endpoint helpers with ts-rest contract and typed client
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user