@@ -27,7 +27,7 @@ type TeamProfile = {
2727export 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 ) : Promise < void > => {
30+ } > ( '/' , { preHandler : [ app . authenticate . bind ( app ) ] } , async ( request , reply ) : Promise < void > => {
3131 const userId = request . user . id ;
3232 const parsed = createTeamScehma . safeParse ( request . body ) ;
3333 if ( ! parsed . success ) {
@@ -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 ) : Promise < void > => {
155+ app . post < { Params : { slug :string } , Body :{ username :string } } > ( '/:slug/members' , { preHandler : [ app . authenticate . bind ( app ) ] } , 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 ) : Promise < void > => {
217+ app . delete < { Params : { slug : string , userId : string } } > ( '/:slug/members/:userId' , { preHandler : [ app . authenticate . bind ( app ) ] } , 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 ) : Promise < void > => {
279+ app . patch < { Params : { slug : string } , Body : { description ?:string , name ?:string , avatarUrl ?:string } } > ( '/:slug' , { preHandler : [ app . authenticate . bind ( app ) ] } , 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 ) : Promise < void > => {
321+ app . delete < { Params :{ slug : string } } > ( '/:slug' , { preHandler : [ app . authenticate . bind ( app ) ] } , async ( request , reply ) : Promise < void > => {
322322 const userId = request . user . id ;
323323 const paramsSlug = request . params . slug ;
324324
0 commit comments