stunaz
stunaz
Explore posts from servers
TTCTheo's Typesafe Cult
Created by stunaz on 7/31/2023 in #questions
eslint
I am failing to see a repository using the following:
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
I throw this in project, and got hundreds of error. The most i saw are: - @typescript-eslint/no-floating-promises ( I mean, using a simple router.push generates an error) - @typescript-eslint/no-unsafe-assignment I mean they are valid errors, but meh So far I failed to see an app using those rules
1 replies
TTCTheo's Typesafe Cult
Created by stunaz on 7/25/2023 in #questions
Server Side business rules validation
The context: I need to confirm a booking: So the user just pressed a button on the browser to confirm the booking Then I just need to update the booking status. But I'd like to perform some validation before. is this the right way to achieve that?
export const confirmBooking = () => {
return protectedProcedure.input(z.string().uuid()).mutation(async ({ input, ctx }) => {
// fetch the booking object
// perform validation
// reject if any error

return await ctx.db.update(bookings)
.set({ status: 'CONFIRMED' })
.where(eq(bookings.id, input))
);
});
};
export const confirmBooking = () => {
return protectedProcedure.input(z.string().uuid()).mutation(async ({ input, ctx }) => {
// fetch the booking object
// perform validation
// reject if any error

return await ctx.db.update(bookings)
.set({ status: 'CONFIRMED' })
.where(eq(bookings.id, input))
);
});
};
4 replies
TTCTheo's Typesafe Cult
Created by stunaz on 4/2/2023 in #questions
Client variables not typesafed
3 replies