ibamsey
ibamsey
TTCTheo's Typesafe Cult
Created by ibamsey on 3/20/2023 in #questions
<suspense>
but with tRPC ?
6 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 11/22/2022 in #questions
tRPC and REST
@rocawear thanks for this, much appreciated and really helpful. I've been working with plain old fetch(). Your code uses axios. I'm just wondering (noob!) what's the primary reason you have used axios over plain fetch ?
15 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 11/22/2022 in #questions
tRPC and REST
Thanks for the responses. SSR is would be nice as would strong types. I've got this largely working, however, has anyone a good example of REST gets from a tRPC router with typing/response validation?
15 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 11/10/2022 in #questions
Programmatically determine which field to update in a Prisma mutation
@Amos, thanks, now have that working. (I'm new to JS and that was the root problem.)
8 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 11/10/2022 in #questions
Programmatically determine which field to update in a Prisma mutation
I only have the new data for one field within the record. So I need to tell the update which field to apply the new data to. (I hope that makes sense) i.e. I don't have the entire tuple. e.g. I want the change FirstName within a User record to "bill".
8 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 11/9/2022 in #questions
Ok, so what am I missing
got ya, thanks for the help.
19 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 11/9/2022 in #questions
Ok, so what am I missing
i'm struggling with that! apologise
19 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 11/9/2022 in #questions
Ok, so what am I missing
@Ronan I think I am using a mutation in my router. But perhaps I'm not understanding. Here's the router
...export const peopleRouter = router({

getPersonById: publicProcedure
.input(
z.object({
id: z.string(),
}),
)
.query(({ ctx , input}) => {
return ctx.prisma.user.findFirst({
where: {
id: input.id
}
});
}),
useMutation: publicProcedure
.input(
z.object({
idx: z.string(),
nu: z.string(),
}),
)
.query(({ ctx , input }) => {
return ctx.prisma.user.update({
data: {
firstname: input.nu
},
where: {
id: input.idx
}
});
}),
...export const peopleRouter = router({

getPersonById: publicProcedure
.input(
z.object({
id: z.string(),
}),
)
.query(({ ctx , input}) => {
return ctx.prisma.user.findFirst({
where: {
id: input.id
}
});
}),
useMutation: publicProcedure
.input(
z.object({
idx: z.string(),
nu: z.string(),
}),
)
.query(({ ctx , input }) => {
return ctx.prisma.user.update({
data: {
firstname: input.nu
},
where: {
id: input.idx
}
});
}),
19 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 11/9/2022 in #questions
Ok, so what am I missing
so, to summariies, a) should use useQuery b) need to call on every render
19 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 11/9/2022 in #questions
Ok, so what am I missing
wow, that's better... will do
19 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 11/7/2022 in #questions
tRPC query syntax
@Koen thanks for that. Helpful.
9 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 11/7/2022 in #questions
tRPC query syntax
@Froxx cheers!
9 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 11/7/2022 in #questions
tRPC query syntax
Thanks @Froxx. I kinda got that bit. It's the synax for the publicProcedure.query(({ctx} blar blar {input} bit that has me scratchin'
9 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 10/22/2022 in #questions
tRPC basics - returning an array
that's helpful. Thanks for taking the time.
4 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 10/11/2022 in #questions
Content Repositories - Please not WP!
I just gave Directus a spin (at least the user side of the cloud free version). Look good enough for what we need. So thanks for that suggestions.
5 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 10/4/2022 in #questions
Multi-tenant - easy no?
good call
88 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 10/4/2022 in #questions
Multi-tenant - easy no?
great point re testing. Running test servers is such an overhead
88 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 10/4/2022 in #questions
Multi-tenant - easy no?
yes, this is a key point, depending on the business model. In some cases you are trying to create a production env which is like each customer having a deploy each and a way of releasing new versions from the repo to every deploy. With multi-t it has the same effect, but with a lot less cost.
88 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 10/4/2022 in #questions
Multi-tenant - easy no?
I see you've been interested in this for a while. Have you made progress or selected an approach?
88 replies
TTCTheo's Typesafe Cult
Created by ibamsey on 10/4/2022 in #questions
Multi-tenant - easy no?
yep. that's about it. You want your customer to have their own database space, no leaks, low risk. You configure a domain an from then on, your code always gets the customer's data. AND, all runs from one repo, one code base and a deploy updates all users systems.
88 replies