Skip to content

Commit 05a9c40

Browse files
committed
fix: remove unused imports and add return types to route handlers
1 parent 33831b3 commit 05a9c40

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

apps/backend/src/routes/team.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {generateUniqueSlug} from '../utils/slug'
55
import { createTeamScehma,inviteMembers,updateTeam } from '../validations/team.validation';
66

77
import type {PlatformLink, PublicProfile} from '@devcard/shared'
8-
import type { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify';
8+
import type { FastifyInstance } from 'fastify';
99

1010
type TeamMember = PublicProfile & {
1111
teamRole: TeamRole
@@ -27,7 +27,7 @@ type TeamProfile = {
2727
export async function teamRoutes(app: FastifyInstance): Promise<void> {
2828
app.post<{
2929
Body: {name: string, description? : string, avatarUrl?: string }
30-
}>('/',{ preHandler: [app.authenticate] }, async (request, reply) => {
30+
}>('/',{ preHandler: [app.authenticate] }, async (request, reply): Promise<void> => {
3131
const userId = request.user.id;
3232
const parsed = createTeamScehma.safeParse(request.body);
3333
if(!parsed.success){
@@ -86,7 +86,7 @@ export async function teamRoutes(app: FastifyInstance): Promise<void> {
8686
}
8787
})
8888

89-
app.get<{Params: {slug: string}}>('/:slug', async (request, reply) => {
89+
app.get<{Params: {slug: string}}>('/:slug', async (request, reply): Promise<void> => {
9090
const paramsSlug = request.params.slug;
9191

9292
try {
@@ -152,7 +152,7 @@ export async function teamRoutes(app: FastifyInstance): Promise<void> {
152152

153153
})
154154

155-
app.post<{Params: {slug:string}, Body:{username:string}}>('/:slug/members', { preHandler: [app.authenticate] }, async (request, reply) => {
155+
app.post<{Params: {slug:string}, Body:{username:string}}>('/:slug/members', { preHandler: [app.authenticate] }, async (request, reply): Promise<void> => {
156156
const paramsSlug = request.params.slug;
157157
const userId = request.user.id;
158158
const parsed = inviteMembers.safeParse(request.body);
@@ -214,7 +214,7 @@ export async function teamRoutes(app: FastifyInstance): Promise<void> {
214214
}
215215
})
216216

217-
app.delete<{Params: {slug: string, userId: string}}>('/:slug/members/:userId',{ preHandler: [app.authenticate] }, async (request, reply) => {
217+
app.delete<{Params: {slug: string, userId: string}}>('/:slug/members/:userId',{ preHandler: [app.authenticate] }, async (request, reply): Promise<void> => {
218218
const paramsSlug = request.params.slug
219219
const paramsUserId = request.params.userId
220220
const userId = request.user.id;
@@ -276,7 +276,7 @@ export async function teamRoutes(app: FastifyInstance): Promise<void> {
276276
}
277277
})
278278

279-
app.patch<{Params: {slug: string},Body: {description?:string, name?:string, avatarUrl?:string}}>('/:slug',{ preHandler: [app.authenticate] }, async (request, reply) => {
279+
app.patch<{Params: {slug: string},Body: {description?:string, name?:string, avatarUrl?:string}}>('/:slug',{ preHandler: [app.authenticate] }, async (request, reply): Promise<void> => {
280280
const userId = request.user.id;
281281
const paramsSlug = request.params.slug;
282282
const parsed = updateTeam.safeParse(request.body);
@@ -318,7 +318,7 @@ export async function teamRoutes(app: FastifyInstance): Promise<void> {
318318

319319
})
320320

321-
app.delete<{Params:{slug: string}}>('/:slug',{ preHandler: [app.authenticate] }, async (request, reply) => {
321+
app.delete<{Params:{slug: string}}>('/:slug',{ preHandler: [app.authenticate] }, async (request, reply): Promise<void> => {
322322
const userId = request.user.id;
323323
const paramsSlug = request.params.slug;
324324

@@ -354,7 +354,7 @@ export async function teamRoutes(app: FastifyInstance): Promise<void> {
354354
}
355355
})
356356

357-
app.get<{Params:{slug:string}}>('/:slug/qr', async (request, reply) => {
357+
app.get<{Params:{slug:string}}>('/:slug/qr', async (request, reply): Promise<void> => {
358358
const paramsSlug = request.params.slug;
359359
try {
360360
const teamDetails = await app.prisma.team.findUnique({

0 commit comments

Comments
 (0)