Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/backend/src/routes/cards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { handleDbError } from '../utils/error.util.js';
import { hashIp } from '../utils/refreshToken';
import { createCardSchema ,updateCardSchema, addPlatformLinkSchema} from '../validations/card.validation';

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

// ─── Update Card ───

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

Expand Down
5 changes: 5 additions & 0 deletions apps/backend/src/services/cardService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ type CardLinkResponse = { platformLink: unknown };
type RawCard = { id: string; title: string; isDefault: boolean; cardLinks: CardLinkResponse[] };
export type CardResponse = { id: string; title: string; isDefault: boolean; links: unknown[] };

export type UpdatedCardResponse = {
id: string;
title: string;
isDefault:boolean;
}

export interface UpdateCardBody{
title?:string;
Expand Down