Skip to content

Commit bfee3c6

Browse files
authored
fix(card): Fixes typecheck (#625)
* fix(card): Fixes typecheck * fix: Updated the type name
1 parent c36d35b commit bfee3c6

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

apps/backend/src/routes/cards.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { handleDbError } from '../utils/error.util.js';
33
import { hashIp } from '../utils/refreshToken';
44
import { createCardSchema ,updateCardSchema, addPlatformLinkSchema} from '../validations/card.validation';
55

6-
import type { CardResponse, UpdateCardBody } from '../services/cardService';
6+
import type { CardResponse, UpdateCardBody, UpdatedCardResponse } from '../services/cardService';
77
import type { Card } from '@devcard/shared/src/types.js';
88
import type { CardVisibility } from '@prisma/client';
99
import type { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify';
@@ -99,7 +99,7 @@ export async function cardRoutes(app: FastifyInstance): Promise<void> {
9999

100100
// ─── Update Card ───
101101

102-
app.put('/:id', async (request: FastifyRequest<{ Params: CardParams; Body: UpdateCardBody }>, reply: FastifyReply): Promise<CardResponse> => {
102+
app.put('/:id', async (request: FastifyRequest<{ Params: CardParams; Body: UpdateCardBody }>, reply: FastifyReply): Promise<UpdatedCardResponse> => {
103103
const userId = request.user.id;
104104
const { id } = request.params;
105105

apps/backend/src/services/cardService.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ type CardLinkResponse = { platformLink: unknown };
1010
type RawCard = { id: string; title: string; isDefault: boolean; cardLinks: CardLinkResponse[] };
1111
export type CardResponse = { id: string; title: string; isDefault: boolean; links: unknown[] };
1212

13+
export type UpdatedCardResponse = {
14+
id: string;
15+
title: string;
16+
isDefault:boolean;
17+
}
1318

1419
export interface UpdateCardBody{
1520
title?:string;

0 commit comments

Comments
 (0)