@tsed/prisma
Version:
Generate Ts.ED JsonSchema based on Prisma models
55 lines (50 loc) • 1.49 kB
text/typescript
import {DecoratorStructure, StructureKind} from "ts-morph";
export enum PrismaScalars {
String = "String",
Boolean = "Boolean",
Int = "Int",
Float = "Float",
BigInt = "BigInt",
Decimal = "Decimal",
DateTime = "DateTime",
Json = "Json",
Bytes = "Bytes"
}
export const ScalarTsTypes: Record<string, string> = {
[]: "string",
[]: "boolean",
[]: "number",
[]: "number",
[]: "number",
[]: "bigint",
[]: "Date",
[]: "any",
[]: "Buffer"
};
export const ScalarJsClasses: Record<string, string> = {
[]: "String",
[]: "Boolean",
[]: "Number",
[]: "Number",
[]: "Number",
[]: "BigInt",
[]: "Date",
[]: "Object",
[]: "Buffer"
};
export const ScalarDecorators: Record<string, Omit<DecoratorStructure, "kind">[]> = {
[]: [],
[]: [],
[]: [
{
name: "Integer",
arguments: []
}
],
[]: [],
[]: [],
[]: [],
[]: [{name: "Format", arguments: ['"date-time"']}],
[]: [],
[]: []
};