'tonyyprints'
'tonyyprints'
Explore posts from servers
DTDrizzle Team
Created by 'tonyyprints' on 6/12/2024 in #help
Migrations taking the first snapshot
No description
2 replies
TtRPC
Created by 'tonyyprints' on 5/11/2024 in #❓-help
Error: TRPCError: A non-domain error occurred
Been just randomly getting these. Has anyone else and do u know what it could be caused by?
2 replies
DTDrizzle Team
Created by 'tonyyprints' on 3/24/2024 in #help
bigint is not a number
I'm trying to execute this query but get the following error that I'm hoping someone here can help me with:
const profilePhoto = await ctx.db.query.profile.findFirst({
where: eq(schema.profile.id, profile.profileId),
columns: {
profilePhotoId: true,
},
})
const profilePhoto = await ctx.db.query.profile.findFirst({
where: eq(schema.profile.id, profile.profileId),
columns: {
profilePhotoId: true,
},
})
but get the following overload error:
Argument of type bigint is not assignable to parameter of type number | SQLWrapper.
Argument of type bigint is not assignable to parameter of type number | SQLWrapper.
My schema for the related fields are also posted below.
export const profile = mySqlTable("Profile", {
id: serial("id").primaryKey(),
userName: varchar("userName", { length: 255 }).unique().notNull(),
bio: text("bio"),
profilePhotoId: bigint("profilePhoto", {mode: "bigint", unsigned: true}).references(() => profilePhoto.id),
createdAt: timestamp("createdAt")
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
updatedAt: timestamp("updatedAt").onUpdateNow(),
});

export const profileRelations = relations(profile, ({ one, many }) => ({
profilePhoto: one(profilePhoto, {
fields: [profile.profilePhotoId],
references: [profilePhoto.id],
}),
posts: many(post),
}));

export const profilePhoto = mySqlTable("ProfilePhoto", {
id: serial("id").primaryKey().notNull(),
url: varchar("url", { length: 255 }).notNull(),
// key: varchar("varchar", { length: 255 }).notNull(),
createdAt: timestamp("createdAt")
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
updatedAt: timestamp("updatedAt").onUpdateNow(),
});

export const profilePhotoRelations = relations(profilePhoto, ({ one }) => ({
profile: one(profile, {
fields: [profilePhoto.id],
references: [profile.id],
}),
}));
export const profile = mySqlTable("Profile", {
id: serial("id").primaryKey(),
userName: varchar("userName", { length: 255 }).unique().notNull(),
bio: text("bio"),
profilePhotoId: bigint("profilePhoto", {mode: "bigint", unsigned: true}).references(() => profilePhoto.id),
createdAt: timestamp("createdAt")
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
updatedAt: timestamp("updatedAt").onUpdateNow(),
});

export const profileRelations = relations(profile, ({ one, many }) => ({
profilePhoto: one(profilePhoto, {
fields: [profile.profilePhotoId],
references: [profilePhoto.id],
}),
posts: many(post),
}));

export const profilePhoto = mySqlTable("ProfilePhoto", {
id: serial("id").primaryKey().notNull(),
url: varchar("url", { length: 255 }).notNull(),
// key: varchar("varchar", { length: 255 }).notNull(),
createdAt: timestamp("createdAt")
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
updatedAt: timestamp("updatedAt").onUpdateNow(),
});

export const profilePhotoRelations = relations(profilePhoto, ({ one }) => ({
profile: one(profile, {
fields: [profilePhoto.id],
references: [profile.id],
}),
}));
7 replies
TTCTheo's Typesafe Cult
Created by 'tonyyprints' on 2/1/2024 in #questions
Running script from root
No description
3 replies
TTCTheo's Typesafe Cult
Created by 'tonyyprints' on 11/6/2023 in #questions
tRPC not returning string
I have a procedure that generates a presigned url and sends it to the frontend. When I print the url in the trpc procedure it prints, but when I try to print it on the frontend, it doesn't. Clientside
const Camera = () => {

const [image, setImage] = useState(null);
const mutation = api.media.postImage.useMutation();

...
const pickImage = async () => {
...
const url = mutation.mutate({bucket: "myawsbucket-0xc3", key: "testKey123", caption: "test caption", tags: ["otherUserKey"]});
console.log("url on frontend: ", url);
};

return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Button title="Pick an image from camera roll" onPress={pickImage} />
{image && <Image source={{ uri: image }} style={{ width: 200, height: 200 }} />}
</View>
);
}
export default Camera;
const Camera = () => {

const [image, setImage] = useState(null);
const mutation = api.media.postImage.useMutation();

...
const pickImage = async () => {
...
const url = mutation.mutate({bucket: "myawsbucket-0xc3", key: "testKey123", caption: "test caption", tags: ["otherUserKey"]});
console.log("url on frontend: ", url);
};

return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Button title="Pick an image from camera roll" onPress={pickImage} />
{image && <Image source={{ uri: image }} style={{ width: 200, height: 200 }} />}
</View>
);
}
export default Camera;
tRPC
postImage: protectedProcedure
.input(
z.object({
bucket: z.string(),
key: z.string(),
caption: z.string().optional(),
tags: z.array(z.string()),
}),
)
.output(z.string())
.mutation(async ({ ctx, input }) => {
const metadata = {
AuthorId: ctx.session.uid,
};
if (input.caption) {
metadata["Caption" as keyof typeof metadata] = input.caption;
}

if (input.tags.length > 0) {
input.tags.forEach((tag, index) => {
metadata[`Tag${index}` as keyof typeof metadata] = tag;
});
}

const putObjectParams = {
Bucket: input.bucket,
Key: input.key,
Metadata: metadata,
};

const url = await getSignedUrl(ctx.s3, new PutObjectCommand(putObjectParams), {
expiresIn: 3600,
});
console.log("url", url);
return url;
}),
postImage: protectedProcedure
.input(
z.object({
bucket: z.string(),
key: z.string(),
caption: z.string().optional(),
tags: z.array(z.string()),
}),
)
.output(z.string())
.mutation(async ({ ctx, input }) => {
const metadata = {
AuthorId: ctx.session.uid,
};
if (input.caption) {
metadata["Caption" as keyof typeof metadata] = input.caption;
}

if (input.tags.length > 0) {
input.tags.forEach((tag, index) => {
metadata[`Tag${index}` as keyof typeof metadata] = tag;
});
}

const putObjectParams = {
Bucket: input.bucket,
Key: input.key,
Metadata: metadata,
};

const url = await getSignedUrl(ctx.s3, new PutObjectCommand(putObjectParams), {
expiresIn: 3600,
});
console.log("url", url);
return url;
}),
2 replies
TTCTheo's Typesafe Cult
Created by 'tonyyprints' on 9/15/2023 in #questions
NextAuth Discord Provider Callback Error
No description
2 replies
TTCTheo's Typesafe Cult
Created by 'tonyyprints' on 9/5/2023 in #questions
discord callback url
No description
24 replies
TTCTheo's Typesafe Cult
Created by 'tonyyprints' on 8/31/2023 in #questions
Discord not signing in
No description
9 replies
TTCTheo's Typesafe Cult
Created by 'tonyyprints' on 3/19/2023 in #questions
Google Provider when deploying
I'm trying to deploy my project on vercel with a custom domain, but I'm getting an error that says something like: Google OAuth 2 authorization - Error: redirect_uri_mismatch. does anyone know how to fix this?
4 replies
TTCTheo's Typesafe Cult
Created by 'tonyyprints' on 2/18/2023 in #questions
mutation is returning void
27 replies
TTCTheo's Typesafe Cult
Created by 'tonyyprints' on 2/16/2023 in #questions
Yo gangster my is my optimistic ui update look funny
3 replies
TTCTheo's Typesafe Cult
Created by 'tonyyprints' on 2/11/2023 in #questions
should I use ctx or api?
No description
14 replies
TTCTheo's Typesafe Cult
Created by 'tonyyprints' on 2/10/2023 in #questions
I'm trying to change the image in my img tag (html tag not next component), but it's saying module n
4 replies
TTCTheo's Typesafe Cult
Created by 'tonyyprints' on 2/8/2023 in #questions
Tailwind component I copy and pasted is buggin
8 replies
TTCTheo's Typesafe Cult
Created by 'tonyyprints' on 2/8/2023 in #questions
what are the backgrounds like the one ping.gg uses called
I need answer, very urgent thank you
11 replies
TTCTheo's Typesafe Cult
Created by 'tonyyprints' on 1/26/2023 in #questions
trying to add role based authentication
49 replies
TTCTheo's Typesafe Cult
Created by 'tonyyprints' on 1/25/2023 in #questions
adding provider causes type error
22 replies
TTCTheo's Typesafe Cult
Created by 'tonyyprints' on 12/29/2022 in #questions
Quick question on concept
does the implementation of TRPC replace getStaticProps in nextjs. getStaticProps. I just havn't seen getStaticProps anywhere in the example T3 stack project. "Essentially, getStaticProps allows you to tell Next.js: “Hey, this page has some data dependencies — so when you pre-render this page at build time, make sure to resolve them first!”".
4 replies