Skip to content

Commit e5305db

Browse files
committed
feat(prisma): generate User model and related types, including CRUD operations and aggregations
1 parent 7fb120f commit e5305db

File tree

11 files changed

+2265
-3
lines changed

11 files changed

+2265
-3
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,4 @@ bun.lock*
3838
yarn.lock
3939
package-lock.json
4040
demo.db
41-
demo.db-journal
42-
generated
41+
demo.db-journal

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ WORKDIR /app
55
COPY package.json ./
66
COPY prisma ./prisma
77

8-
RUN npm install --force
8+
RUN npm install
99

1010
#
1111
FROM node:24-alpine AS builder
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
3+
/* eslint-disable */
4+
// biome-ignore-all lint: generated file
5+
// @ts-nocheck
6+
/*
7+
* This file should be your main import to use Prisma-related types and utilities in a browser.
8+
* Use it to get access to models, enums, and input types.
9+
*
10+
* This file does not contain a `PrismaClient` class, nor several other helpers that are intended as server-side only.
11+
* See `client.ts` for the standard, server-side entry point.
12+
*
13+
* 🟢 You can import this file directly.
14+
*/
15+
16+
import * as Prisma from './internal/prismaNamespaceBrowser'
17+
export { Prisma }
18+
export * as $Enums from './enums'
19+
export * from './enums';
20+
/**
21+
* Model User
22+
*
23+
*/
24+
export type User = Prisma.UserModel

src/lib/generated/prisma/client.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
3+
/* eslint-disable */
4+
// biome-ignore-all lint: generated file
5+
// @ts-nocheck
6+
/*
7+
* This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.
8+
* If you're looking for something you can import in the client-side of your application, please refer to the `browser.ts` file instead.
9+
*
10+
* 🟢 You can import this file directly.
11+
*/
12+
13+
import * as process from 'node:process'
14+
import * as path from 'node:path'
15+
import { fileURLToPath } from 'node:url'
16+
globalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url))
17+
18+
import * as runtime from "@prisma/client/runtime/client"
19+
import * as $Enums from "./enums"
20+
import * as $Class from "./internal/class"
21+
import * as Prisma from "./internal/prismaNamespace"
22+
23+
export * as $Enums from './enums'
24+
export * from "./enums"
25+
/**
26+
* ## Prisma Client
27+
*
28+
* Type-safe database client for TypeScript
29+
* @example
30+
* ```
31+
* const prisma = new PrismaClient()
32+
* // Fetch zero or more Users
33+
* const users = await prisma.user.findMany()
34+
* ```
35+
*
36+
* Read more in our [docs](https://pris.ly/d/client).
37+
*/
38+
export const PrismaClient = $Class.getPrismaClientClass()
39+
export type PrismaClient<LogOpts extends Prisma.LogLevel = never, OmitOpts extends Prisma.PrismaClientOptions["omit"] = Prisma.PrismaClientOptions["omit"], ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = $Class.PrismaClient<LogOpts, OmitOpts, ExtArgs>
40+
export { Prisma }
41+
42+
/**
43+
* Model User
44+
*
45+
*/
46+
export type User = Prisma.UserModel
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
2+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
3+
/* eslint-disable */
4+
// biome-ignore-all lint: generated file
5+
// @ts-nocheck
6+
/*
7+
* This file exports various common sort, input & filter types that are not directly linked to a particular model.
8+
*
9+
* 🟢 You can import this file directly.
10+
*/
11+
12+
import type * as runtime from "@prisma/client/runtime/client"
13+
import * as $Enums from "./enums"
14+
import type * as Prisma from "./internal/prismaNamespace"
15+
16+
17+
export type StringFilter<$PrismaModel = never> = {
18+
equals?: string | Prisma.StringFieldRefInput<$PrismaModel>
19+
in?: string[]
20+
notIn?: string[]
21+
lt?: string | Prisma.StringFieldRefInput<$PrismaModel>
22+
lte?: string | Prisma.StringFieldRefInput<$PrismaModel>
23+
gt?: string | Prisma.StringFieldRefInput<$PrismaModel>
24+
gte?: string | Prisma.StringFieldRefInput<$PrismaModel>
25+
contains?: string | Prisma.StringFieldRefInput<$PrismaModel>
26+
startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
27+
endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
28+
not?: Prisma.NestedStringFilter<$PrismaModel> | string
29+
}
30+
31+
export type StringWithAggregatesFilter<$PrismaModel = never> = {
32+
equals?: string | Prisma.StringFieldRefInput<$PrismaModel>
33+
in?: string[]
34+
notIn?: string[]
35+
lt?: string | Prisma.StringFieldRefInput<$PrismaModel>
36+
lte?: string | Prisma.StringFieldRefInput<$PrismaModel>
37+
gt?: string | Prisma.StringFieldRefInput<$PrismaModel>
38+
gte?: string | Prisma.StringFieldRefInput<$PrismaModel>
39+
contains?: string | Prisma.StringFieldRefInput<$PrismaModel>
40+
startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
41+
endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
42+
not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string
43+
_count?: Prisma.NestedIntFilter<$PrismaModel>
44+
_min?: Prisma.NestedStringFilter<$PrismaModel>
45+
_max?: Prisma.NestedStringFilter<$PrismaModel>
46+
}
47+
48+
export type NestedStringFilter<$PrismaModel = never> = {
49+
equals?: string | Prisma.StringFieldRefInput<$PrismaModel>
50+
in?: string[]
51+
notIn?: string[]
52+
lt?: string | Prisma.StringFieldRefInput<$PrismaModel>
53+
lte?: string | Prisma.StringFieldRefInput<$PrismaModel>
54+
gt?: string | Prisma.StringFieldRefInput<$PrismaModel>
55+
gte?: string | Prisma.StringFieldRefInput<$PrismaModel>
56+
contains?: string | Prisma.StringFieldRefInput<$PrismaModel>
57+
startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
58+
endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
59+
not?: Prisma.NestedStringFilter<$PrismaModel> | string
60+
}
61+
62+
export type NestedStringWithAggregatesFilter<$PrismaModel = never> = {
63+
equals?: string | Prisma.StringFieldRefInput<$PrismaModel>
64+
in?: string[]
65+
notIn?: string[]
66+
lt?: string | Prisma.StringFieldRefInput<$PrismaModel>
67+
lte?: string | Prisma.StringFieldRefInput<$PrismaModel>
68+
gt?: string | Prisma.StringFieldRefInput<$PrismaModel>
69+
gte?: string | Prisma.StringFieldRefInput<$PrismaModel>
70+
contains?: string | Prisma.StringFieldRefInput<$PrismaModel>
71+
startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
72+
endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
73+
not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string
74+
_count?: Prisma.NestedIntFilter<$PrismaModel>
75+
_min?: Prisma.NestedStringFilter<$PrismaModel>
76+
_max?: Prisma.NestedStringFilter<$PrismaModel>
77+
}
78+
79+
export type NestedIntFilter<$PrismaModel = never> = {
80+
equals?: number | Prisma.IntFieldRefInput<$PrismaModel>
81+
in?: number[]
82+
notIn?: number[]
83+
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
84+
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
85+
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
86+
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
87+
not?: Prisma.NestedIntFilter<$PrismaModel> | number
88+
}
89+
90+

src/lib/generated/prisma/enums.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
3+
/* eslint-disable */
4+
// biome-ignore-all lint: generated file
5+
// @ts-nocheck
6+
/*
7+
* This file exports all enum related types from the schema.
8+
*
9+
* 🟢 You can import this file directly.
10+
*/
11+
12+
13+
14+
// This file is empty because there are no enums in the schema.
15+
export {}
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
2+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
3+
/* eslint-disable */
4+
// biome-ignore-all lint: generated file
5+
// @ts-nocheck
6+
/*
7+
* WARNING: This is an internal file that is subject to change!
8+
*
9+
* 🛑 Under no circumstances should you import this file directly! 🛑
10+
*
11+
* Please import the `PrismaClient` class from the `client.ts` file instead.
12+
*/
13+
14+
import * as runtime from "@prisma/client/runtime/client"
15+
import type * as Prisma from "./prismaNamespace"
16+
17+
18+
const config: runtime.GetPrismaClientConfig = {
19+
"previewFeatures": [],
20+
"clientVersion": "7.1.0",
21+
"engineVersion": "ab635e6b9d606fa5c8fb8b1a7f909c3c3c1c98ba",
22+
"activeProvider": "sqlite",
23+
"inlineSchema": "generator client {\n provider = \"prisma-client\"\n output = \"../src/lib/generated/prisma\"\n}\n\ndatasource db {\n provider = \"sqlite\"\n}\n\nmodel User {\n id String @id @default(cuid())\n\n username String @unique\n password String\n}\n",
24+
"runtimeDataModel": {
25+
"models": {},
26+
"enums": {},
27+
"types": {}
28+
}
29+
}
30+
31+
config.runtimeDataModel = JSON.parse("{\"models\":{\"User\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"username\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":null}},\"enums\":{},\"types\":{}}")
32+
33+
async function decodeBase64AsWasm(wasmBase64: string): Promise<WebAssembly.Module> {
34+
const { Buffer } = await import('node:buffer')
35+
const wasmArray = Buffer.from(wasmBase64, 'base64')
36+
return new WebAssembly.Module(wasmArray)
37+
}
38+
39+
config.compilerWasm = {
40+
getRuntime: async () => await import("@prisma/client/runtime/query_compiler_bg.sqlite.mjs"),
41+
42+
getQueryCompilerWasmModule: async () => {
43+
const { wasm } = await import("@prisma/client/runtime/query_compiler_bg.sqlite.wasm-base64.mjs")
44+
return await decodeBase64AsWasm(wasm)
45+
}
46+
}
47+
48+
49+
50+
export type LogOptions<ClientOptions extends Prisma.PrismaClientOptions> =
51+
'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never
52+
53+
export interface PrismaClientConstructor {
54+
/**
55+
* ## Prisma Client
56+
*
57+
* Type-safe database client for TypeScript
58+
* @example
59+
* ```
60+
* const prisma = new PrismaClient()
61+
* // Fetch zero or more Users
62+
* const users = await prisma.user.findMany()
63+
* ```
64+
*
65+
* Read more in our [docs](https://pris.ly/d/client).
66+
*/
67+
68+
new <
69+
Options extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,
70+
LogOpts extends LogOptions<Options> = LogOptions<Options>,
71+
OmitOpts extends Prisma.PrismaClientOptions['omit'] = Options extends { omit: infer U } ? U : Prisma.PrismaClientOptions['omit'],
72+
ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs
73+
>(options: Prisma.Subset<Options, Prisma.PrismaClientOptions> ): PrismaClient<LogOpts, OmitOpts, ExtArgs>
74+
}
75+
76+
/**
77+
* ## Prisma Client
78+
*
79+
* Type-safe database client for TypeScript
80+
* @example
81+
* ```
82+
* const prisma = new PrismaClient()
83+
* // Fetch zero or more Users
84+
* const users = await prisma.user.findMany()
85+
* ```
86+
*
87+
* Read more in our [docs](https://pris.ly/d/client).
88+
*/
89+
90+
export interface PrismaClient<
91+
in LogOpts extends Prisma.LogLevel = never,
92+
in out OmitOpts extends Prisma.PrismaClientOptions['omit'] = undefined,
93+
in out ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs
94+
> {
95+
[K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
96+
97+
$on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;
98+
99+
/**
100+
* Connect with the database
101+
*/
102+
$connect(): runtime.Types.Utils.JsPromise<void>;
103+
104+
/**
105+
* Disconnect from the database
106+
*/
107+
$disconnect(): runtime.Types.Utils.JsPromise<void>;
108+
109+
/**
110+
* Executes a prepared raw query and returns the number of affected rows.
111+
* @example
112+
* ```
113+
* const result = await prisma.$executeRaw`UPDATE User SET cool = ${true} WHERE email = ${'user@email.com'};`
114+
* ```
115+
*
116+
* Read more in our [docs](https://pris.ly/d/raw-queries).
117+
*/
118+
$executeRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<number>;
119+
120+
/**
121+
* Executes a raw query and returns the number of affected rows.
122+
* Susceptible to SQL injections, see documentation.
123+
* @example
124+
* ```
125+
* const result = await prisma.$executeRawUnsafe('UPDATE User SET cool = $1 WHERE email = $2 ;', true, '[email protected]')
126+
* ```
127+
*
128+
* Read more in our [docs](https://pris.ly/d/raw-queries).
129+
*/
130+
$executeRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<number>;
131+
132+
/**
133+
* Performs a prepared raw query and returns the `SELECT` data.
134+
* @example
135+
* ```
136+
* const result = await prisma.$queryRaw`SELECT * FROM User WHERE id = ${1} OR email = ${'user@email.com'};`
137+
* ```
138+
*
139+
* Read more in our [docs](https://pris.ly/d/raw-queries).
140+
*/
141+
$queryRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<T>;
142+
143+
/**
144+
* Performs a raw query and returns the `SELECT` data.
145+
* Susceptible to SQL injections, see documentation.
146+
* @example
147+
* ```
148+
* const result = await prisma.$queryRawUnsafe('SELECT * FROM User WHERE id = $1 OR email = $2;', 1, '[email protected]')
149+
* ```
150+
*
151+
* Read more in our [docs](https://pris.ly/d/raw-queries).
152+
*/
153+
$queryRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<T>;
154+
155+
156+
/**
157+
* Allows the running of a sequence of read/write operations that are guaranteed to either succeed or fail as a whole.
158+
* @example
159+
* ```
160+
* const [george, bob, alice] = await prisma.$transaction([
161+
* prisma.user.create({ data: { name: 'George' } }),
162+
* prisma.user.create({ data: { name: 'Bob' } }),
163+
* prisma.user.create({ data: { name: 'Alice' } }),
164+
* ])
165+
* ```
166+
*
167+
* Read more in our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions).
168+
*/
169+
$transaction<P extends Prisma.PrismaPromise<any>[]>(arg: [...P], options?: { isolationLevel?: Prisma.TransactionIsolationLevel }): runtime.Types.Utils.JsPromise<runtime.Types.Utils.UnwrapTuple<P>>
170+
171+
$transaction<R>(fn: (prisma: Omit<PrismaClient, runtime.ITXClientDenyList>) => runtime.Types.Utils.JsPromise<R>, options?: { maxWait?: number, timeout?: number, isolationLevel?: Prisma.TransactionIsolationLevel }): runtime.Types.Utils.JsPromise<R>
172+
173+
$extends: runtime.Types.Extensions.ExtendsHook<"extends", Prisma.TypeMapCb<OmitOpts>, ExtArgs, runtime.Types.Utils.Call<Prisma.TypeMapCb<OmitOpts>, {
174+
extArgs: ExtArgs
175+
}>>
176+
177+
/**
178+
* `prisma.user`: Exposes CRUD operations for the **User** model.
179+
* Example usage:
180+
* ```ts
181+
* // Fetch zero or more Users
182+
* const users = await prisma.user.findMany()
183+
* ```
184+
*/
185+
get user(): Prisma.UserDelegate<ExtArgs, { omit: OmitOpts }>;
186+
}
187+
188+
export function getPrismaClientClass(): PrismaClientConstructor {
189+
return runtime.getPrismaClient(config) as unknown as PrismaClientConstructor
190+
}

0 commit comments

Comments
 (0)