fix(ci): lint and a11y fixes unblocks GHA deploy
- materi/new/page.tsx: add htmlFor+id pairs for all 5 form labels (a11y)
- biome --write --unsafe: fix useTemplate, useLiteralKeys, import sort
across materi module files (backend + frontend)
- These pre-existing lint errors from 0aa893a blocked the deploy pipeline
This commit is contained in:
committed by
asepharyana
parent
5658726ea5
commit
7f4196124d
@@ -2,8 +2,13 @@
|
||||
import { createORPCClient } from "@orpc/client";
|
||||
import { RPCLink } from "@orpc/client/fetch";
|
||||
import { orpc } from "@/lib/orpc/client";
|
||||
import type { MateriDocument, CreateMateriInput, MateriRagChatResult, MateriRagChatMessage } from "@/lib/types/materi";
|
||||
import type { ORPCClient } from "@/lib/orpc/types";
|
||||
import type {
|
||||
CreateMateriInput,
|
||||
MateriDocument,
|
||||
MateriRagChatMessage,
|
||||
MateriRagChatResult,
|
||||
} from "@/lib/types/materi";
|
||||
|
||||
const BACKEND_URL =
|
||||
process.env.GMW_BACKEND_URL?.replace(/\/+$/, "") || "http://127.0.0.1:4001";
|
||||
@@ -12,7 +17,7 @@ let _serverClient: ORPCClient | null = null;
|
||||
function serverOrpc(): ORPCClient {
|
||||
if (!_serverClient) {
|
||||
const link = new RPCLink({
|
||||
url: BACKEND_URL + "/trpc",
|
||||
url: `${BACKEND_URL}/trpc`,
|
||||
fetch(url, init) {
|
||||
return fetch(url, { ...init, cache: "no-store" });
|
||||
},
|
||||
@@ -23,7 +28,10 @@ function serverOrpc(): ORPCClient {
|
||||
}
|
||||
|
||||
// Server-side (SSR seed) — uses the HTTP RPCLink via oRPC
|
||||
export async function listMateriSSR(limit = 50, search?: string): Promise<MateriDocument[]> {
|
||||
export async function listMateriSSR(
|
||||
limit = 50,
|
||||
search?: string,
|
||||
): Promise<MateriDocument[]> {
|
||||
return (serverOrpc() as any).materi.list({
|
||||
limit,
|
||||
search,
|
||||
@@ -37,7 +45,9 @@ export async function getMateriSSR(id: string): Promise<MateriDocument | null> {
|
||||
}
|
||||
|
||||
// Client-side — browser WebSocket RPCLink (orpc is "use client")
|
||||
export async function createMateri(input: CreateMateriInput): Promise<MateriDocument> {
|
||||
export async function createMateri(
|
||||
input: CreateMateriInput,
|
||||
): Promise<MateriDocument> {
|
||||
return orpc.materi.create(input) as unknown as Promise<MateriDocument>;
|
||||
}
|
||||
|
||||
@@ -45,7 +55,10 @@ export async function updateMateri(
|
||||
id: string,
|
||||
input: Partial<CreateMateriInput>,
|
||||
): Promise<MateriDocument | null> {
|
||||
return orpc.materi.update({ id, ...input }) as unknown as Promise<MateriDocument | null>;
|
||||
return orpc.materi.update({
|
||||
id,
|
||||
...input,
|
||||
}) as unknown as Promise<MateriDocument | null>;
|
||||
}
|
||||
|
||||
export async function deleteMateri(id: string): Promise<boolean> {
|
||||
|
||||
Reference in New Issue
Block a user