Ayato
Ayato
Explore posts from servers
CDCloudflare Developers
Created by Ayato on 8/23/2024 in #general-help
Tunnel SSH SetUp Help
No description
9 replies
TTCTheo's Typesafe Cult
Created by Ayato on 6/14/2023 in #questions
YouTube Data API
Hi, I would like to write a script, that get the channel_id from a channel url. For this, I was trying to use the username: https://www.youtube.com/@t3dotgg -> t3dotgg https://youtube.googleapis.com/youtube/v3/channels?part=id&forUsername=t3dotgg&key=[YOUR_API_KEY] but I get this response: 200
{
"kind": "youtube#channelListResponse",
"etag": "RuuXzTIr0OoDqI4S0RU6n4FqKEM",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 5
}
}
{
"kind": "youtube#channelListResponse",
"etag": "RuuXzTIr0OoDqI4S0RU6n4FqKEM",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 5
}
}
but if I use a different username like ludwig it works: 200
{
"kind": "youtube#channelListResponse",
"etag": "TAcFH8yqbppZUNBGKLFmQiISJUg",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#channel",
"etag": "uyh-UPnVJ-53EQBU_y-FVSAZ7xw",
"id": "UCZL4arowpEICMkWEPyx_vaQ"
}
]
}
{
"kind": "youtube#channelListResponse",
"etag": "TAcFH8yqbppZUNBGKLFmQiISJUg",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#channel",
"etag": "uyh-UPnVJ-53EQBU_y-FVSAZ7xw",
"id": "UCZL4arowpEICMkWEPyx_vaQ"
}
]
}
7 replies
TTCTheo's Typesafe Cult
Created by Ayato on 4/17/2023 in #questions
tRPC Mutation
7 replies
TTCTheo's Typesafe Cult
Created by Ayato on 4/15/2023 in #questions
<Select onChange()>
4 replies
TTCTheo's Typesafe Cult
Created by Ayato on 4/13/2023 in #questions
typescript-eslint
import { type AppType } from "next/app";
import { type Session } from "next-auth";
import { SessionProvider } from "next-auth/react";
import Sidebar from "~/components/Sidebar";
import Navbar from "~/components/Navbar";

import { api } from "~/utils/api";

import "~/styles/globals.css";

const MyApp: AppType<{ session: Session | null }> = ({
Component,
pageProps: { session, ...pageProps },
}) => {
return (
<SessionProvider session={session}>
<div className="flex">
<Sidebar />
<div className="flex flex-1 ml-56">
<Component {...pageProps} />
</div>
</div>
</SessionProvider>
);
};

export default api.withTRPC(MyApp); // <-- Error
import { type AppType } from "next/app";
import { type Session } from "next-auth";
import { SessionProvider } from "next-auth/react";
import Sidebar from "~/components/Sidebar";
import Navbar from "~/components/Navbar";

import { api } from "~/utils/api";

import "~/styles/globals.css";

const MyApp: AppType<{ session: Session | null }> = ({
Component,
pageProps: { session, ...pageProps },
}) => {
return (
<SessionProvider session={session}>
<div className="flex">
<Sidebar />
<div className="flex flex-1 ml-56">
<Component {...pageProps} />
</div>
</div>
</SessionProvider>
);
};

export default api.withTRPC(MyApp); // <-- Error
Can Somehow help me fix this?
2 replies
TTCTheo's Typesafe Cult
Created by Ayato on 4/10/2023 in #questions
Which icon set would you recommend?
If you have a different icon set that you like, I will add it to the list. 🇦 - Heroicons 2 https://github.com/tailwindlabs/heroicons 🇧 - Material Design icons http://google.github.io/material-design-icons 🇨 - Ant Design Icons https://github.com/ant-design/ant-design-icons 🇩 - Font Awesome 5 https://fontawesome.com/ 🇪 - Bootstrap Icons https://github.com/twbs/icons 🇫 - Radix Icons https://icons.radix-ui.com 🇬 - Ionicons 5 https://ionicons.com 🇭 - Feather https://feathericons.com
2 replies
TTCTheo's Typesafe Cult
Created by Ayato on 4/5/2023 in #questions
findUnique from current user
Hi, I would like to get 1 entry by id, but only if the entry belongs to the current user. Is that possible with findUnique or do I have to use find findMany or findFirst? Example:
// Get a deposit by id from the current user
getById: protectedProcedure
.input(z.object({ id: z.string() }))
.query(async ({ ctx, input }) => {
const deposit = await ctx.prisma.deposit.findFirst({
where: {
id: input.id,
userId: ctx.session.user.id,
},
});
return deposit;
}),
// Get a deposit by id from the current user
getById: protectedProcedure
.input(z.object({ id: z.string() }))
.query(async ({ ctx, input }) => {
const deposit = await ctx.prisma.deposit.findFirst({
where: {
id: input.id,
userId: ctx.session.user.id,
},
});
return deposit;
}),
11 replies
TTCTheo's Typesafe Cult
Created by Ayato on 4/4/2023 in #questions
getById from current user
Hi, its my first time using tRCP and I would like to ask how I can get something by id from the current user.
import { z } from "zod";

import {
createTRPCRouter,
publicProcedure,
protectedProcedure,
} from "~/server/api/trpc";


export const depositRouter = createTRPCRouter({
// Get all deposits from the current user
getAll: protectedProcedure
.query(async ({ ctx }) => {
const deposits = await ctx.prisma.deposit.findMany({
where: {
userId: ctx.session.user.id
},
});
return deposits;
}),

// Get a deposit by id from the current user
getById: protectedProcedure
.input(z.object({ id: z.string() }))
.query(async ({ ctx, input }) => {
const deposit = await ctx.prisma.deposit.findUnique({
where: {
id: input.id,
},
});
return deposit;
}),
});
import { z } from "zod";

import {
createTRPCRouter,
publicProcedure,
protectedProcedure,
} from "~/server/api/trpc";


export const depositRouter = createTRPCRouter({
// Get all deposits from the current user
getAll: protectedProcedure
.query(async ({ ctx }) => {
const deposits = await ctx.prisma.deposit.findMany({
where: {
userId: ctx.session.user.id
},
});
return deposits;
}),

// Get a deposit by id from the current user
getById: protectedProcedure
.input(z.object({ id: z.string() }))
.query(async ({ ctx, input }) => {
const deposit = await ctx.prisma.deposit.findUnique({
where: {
id: input.id,
},
});
return deposit;
}),
});
41 replies
TTCTheo's Typesafe Cult
Created by Ayato on 4/4/2023 in #questions
Planet Scale alternative
I was wondering if there are any goo alternatives to Planet Scale with a good free tier? Because relationMode = "prisma" does not like my current schema
11 replies
TTCTheo's Typesafe Cult
Created by Ayato on 4/3/2023 in #questions
Prisma 2 relations to the same model
Hi, I'm working with Prisma for the first time, and I'm having trouble with a relation: I have a Transfer and a Deposit model, but the Transfer has a from and a to relation both relating to the Deposit how can I implement this? schema.prisma:
model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
accounts Account[]
sessions Session[]
deposits Deposit[]
labels Label[]
expenses Expense[]
revenues Revenue[]
transfers Transfer[]
}

model Deposit {
id String @id @default(cuid())
uerId String
deposit_type depositTypes
name String
description String?
balance Float
created_at DateTime @default(now())
updated_at DateTime @default(now()) @updatedAt
user User @relation(fields: [uerId], references: [id], onDelete: Cascade)
expenses Expense[]
revenues Revenue[]
Transfer Transfer[] // from ???
Transfer Transfer[] // to ???
}

model Transfer {
id String @id @default(cuid())
uerId String
from_Deposit_id String
to_Deposit_id String
label_ids Label[]
name String
description String?
amount Float
fee Float
date DateTime
created_at DateTime @default(now())
updated_at DateTime @default(now()) @updatedAt
user User @relation(fields: [uerId], references: [id], onDelete: Cascade)
from_Deposit Deposit @relation(fields: [from_Deposit_id], references: [id])
to_Deposit Deposit @relation(fields: [to_Deposit_id], references: [id])
}
model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
accounts Account[]
sessions Session[]
deposits Deposit[]
labels Label[]
expenses Expense[]
revenues Revenue[]
transfers Transfer[]
}

model Deposit {
id String @id @default(cuid())
uerId String
deposit_type depositTypes
name String
description String?
balance Float
created_at DateTime @default(now())
updated_at DateTime @default(now()) @updatedAt
user User @relation(fields: [uerId], references: [id], onDelete: Cascade)
expenses Expense[]
revenues Revenue[]
Transfer Transfer[] // from ???
Transfer Transfer[] // to ???
}

model Transfer {
id String @id @default(cuid())
uerId String
from_Deposit_id String
to_Deposit_id String
label_ids Label[]
name String
description String?
amount Float
fee Float
date DateTime
created_at DateTime @default(now())
updated_at DateTime @default(now()) @updatedAt
user User @relation(fields: [uerId], references: [id], onDelete: Cascade)
from_Deposit Deposit @relation(fields: [from_Deposit_id], references: [id])
to_Deposit Deposit @relation(fields: [to_Deposit_id], references: [id])
}
full schema.prisma: https://pastecord.com/upuxegexeg.prisma
4 replies
TTCTheo's Typesafe Cult
Created by Ayato on 4/3/2023 in #questions
create-t3-app | /app directory
Hello, I was wondering if I can create a t3 project with the new folder structure of next js or if there are any plans of updating it to the new folder structure
6 replies