ericbrian / coinorganizer

Trying to create website to keep track of my coins. Need help with authorization and authentication, code reviews, database management, Prisma Orm.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Examples followed:

To Regenerate Prisma Schema, use:

  1. Remove old database models from schema file: prisma/schema.prisma
  2. Run: ./node_modules/.bin/prisma db pull
  3. Run: ./node_modules/.bin/prisma generate

You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client

import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()

When you want relations in your Prisma types, you have to build it yourself like so:

import { Prisma } from '@prisma/client';

// GET type
type CoinType = Prisma.coinGetPayload<{
  include: {
    country: true;
    ruler: true;
    period: true;
    coin_mint: { include: { mint: true } };
    coin_engraver: { include: { engraver: true } };
    image: true;
  };
}>;

// POST type
coinst coin: Prisma.coinCreateInput = ...

About

Trying to create website to keep track of my coins. Need help with authorization and authentication, code reviews, database management, Prisma Orm.


Languages

Language:TypeScript 95.2%Language:CSS 4.2%Language:JavaScript 0.5%