Next.js Discord

Discord Forum

How to best use both a strongly typed model and a Prisma model

Unanswered
VoidPointer posted this in #help-forum
Open in Discord
My app currenyl uses a simple Sqlite db with Prisma ORM, and now I have e.g. these two "models":
model SyntheticAgent {
  id                    Int      @id @default(autoincrement())
  agentId               Int
  experienceYears       Int
  logicalAccuracy       Float
  biasSusceptibility    Float
  selfAwareness         Float 
  riskAversion          Float
}

and
export type SyntheticAgent = {
  id: number;
  experienceYears: ExperienceYears;
  logicalAccuracy: LogicalAccuracy;
  biasSusceptibility: ZeroToOneExcl;
  selfAwareness: ZeroToOneExcl;
  riskAversion: ZeroToOneExcl;
};
...
export type ZeroToOneExcl = 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9;

I'm just wondering how people normally approach this? It occurs to me to just name them say SyntheticAgentModel and SyntheticAgent, but I don't like suffixes like Model. Maybe just use the same name and different imports in different places?

0 Replies