Skip to content

Commit be2f1b9

Browse files
committed
fix(backend): resolve eslint errors in routes and services
1 parent 2f19e05 commit be2f1b9

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

apps/backend/src/routes/team.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {generateUniqueSlug} from '../utils/slug.js'
55
import { createTeamScehma,inviteMembers,updateTeam } from '../validations/team.validation.js';
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

apps/backend/src/services/profileService.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import type { FastifyInstance } from 'fastify'
21
import { getProfileUrl } from '@devcard/shared'
2+
33
import { getErrorMessage } from '../utils/error.util.js'
44

5+
import type { FastifyInstance } from 'fastify'
6+
57
export async function getOwnProfile(app: FastifyInstance, userId: string) {
68
const user = await app.prisma.user.findUnique({
79
where: { id: userId },
@@ -11,9 +13,9 @@ export async function getOwnProfile(app: FastifyInstance, userId: string) {
1113
},
1214
})
1315

14-
if (!user) return null
16+
if (!user) {return null}
1517

16-
const { provider, providerId, ...profileData } = user as any
18+
const { provider: _provider, providerId: _providerId, ...profileData } = user as any
1719
return { ...profileData, defaultCardId: user.cards[0]?.id || null }
1820
}
1921

@@ -23,7 +25,7 @@ export async function updateProfile(app: FastifyInstance, userId: string, data:
2325
const existing = await app.prisma.user.findFirst({
2426
where: { username: data.username, NOT: { id: userId } },
2527
})
26-
if (existing) throw Object.assign(new Error('Username taken'), { code: 'P2002' })
28+
if (existing) {throw Object.assign(new Error('Username taken'), { code: 'P2002' })}
2729
}
2830

2931
const currentUser = await app.prisma.user.findUnique({ where: { id: userId }, select: { username: true } })
@@ -41,7 +43,7 @@ export async function updateProfile(app: FastifyInstance, userId: string, data:
4143

4244
return response
4345
} catch (err: any) {
44-
if (err?.code === 'P2002') throw err
46+
if (err?.code === 'P2002') {throw err}
4547
app.log.error({ err }, 'DB error in updateProfile')
4648
throw err
4749
}
@@ -55,14 +57,14 @@ export async function createPlatformLink(app: FastifyInstance, userId: string, l
5557

5658
export async function updatePlatformLink(app: FastifyInstance, userId: string, id: string, linkData: any) {
5759
const existing = await app.prisma.platformLink.findFirst({ where: { id, userId } })
58-
if (!existing) return null
60+
if (!existing) {return null}
5961
const url = linkData.url || getProfileUrl(linkData.platform, linkData.username)
6062
return app.prisma.platformLink.update({ where: { id }, data: { platform: linkData.platform, username: linkData.username, url } })
6163
}
6264

6365
export async function deletePlatformLink(app: FastifyInstance, userId: string, id: string) {
6466
const existing = await app.prisma.platformLink.findFirst({ where: { id, userId } })
65-
if (!existing) return false
67+
if (!existing) {return false}
6668
await app.prisma.platformLink.delete({ where: { id } })
6769
return true
6870
}

0 commit comments

Comments
 (0)