统一前后端代码格式化配置

This commit is contained in:
yml2213
2026-08-16 17:27:12 +08:00
parent 8705f6a6a1
commit 5c7c3e14e3
278 changed files with 6386 additions and 5500 deletions
@@ -26,12 +26,16 @@ type ClaimTokenCreateInput = {
updatedAt: string
}
type ClaimTokenPatch = Partial<Pick<
ClaimTokenRow,
'status' | 'expired_at' | 'used_at' | 'max_use_count' | 'used_count' | 'updated_at'
>>
type ClaimTokenPatch = Partial<
Pick<
ClaimTokenRow,
'status' | 'expired_at' | 'used_at' | 'max_use_count' | 'used_count' | 'updated_at'
>
>
export async function createClaimToken(input: ClaimTokenCreateInput): Promise<ClaimTokenRow | null> {
export async function createClaimToken(
input: ClaimTokenCreateInput,
): Promise<ClaimTokenRow | null> {
const result = await query<ClaimTokenRow>(
`
INSERT INTO claim_tokens (
@@ -74,16 +78,23 @@ export async function createClaimToken(input: ClaimTokenCreateInput): Promise<Cl
}
export async function getClaimTokenById(tokenId: number | string): Promise<ClaimTokenRow | null> {
const result = await query<ClaimTokenRow>('SELECT * FROM claim_tokens WHERE id = $1 LIMIT 1', [Number(tokenId)])
const result = await query<ClaimTokenRow>('SELECT * FROM claim_tokens WHERE id = $1 LIMIT 1', [
Number(tokenId),
])
return result.rows[0] || null
}
export async function findClaimTokenByToken(token: string): Promise<ClaimTokenRow | null> {
const result = await query<ClaimTokenRow>('SELECT * FROM claim_tokens WHERE token = $1 LIMIT 1', [String(token || '').trim()])
const result = await query<ClaimTokenRow>('SELECT * FROM claim_tokens WHERE token = $1 LIMIT 1', [
String(token || '').trim(),
])
return result.rows[0] || null
}
export async function updateClaimToken(tokenId: number | string, patch: ClaimTokenPatch): Promise<ClaimTokenRow | null> {
export async function updateClaimToken(
tokenId: number | string,
patch: ClaimTokenPatch,
): Promise<ClaimTokenRow | null> {
const current = await getClaimTokenById(tokenId)
if (!current) {
return null