noctate
noctate
Explore posts from servers
CDCloudflare Developers
Created by noctate on 6/26/2023 in #general-help
optimizing images
thanks! @chaika.me
5 replies
CDCloudflare Developers
Created by noctate on 6/26/2023 in #general-help
optimizing images
@chaika.me that's interesting, can you give me some example how can I use image resizing with r2?
5 replies
CDCloudflare Developers
Created by noctate on 6/2/2023 in #r2
sid 3835 no im using module helper for
turns out this module was not the right fit for the job, I have used ex_aws s3 library and it's working! Thanks, you help me get on the right track!
5 replies
CDCloudflare Developers
Created by noctate on 6/2/2023 in #r2
sid 3835 no im using module helper for
hmm but again i dont understand why with aws and the same code, same cors policies, I can see in the RESPONSE headers I can clearly see the 'Access-Control-Allow-Origin' header, but not with the r2 api
5 replies
CDCloudflare Developers
Created by noctate on 6/2/2023 in #r2
sid 3835 no im using module helper for
but i think this module should handle that stuff, it does for s3, I believe? https://gist.github.com/chrismccord/37862f1f8b1f5148644b75d20d1cb073 this is the way to do it in liveview which is a weird hybrid of client and server in phoenix, how can I make sure that headers are set correctly?
5 replies
TTCTheo's Typesafe Cult
Created by kenny on 4/19/2023 in #questions
How to SSG a page from my T3 app??
May I Ask what data do you need statically generated? Seems odd for a chat
78 replies
TTCTheo's Typesafe Cult
Created by noctate on 4/17/2023 in #questions
kysely join select query
I see! Thank you!
9 replies
TTCTheo's Typesafe Cult
Created by noctate on 4/17/2023 in #questions
kysely join select query
Its interesting because if I would do query that don't use count then both votedAgainstId and voteForId are in the result
9 replies
TTCTheo's Typesafe Cult
Created by noctate on 4/17/2023 in #questions
kysely join select query
Nope, the voteAgainst Has the same count value as voteFor. But when I change the leftJoin to use 'votedAgainstId', the opposite is happening.
9 replies
TTCTheo's Typesafe Cult
Created by noctate on 4/2/2023 in #questions
insert query in kysely, typerror
after some research I changed the type to this interface
VoteAnime {
id: Generated<string>;
votedForId: number;
votedAgainstId: number;
createdAt: Generated<Date>;
}
VoteAnime {
id: Generated<string>;
votedForId: number;
votedAgainstId: number;
createdAt: Generated<Date>;
}
but now I get error: Field 'id' doesn't have a default value when trying to fire mutation. when constructing the prisma schema and pushing it to database I chosed
id String @id @default(cuid())
id String @id @default(cuid())
so I guess it should have a default value?
4 replies
TTCTheo's Typesafe Cult
Created by noctate on 4/2/2023 in #questions
insert query in kysely, typerror
to give more context the this is vote anime type:
type VoteAnime = {
id: string
createdAt: Date
votedForId: number
votedAgainstId: number
animeId: number | null
}
type VoteAnime = {
id: string
createdAt: Date
votedForId: number
votedAgainstId: number
animeId: number | null
}
4 replies
TTCTheo's Typesafe Cult
Created by Simvolick on 3/7/2023 in #questions
Any resources to learn the tRPC better? Hopefully with guides and examples?
But its recommended i think
18 replies
TTCTheo's Typesafe Cult
Created by Simvolick on 3/7/2023 in #questions
Any resources to learn the tRPC better? Hopefully with guides and examples?
I also use zod to parse the data to know its shape but you don't have to do that
18 replies
TTCTheo's Typesafe Cult
Created by Simvolick on 3/7/2023 in #questions
Any resources to learn the tRPC better? Hopefully with guides and examples?
In one of my project I do it like this:
export const coinRouter = router({
getCoin: publicProcedure
.input(z.object({ name: z.string()}))
.query(async ({ input }) => {
const coin = await fetch(`https://api.coingecko.com/api/v3/coins/${input.name}?sparkline=true`).then(res =>
res.json());
const parsedData = coinResult.parse(coin)
return parsedData
})
})
export const coinRouter = router({
getCoin: publicProcedure
.input(z.object({ name: z.string()}))
.query(async ({ input }) => {
const coin = await fetch(`https://api.coingecko.com/api/v3/coins/${input.name}?sparkline=true`).then(res =>
res.json());
const parsedData = coinResult.parse(coin)
return parsedData
})
})
you can probably add something like error handling etc
18 replies
TTCTheo's Typesafe Cult
Created by Simvolick on 3/7/2023 in #questions
Any resources to learn the tRPC better? Hopefully with guides and examples?
What are the things that you find confusing
18 replies
TTCTheo's Typesafe Cult
Created by noctate on 3/6/2023 in #questions
How to type object like this as props
https://create.t3.gg/en/usage/trpc/#optimistic-updates i just copied example from the docs to use optimistic updates. I wanted to pass it as props because too different components use this add todo, so didnt wanted repeat myself. For now I choosed to extract all logic inside useTodos hook and just use it something like this:
const CreateTodo = () => {
const {addTodo} = useTodos();
}
const CreateTodo = () => {
const {addTodo} = useTodos();
}
6 replies