JTB
JTB
PPrisma
Created by Amruth Pillai on 6/27/2024 in #help-and-questions
Accessing extended operations on the prisma client with typescript
Defube Custom Op:
import type { Prisma } from "@prisma/client";
import type { Operation as PrismaOperation } from "@prisma/client/runtime/library";

// Define your custom operations here
type CustomOperations = 'bark' | 'growl';

// Extend the Prisma operations with the custom ones
type ExtendedOperations = PrismaOperation | CustomOperations;
import type { Prisma } from "@prisma/client";
import type { Operation as PrismaOperation } from "@prisma/client/runtime/library";

// Define your custom operations here
type CustomOperations = 'bark' | 'growl';

// Extend the Prisma operations with the custom ones
type ExtendedOperations = PrismaOperation | CustomOperations;
Extend Types:
import type { Database } from "@/libs/database";
import type { FilterDollarSignKeys } from "@/utils/types";

// Using the extended operations type
export type Operation = FilterDollarSignKeys<ExtendedOperations>;

export type Args<M extends Model, O extends Operation> = Prisma.Args<Database[M], O>;

export type Payload<M extends Model, O extends Operation> = Prisma.Payload<Database[M], O>;

export type Result<M extends Model, O extends Operation, A extends Args<M, O>> = Prisma.Result<
Database[M],
A,
O
>;
import type { Database } from "@/libs/database";
import type { FilterDollarSignKeys } from "@/utils/types";

// Using the extended operations type
export type Operation = FilterDollarSignKeys<ExtendedOperations>;

export type Args<M extends Model, O extends Operation> = Prisma.Args<Database[M], O>;

export type Payload<M extends Model, O extends Operation> = Prisma.Payload<Database[M], O>;

export type Result<M extends Model, O extends Operation, A extends Args<M, O>> = Prisma.Result<
Database[M],
A,
O
>;
Example Usage:
// Example Usage:
const model: Model = "user";
const operation: Operation = "findMany";
const customOperation: Operation = "bark"; // Custom operation

const _args: Args<typeof model, typeof operation> = { select: { id: true } };
const _result: Result<typeof model, typeof operation, { select: { id: true } }> = [{ id: "1" }];

const _customArgs: Args<typeof model, typeof customOperation> = { volume: 'loud' };
const _customResult: Result<typeof model, typeof customOperation, { volume: 'loud' }> = [{ bark: "loud" }];
// Example Usage:
const model: Model = "user";
const operation: Operation = "findMany";
const customOperation: Operation = "bark"; // Custom operation

const _args: Args<typeof model, typeof operation> = { select: { id: true } };
const _result: Result<typeof model, typeof operation, { select: { id: true } }> = [{ id: "1" }];

const _customArgs: Args<typeof model, typeof customOperation> = { volume: 'loud' };
const _customResult: Result<typeof model, typeof customOperation, { volume: 'loud' }> = [{ bark: "loud" }];
4 replies
PPrisma
Created by JTB on 6/24/2024 in #help-and-questions
Prisma NextJs Docker and Multi Datasource
Can be closed. The error was a typo in the Dockerfile, which meant that the client was not copied correctly.
2 replies
PPrisma
Created by Jonathan on 6/24/2024 in #help-and-questions
Ensuring Filtering if variable is undefined
I would even say that it should be built in such a way that an undefined never reaches this point. But I agree with you, if we have to "live" with it, I would also use the second one and throw back a throw new error.
6 replies
PPrisma
Created by arga fauzianto on 6/25/2024 in #help-and-questions
Dashboard localhost:4467/_admin after run command: yarn prisma:deploy-force all table is 0
I don't know how I can explain it any more simply. If you declare connections in the schema that do not physically exist, like a virtualisation of the table, no new tables are created in the database but you virtualise them. But whether this is the case and WHAT exactly is the case with you cannot be said on the basis of the screen shorts.
14 replies
PPrisma
Created by arga fauzianto on 6/25/2024 in #help-and-questions
Dashboard localhost:4467/_admin after run command: yarn prisma:deploy-force all table is 0
No description
14 replies
PPrisma
Created by arga fauzianto on 6/25/2024 in #help-and-questions
Dashboard localhost:4467/_admin after run command: yarn prisma:deploy-force all table is 0
and? that doesn't contradict any of my explanations.
14 replies
PPrisma
Created by arga fauzianto on 6/25/2024 in #help-and-questions
Dashboard localhost:4467/_admin after run command: yarn prisma:deploy-force all table is 0
Without knowing your complete schema.prisma, nobody will be able to tell you anything. You can make certain joints in your schema that are displayed in the studio but not in the database.
14 replies
PPrisma
Created by arga fauzianto on 6/25/2024 in #help-and-questions
Dashboard localhost:4467/_admin after run command: yarn prisma:deploy-force all table is 0
idk what you declated on prisma.schema?
14 replies
PPrisma
Created by zane on 6/25/2024 in #help-and-questions
Issues deploying Flask + Prisma-Client-Py backend to Vercel
Good Luck 🙂
64 replies
PPrisma
Created by zane on 6/25/2024 in #help-and-questions
Issues deploying Flask + Prisma-Client-Py backend to Vercel
From the architectur alone, you should separate the applications. You use NextJs (Fullstack) for everything web related, if you really need Python, you can use that as a separate service to manipulate data. I work a lot with AI myself at work, currently langchainJS makes Python superfluous for me. (I'm not talking about analytics, but purely about the web application). If you want to work with AI and make it available to users, you can do everything in NextJS and forget python.
64 replies
PPrisma
Created by zane on 6/25/2024 in #help-and-questions
Issues deploying Flask + Prisma-Client-Py backend to Vercel
You should rather ask yourself what you intend to do. Python is good for data analysis and everything that has to do with data manipulation. Flask is a framework for Python. You want to use a full-stack framework (NextJs) in JS that is intended for web applications. In other words, you have 2 different programming languages and 2 frameworks in one go, plus you want to make a database connection via an ORM and and and.... That's way too much for a beginner and I don't think it's feasible the way you envision it. If you really want to go through with it, you should look into micro services and their pros and cons beforehand. No programmer would actually build it the way you are trying to do it. These are only problems in maintainability, scaling and and and....
64 replies
PPrisma
Created by zane on 6/25/2024 in #help-and-questions
Issues deploying Flask + Prisma-Client-Py backend to Vercel
Sorry, but you should learn the basics first. They use NEXTJS and Python as a serverless function. So as a separate service.
64 replies
PPrisma
Created by zane on 6/25/2024 in #help-and-questions
Issues deploying Flask + Prisma-Client-Py backend to Vercel
that where react
64 replies
PPrisma
Created by zane on 6/25/2024 in #help-and-questions
Issues deploying Flask + Prisma-Client-Py backend to Vercel
nope
64 replies
PPrisma
Created by zane on 6/25/2024 in #help-and-questions
Issues deploying Flask + Prisma-Client-Py backend to Vercel
But NextJS is not a frontend
64 replies
PPrisma
Created by zane on 6/25/2024 in #help-and-questions
Issues deploying Flask + Prisma-Client-Py backend to Vercel
It's not even the same language
64 replies
PPrisma
Created by zane on 6/25/2024 in #help-and-questions
Issues deploying Flask + Prisma-Client-Py backend to Vercel
is like you say, i need a Farrari, Opel, Ford and all with one Controller
64 replies
PPrisma
Created by zane on 6/25/2024 in #help-and-questions
Issues deploying Flask + Prisma-Client-Py backend to Vercel
Deploying Flask + Prisma-client-py with Nextjs? That dont make Sence
64 replies
PPrisma
Created by zane on 6/25/2024 in #help-and-questions
Issues deploying Flask + Prisma-Client-Py backend to Vercel
Try to make a Basis Template with NextJs (+Tailwind), Prisma, Postgress and than dont use npm again .-D
64 replies
PPrisma
Created by zane on 6/25/2024 in #help-and-questions
Issues deploying Flask + Prisma-Client-Py backend to Vercel
This is not possible in the way you intend.
64 replies