init
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
DATABASE_URL="postgresql://postgres:lyh1234@192.168.0.180:5432/blog_gxy"
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"hash": "66cb816949cf8f6a536fcdd60eeb1bb528c3e58ae9bc6737273a2fe0a26f5843",
|
||||||
|
"invariants": []
|
||||||
|
}
|
||||||
Vendored
+527
@@ -0,0 +1,527 @@
|
|||||||
|
// ⚠️ GENERATED FILE - DO NOT EDIT
|
||||||
|
// This file is automatically generated by 'prisma contract emit'.
|
||||||
|
// To regenerate, run: prisma contract emit
|
||||||
|
import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types';
|
||||||
|
import type {
|
||||||
|
Bit,
|
||||||
|
Char,
|
||||||
|
CodecTypes as PgTypes,
|
||||||
|
Interval,
|
||||||
|
JsonValue,
|
||||||
|
Numeric,
|
||||||
|
Time,
|
||||||
|
TimeString,
|
||||||
|
Timestamp,
|
||||||
|
TimestampString,
|
||||||
|
Timestamptz,
|
||||||
|
TimestamptzString,
|
||||||
|
Timetz,
|
||||||
|
VarBit,
|
||||||
|
Varchar,
|
||||||
|
} from '@prisma/orm-postgres/target/codec-types';
|
||||||
|
|
||||||
|
import type {
|
||||||
|
ContractWithTypeMaps,
|
||||||
|
RelationKeys,
|
||||||
|
TypeMaps as TypeMapsType,
|
||||||
|
} from '@prisma/orm-postgres/family-contract/types';
|
||||||
|
import type {
|
||||||
|
Contract as ContractType,
|
||||||
|
ExecutionHashBase,
|
||||||
|
NamespaceId,
|
||||||
|
ProfileHashBase,
|
||||||
|
StorageHashBase,
|
||||||
|
} from '@prisma/orm-postgres/contract/types';
|
||||||
|
|
||||||
|
export type StorageHash =
|
||||||
|
StorageHashBase<'08bb890f11bf10c43aee5adbb94faac367bb4c96a4886208291c8435d9e06fbf'>;
|
||||||
|
export type ExecutionHash = ExecutionHashBase<string>;
|
||||||
|
export type ProfileHash =
|
||||||
|
ProfileHashBase<'3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2'>;
|
||||||
|
|
||||||
|
export type CodecTypes = PgTypes;
|
||||||
|
export type LaneCodecTypes = CodecTypes;
|
||||||
|
export type QueryOperationTypes = PgAdapterQueryOps<CodecTypes>;
|
||||||
|
export type AggregateTypes = {
|
||||||
|
readonly avg: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly avgDecimal: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly count: {
|
||||||
|
readonly byCodec: {};
|
||||||
|
readonly withoutInput: { readonly output: 'pg/int8number@1'; readonly nullable: false };
|
||||||
|
readonly anyInput: { readonly output: 'pg/int8number@1'; readonly nullable: false };
|
||||||
|
};
|
||||||
|
readonly countBigInt: {
|
||||||
|
readonly byCodec: {};
|
||||||
|
readonly withoutInput: { readonly output: 'pg/int8@1'; readonly nullable: false };
|
||||||
|
readonly anyInput: { readonly output: 'pg/int8@1'; readonly nullable: false };
|
||||||
|
};
|
||||||
|
readonly max: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/char@1': { readonly output: 'pg/char@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-string@1': { readonly output: 'pg/date-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-temporal@1': {
|
||||||
|
readonly output: 'pg/date-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/enum@1': { readonly output: 'pg/enum@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/inet@1': { readonly output: 'pg/inet@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int2@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text-array@1': { readonly output: 'pg/text-array@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/time-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': {
|
||||||
|
readonly output: 'pg/time-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-string@1': {
|
||||||
|
readonly output: 'pg/timestamp-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamp-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-string@1': {
|
||||||
|
readonly output: 'pg/timestamptz-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamptz-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timetz@1': { readonly output: 'pg/timetz@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/char@1': { readonly output: 'sql/char@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/float@1': { readonly output: 'sql/float@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'sql/int@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/text@1': { readonly output: 'sql/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly min: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/char@1': { readonly output: 'pg/char@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-string@1': { readonly output: 'pg/date-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-temporal@1': {
|
||||||
|
readonly output: 'pg/date-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/enum@1': { readonly output: 'pg/enum@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/inet@1': { readonly output: 'pg/inet@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int2@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text-array@1': { readonly output: 'pg/text-array@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/time-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': {
|
||||||
|
readonly output: 'pg/time-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-string@1': {
|
||||||
|
readonly output: 'pg/timestamp-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamp-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-string@1': {
|
||||||
|
readonly output: 'pg/timestamptz-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamptz-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timetz@1': { readonly output: 'pg/timetz@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/char@1': { readonly output: 'sql/char@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/float@1': { readonly output: 'sql/float@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'sql/int@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/text@1': { readonly output: 'sql/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly sum: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'sql/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly sumBigInt: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/unboundedint@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/unboundedint@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
type DefaultLiteralValue<CodecId extends string, Encoded> = CodecId extends keyof CodecTypes
|
||||||
|
? Encoded extends CodecTypes[CodecId]['json']
|
||||||
|
? Encoded
|
||||||
|
: CodecTypes[CodecId]['json']
|
||||||
|
: Encoded;
|
||||||
|
|
||||||
|
export type FieldOutputTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly Post: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly user_id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly title: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly context: CodecTypes['pg/text@1']['output'];
|
||||||
|
};
|
||||||
|
readonly User: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['output'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type FieldInputTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly Post: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly user_id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly title: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly context: CodecTypes['pg/text@1']['input'];
|
||||||
|
};
|
||||||
|
readonly User: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['input'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type StorageColumnTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly post: {
|
||||||
|
readonly context: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly title: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly user_id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
};
|
||||||
|
readonly user: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['output'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type StorageColumnInputTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly post: {
|
||||||
|
readonly context: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly title: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly user_id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
};
|
||||||
|
readonly user: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['input'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export namespace Models {
|
||||||
|
export type public_User = {
|
||||||
|
id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
nickname: CodecTypes['pg/text@1']['output'];
|
||||||
|
username: CodecTypes['pg/text@1']['output'];
|
||||||
|
password: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly [RelationKeys]?: never;
|
||||||
|
};
|
||||||
|
export type public_Post = {
|
||||||
|
id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
user_id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
title: CodecTypes['pg/text@1']['output'];
|
||||||
|
context: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly [RelationKeys]?: never;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare const models: {
|
||||||
|
public: {
|
||||||
|
User: Models.public_User;
|
||||||
|
Post: Models.public_Post;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TypeMaps = TypeMapsType<
|
||||||
|
CodecTypes,
|
||||||
|
QueryOperationTypes,
|
||||||
|
FieldOutputTypes,
|
||||||
|
FieldInputTypes,
|
||||||
|
StorageColumnTypes,
|
||||||
|
StorageColumnInputTypes,
|
||||||
|
AggregateTypes
|
||||||
|
>;
|
||||||
|
|
||||||
|
type ContractBase = Omit<
|
||||||
|
ContractType<{
|
||||||
|
readonly namespaces: {
|
||||||
|
readonly public: {
|
||||||
|
readonly id: 'public';
|
||||||
|
readonly kind: 'postgres-schema';
|
||||||
|
readonly entries: {
|
||||||
|
readonly table: {
|
||||||
|
readonly post: {
|
||||||
|
columns: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nativeType: 'int4';
|
||||||
|
readonly codecId: 'pg/int4@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly default: {
|
||||||
|
readonly kind: 'function';
|
||||||
|
readonly expression: 'autoincrement()';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly user_id: {
|
||||||
|
readonly nativeType: 'int4';
|
||||||
|
readonly codecId: 'pg/int4@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly default: {
|
||||||
|
readonly kind: 'function';
|
||||||
|
readonly expression: 'autoincrement()';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly title: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly context: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
primaryKey: { readonly columns: readonly ['id'] };
|
||||||
|
uniques: readonly [];
|
||||||
|
indexes: readonly [];
|
||||||
|
foreignKeys: readonly [];
|
||||||
|
};
|
||||||
|
readonly user: {
|
||||||
|
columns: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nativeType: 'int4';
|
||||||
|
readonly codecId: 'pg/int4@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly default: {
|
||||||
|
readonly kind: 'function';
|
||||||
|
readonly expression: 'autoincrement()';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly nickname: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly username: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly password: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
primaryKey: { readonly columns: readonly ['id'] };
|
||||||
|
uniques: readonly [{ readonly columns: readonly ['username'] }];
|
||||||
|
indexes: readonly [];
|
||||||
|
foreignKeys: readonly [];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly storageHash: StorageHash;
|
||||||
|
}>,
|
||||||
|
'roots' | 'domain'
|
||||||
|
> & {
|
||||||
|
readonly target: 'postgres';
|
||||||
|
readonly targetFamily: 'sql';
|
||||||
|
readonly roots: {
|
||||||
|
readonly user: { readonly namespace: 'public' & NamespaceId; readonly model: 'User' };
|
||||||
|
readonly post: { readonly namespace: 'public' & NamespaceId; readonly model: 'Post' };
|
||||||
|
};
|
||||||
|
readonly domain: {
|
||||||
|
readonly namespaces: {
|
||||||
|
readonly public: {
|
||||||
|
readonly models: {
|
||||||
|
readonly Post: {
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' };
|
||||||
|
};
|
||||||
|
readonly user_id: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' };
|
||||||
|
};
|
||||||
|
readonly title: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
readonly context: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly relations: Record<string, never>;
|
||||||
|
readonly storage: {
|
||||||
|
readonly table: 'post';
|
||||||
|
readonly namespaceId: 'public';
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: { readonly column: 'id' };
|
||||||
|
readonly user_id: { readonly column: 'user_id' };
|
||||||
|
readonly title: { readonly column: 'title' };
|
||||||
|
readonly context: { readonly column: 'context' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly User: {
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' };
|
||||||
|
};
|
||||||
|
readonly nickname: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
readonly username: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
readonly password: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly relations: Record<string, never>;
|
||||||
|
readonly storage: {
|
||||||
|
readonly table: 'user';
|
||||||
|
readonly namespaceId: 'public';
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: { readonly column: 'id' };
|
||||||
|
readonly nickname: { readonly column: 'nickname' };
|
||||||
|
readonly username: { readonly column: 'username' };
|
||||||
|
readonly password: { readonly column: 'password' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly capabilities: {
|
||||||
|
readonly postgres: {
|
||||||
|
readonly distinctOn: true;
|
||||||
|
readonly jsonAgg: true;
|
||||||
|
readonly lateral: true;
|
||||||
|
readonly limit: true;
|
||||||
|
readonly orderBy: true;
|
||||||
|
readonly returning: true;
|
||||||
|
};
|
||||||
|
readonly sql: {
|
||||||
|
readonly checkConstraint: true;
|
||||||
|
readonly defaultInInsert: true;
|
||||||
|
readonly enums: true;
|
||||||
|
readonly lateral: true;
|
||||||
|
readonly returning: true;
|
||||||
|
readonly scalarList: true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly extensions: {};
|
||||||
|
readonly meta: {};
|
||||||
|
|
||||||
|
readonly profileHash: ProfileHash;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Contract = ContractWithTypeMaps<ContractBase, TypeMaps>;
|
||||||
|
|
||||||
|
export type Namespaces = Contract['storage']['namespaces'];
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
{"_generated":{"message":"This file is automatically generated by \"prisma contract emit\".","regenerate":"To regenerate, run: prisma contract emit","warning":"⚠️ GENERATED FILE - DO NOT EDIT"},"capabilities":{"postgres":{"distinctOn":true,"jsonAgg":true,"lateral":true,"limit":true,"orderBy":true,"returning":true},"sql":{"checkConstraint":true,"defaultInInsert":true,"enums":true,"lateral":true,"returning":true,"scalarList":true}},"domain":{"namespaces":{"public":{"models":{"Post":{"fields":{"context":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}},"id":{"nullable":false,"type":{"codecId":"pg/int4@1","kind":"scalar"}},"title":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}},"user_id":{"nullable":false,"type":{"codecId":"pg/int4@1","kind":"scalar"}}},"relations":{},"storage":{"fields":{"context":{"column":"context"},"id":{"column":"id"},"title":{"column":"title"},"user_id":{"column":"user_id"}},"namespaceId":"public","table":"post"}},"User":{"fields":{"id":{"nullable":false,"type":{"codecId":"pg/int4@1","kind":"scalar"}},"nickname":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}},"password":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}},"username":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}}},"relations":{},"storage":{"fields":{"id":{"column":"id"},"nickname":{"column":"nickname"},"password":{"column":"password"},"username":{"column":"username"}},"namespaceId":"public","table":"user"}}}}}},"extensions":{},"meta":{},"profileHash":"3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2","roots":{"post":{"model":"Post","namespace":"public"},"user":{"model":"User","namespace":"public"}},"schemaVersion":"1","storage":{"namespaces":{"public":{"entries":{"table":{"post":{"columns":{"context":{"codecId":"pg/text@1","nativeType":"text","nullable":false},"id":{"codecId":"pg/int4@1","default":{"expression":"autoincrement()","kind":"function"},"nativeType":"int4","nullable":false},"title":{"codecId":"pg/text@1","nativeType":"text","nullable":false},"user_id":{"codecId":"pg/int4@1","default":{"expression":"autoincrement()","kind":"function"},"nativeType":"int4","nullable":false}},"foreignKeys":[],"indexes":[],"primaryKey":{"columns":["id"]},"uniques":[]},"user":{"columns":{"id":{"codecId":"pg/int4@1","default":{"expression":"autoincrement()","kind":"function"},"nativeType":"int4","nullable":false},"nickname":{"codecId":"pg/text@1","nativeType":"text","nullable":false},"password":{"codecId":"pg/text@1","nativeType":"text","nullable":false},"username":{"codecId":"pg/text@1","nativeType":"text","nullable":false}},"foreignKeys":[],"indexes":[],"primaryKey":{"columns":["id"]},"uniques":[{"columns":["username"]}]}}},"id":"public","kind":"postgres-schema"}},"storageHash":"08bb890f11bf10c43aee5adbb94faac367bb4c96a4886208291c8435d9e06fbf"},"target":"postgres","targetFamily":"sql"}
|
||||||
Vendored
+508
@@ -0,0 +1,508 @@
|
|||||||
|
// ⚠️ GENERATED FILE - DO NOT EDIT
|
||||||
|
// This file is automatically generated by 'prisma contract emit'.
|
||||||
|
// To regenerate, run: prisma contract emit
|
||||||
|
import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types';
|
||||||
|
import type {
|
||||||
|
Bit,
|
||||||
|
Char,
|
||||||
|
CodecTypes as PgTypes,
|
||||||
|
Interval,
|
||||||
|
JsonValue,
|
||||||
|
Numeric,
|
||||||
|
Time,
|
||||||
|
TimeString,
|
||||||
|
Timestamp,
|
||||||
|
TimestampString,
|
||||||
|
Timestamptz,
|
||||||
|
TimestamptzString,
|
||||||
|
Timetz,
|
||||||
|
VarBit,
|
||||||
|
Varchar,
|
||||||
|
} from '@prisma/orm-postgres/target/codec-types';
|
||||||
|
|
||||||
|
import type {
|
||||||
|
ContractWithTypeMaps,
|
||||||
|
RelationKeys,
|
||||||
|
TypeMaps as TypeMapsType,
|
||||||
|
} from '@prisma/orm-postgres/family-contract/types';
|
||||||
|
import type {
|
||||||
|
Contract as ContractType,
|
||||||
|
ExecutionHashBase,
|
||||||
|
NamespaceId,
|
||||||
|
ProfileHashBase,
|
||||||
|
StorageHashBase,
|
||||||
|
} from '@prisma/orm-postgres/contract/types';
|
||||||
|
|
||||||
|
export type StorageHash =
|
||||||
|
StorageHashBase<'0a0d5f715195fa3e27bfec1d19e8ff84c81e40676c4a3b5ae59513606881efca'>;
|
||||||
|
export type ExecutionHash = ExecutionHashBase<string>;
|
||||||
|
export type ProfileHash =
|
||||||
|
ProfileHashBase<'3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2'>;
|
||||||
|
|
||||||
|
export type CodecTypes = PgTypes;
|
||||||
|
export type LaneCodecTypes = CodecTypes;
|
||||||
|
export type QueryOperationTypes = PgAdapterQueryOps<CodecTypes>;
|
||||||
|
export type AggregateTypes = {
|
||||||
|
readonly avg: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly avgDecimal: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly count: {
|
||||||
|
readonly byCodec: {};
|
||||||
|
readonly withoutInput: { readonly output: 'pg/int8number@1'; readonly nullable: false };
|
||||||
|
readonly anyInput: { readonly output: 'pg/int8number@1'; readonly nullable: false };
|
||||||
|
};
|
||||||
|
readonly countBigInt: {
|
||||||
|
readonly byCodec: {};
|
||||||
|
readonly withoutInput: { readonly output: 'pg/int8@1'; readonly nullable: false };
|
||||||
|
readonly anyInput: { readonly output: 'pg/int8@1'; readonly nullable: false };
|
||||||
|
};
|
||||||
|
readonly max: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/char@1': { readonly output: 'pg/char@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-string@1': { readonly output: 'pg/date-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-temporal@1': {
|
||||||
|
readonly output: 'pg/date-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/enum@1': { readonly output: 'pg/enum@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/inet@1': { readonly output: 'pg/inet@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int2@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text-array@1': { readonly output: 'pg/text-array@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/time-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': {
|
||||||
|
readonly output: 'pg/time-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-string@1': {
|
||||||
|
readonly output: 'pg/timestamp-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamp-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-string@1': {
|
||||||
|
readonly output: 'pg/timestamptz-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamptz-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timetz@1': { readonly output: 'pg/timetz@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/char@1': { readonly output: 'sql/char@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/float@1': { readonly output: 'sql/float@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'sql/int@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/text@1': { readonly output: 'sql/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly min: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/char@1': { readonly output: 'pg/char@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-string@1': { readonly output: 'pg/date-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-temporal@1': {
|
||||||
|
readonly output: 'pg/date-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/enum@1': { readonly output: 'pg/enum@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/inet@1': { readonly output: 'pg/inet@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int2@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text-array@1': { readonly output: 'pg/text-array@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/time-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': {
|
||||||
|
readonly output: 'pg/time-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-string@1': {
|
||||||
|
readonly output: 'pg/timestamp-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamp-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-string@1': {
|
||||||
|
readonly output: 'pg/timestamptz-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamptz-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timetz@1': { readonly output: 'pg/timetz@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/char@1': { readonly output: 'sql/char@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/float@1': { readonly output: 'sql/float@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'sql/int@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/text@1': { readonly output: 'sql/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly sum: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'sql/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly sumBigInt: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/unboundedint@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/unboundedint@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
type DefaultLiteralValue<CodecId extends string, Encoded> = CodecId extends keyof CodecTypes
|
||||||
|
? Encoded extends CodecTypes[CodecId]['json']
|
||||||
|
? Encoded
|
||||||
|
: CodecTypes[CodecId]['json']
|
||||||
|
: Encoded;
|
||||||
|
|
||||||
|
export type FieldOutputTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly Post: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly title: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly context: CodecTypes['pg/text@1']['output'];
|
||||||
|
};
|
||||||
|
readonly User: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['output'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type FieldInputTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly Post: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly title: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly context: CodecTypes['pg/text@1']['input'];
|
||||||
|
};
|
||||||
|
readonly User: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['input'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type StorageColumnTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly post: {
|
||||||
|
readonly context: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly title: CodecTypes['pg/text@1']['output'];
|
||||||
|
};
|
||||||
|
readonly user: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['output'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type StorageColumnInputTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly post: {
|
||||||
|
readonly context: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly title: CodecTypes['pg/text@1']['input'];
|
||||||
|
};
|
||||||
|
readonly user: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['input'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export namespace Models {
|
||||||
|
export type public_User = {
|
||||||
|
id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
nickname: CodecTypes['pg/text@1']['output'];
|
||||||
|
username: CodecTypes['pg/text@1']['output'];
|
||||||
|
password: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly [RelationKeys]?: never;
|
||||||
|
};
|
||||||
|
export type public_Post = {
|
||||||
|
id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
title: CodecTypes['pg/text@1']['output'];
|
||||||
|
context: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly [RelationKeys]?: never;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare const models: {
|
||||||
|
public: {
|
||||||
|
User: Models.public_User;
|
||||||
|
Post: Models.public_Post;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TypeMaps = TypeMapsType<
|
||||||
|
CodecTypes,
|
||||||
|
QueryOperationTypes,
|
||||||
|
FieldOutputTypes,
|
||||||
|
FieldInputTypes,
|
||||||
|
StorageColumnTypes,
|
||||||
|
StorageColumnInputTypes,
|
||||||
|
AggregateTypes
|
||||||
|
>;
|
||||||
|
|
||||||
|
type ContractBase = Omit<
|
||||||
|
ContractType<{
|
||||||
|
readonly namespaces: {
|
||||||
|
readonly public: {
|
||||||
|
readonly id: 'public';
|
||||||
|
readonly kind: 'postgres-schema';
|
||||||
|
readonly entries: {
|
||||||
|
readonly table: {
|
||||||
|
readonly post: {
|
||||||
|
columns: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nativeType: 'int4';
|
||||||
|
readonly codecId: 'pg/int4@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly default: {
|
||||||
|
readonly kind: 'function';
|
||||||
|
readonly expression: 'autoincrement()';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly title: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly context: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
primaryKey: { readonly columns: readonly ['id'] };
|
||||||
|
uniques: readonly [];
|
||||||
|
indexes: readonly [];
|
||||||
|
foreignKeys: readonly [];
|
||||||
|
};
|
||||||
|
readonly user: {
|
||||||
|
columns: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nativeType: 'int4';
|
||||||
|
readonly codecId: 'pg/int4@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly default: {
|
||||||
|
readonly kind: 'function';
|
||||||
|
readonly expression: 'autoincrement()';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly nickname: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly username: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly password: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
primaryKey: { readonly columns: readonly ['id'] };
|
||||||
|
uniques: readonly [{ readonly columns: readonly ['username'] }];
|
||||||
|
indexes: readonly [];
|
||||||
|
foreignKeys: readonly [];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly storageHash: StorageHash;
|
||||||
|
}>,
|
||||||
|
'roots' | 'domain'
|
||||||
|
> & {
|
||||||
|
readonly target: 'postgres';
|
||||||
|
readonly targetFamily: 'sql';
|
||||||
|
readonly roots: {
|
||||||
|
readonly user: { readonly namespace: 'public' & NamespaceId; readonly model: 'User' };
|
||||||
|
readonly post: { readonly namespace: 'public' & NamespaceId; readonly model: 'Post' };
|
||||||
|
};
|
||||||
|
readonly domain: {
|
||||||
|
readonly namespaces: {
|
||||||
|
readonly public: {
|
||||||
|
readonly models: {
|
||||||
|
readonly Post: {
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' };
|
||||||
|
};
|
||||||
|
readonly title: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
readonly context: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly relations: Record<string, never>;
|
||||||
|
readonly storage: {
|
||||||
|
readonly table: 'post';
|
||||||
|
readonly namespaceId: 'public';
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: { readonly column: 'id' };
|
||||||
|
readonly title: { readonly column: 'title' };
|
||||||
|
readonly context: { readonly column: 'context' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly User: {
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' };
|
||||||
|
};
|
||||||
|
readonly nickname: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
readonly username: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
readonly password: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly relations: Record<string, never>;
|
||||||
|
readonly storage: {
|
||||||
|
readonly table: 'user';
|
||||||
|
readonly namespaceId: 'public';
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: { readonly column: 'id' };
|
||||||
|
readonly nickname: { readonly column: 'nickname' };
|
||||||
|
readonly username: { readonly column: 'username' };
|
||||||
|
readonly password: { readonly column: 'password' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly capabilities: {
|
||||||
|
readonly postgres: {
|
||||||
|
readonly distinctOn: true;
|
||||||
|
readonly jsonAgg: true;
|
||||||
|
readonly lateral: true;
|
||||||
|
readonly limit: true;
|
||||||
|
readonly orderBy: true;
|
||||||
|
readonly returning: true;
|
||||||
|
};
|
||||||
|
readonly sql: {
|
||||||
|
readonly checkConstraint: true;
|
||||||
|
readonly defaultInInsert: true;
|
||||||
|
readonly enums: true;
|
||||||
|
readonly lateral: true;
|
||||||
|
readonly returning: true;
|
||||||
|
readonly scalarList: true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly extensions: {};
|
||||||
|
readonly meta: {};
|
||||||
|
|
||||||
|
readonly profileHash: ProfileHash;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Contract = ContractWithTypeMaps<ContractBase, TypeMaps>;
|
||||||
|
|
||||||
|
export type Namespaces = Contract['storage']['namespaces'];
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
{"_generated":{"message":"This file is automatically generated by \"prisma contract emit\".","regenerate":"To regenerate, run: prisma contract emit","warning":"⚠️ GENERATED FILE - DO NOT EDIT"},"capabilities":{"postgres":{"distinctOn":true,"jsonAgg":true,"lateral":true,"limit":true,"orderBy":true,"returning":true},"sql":{"checkConstraint":true,"defaultInInsert":true,"enums":true,"lateral":true,"returning":true,"scalarList":true}},"domain":{"namespaces":{"public":{"models":{"Post":{"fields":{"context":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}},"id":{"nullable":false,"type":{"codecId":"pg/int4@1","kind":"scalar"}},"title":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}}},"relations":{},"storage":{"fields":{"context":{"column":"context"},"id":{"column":"id"},"title":{"column":"title"}},"namespaceId":"public","table":"post"}},"User":{"fields":{"id":{"nullable":false,"type":{"codecId":"pg/int4@1","kind":"scalar"}},"nickname":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}},"password":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}},"username":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}}},"relations":{},"storage":{"fields":{"id":{"column":"id"},"nickname":{"column":"nickname"},"password":{"column":"password"},"username":{"column":"username"}},"namespaceId":"public","table":"user"}}}}}},"extensions":{},"meta":{},"profileHash":"3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2","roots":{"post":{"model":"Post","namespace":"public"},"user":{"model":"User","namespace":"public"}},"schemaVersion":"1","storage":{"namespaces":{"public":{"entries":{"table":{"post":{"columns":{"context":{"codecId":"pg/text@1","nativeType":"text","nullable":false},"id":{"codecId":"pg/int4@1","default":{"expression":"autoincrement()","kind":"function"},"nativeType":"int4","nullable":false},"title":{"codecId":"pg/text@1","nativeType":"text","nullable":false}},"foreignKeys":[],"indexes":[],"primaryKey":{"columns":["id"]},"uniques":[]},"user":{"columns":{"id":{"codecId":"pg/int4@1","default":{"expression":"autoincrement()","kind":"function"},"nativeType":"int4","nullable":false},"nickname":{"codecId":"pg/text@1","nativeType":"text","nullable":false},"password":{"codecId":"pg/text@1","nativeType":"text","nullable":false},"username":{"codecId":"pg/text@1","nativeType":"text","nullable":false}},"foreignKeys":[],"indexes":[],"primaryKey":{"columns":["id"]},"uniques":[{"columns":["username"]}]}}},"id":"public","kind":"postgres-schema"}},"storageHash":"0a0d5f715195fa3e27bfec1d19e8ff84c81e40676c4a3b5ae59513606881efca"},"target":"postgres","targetFamily":"sql"}
|
||||||
Vendored
+561
@@ -0,0 +1,561 @@
|
|||||||
|
// ⚠️ GENERATED FILE - DO NOT EDIT
|
||||||
|
// This file is automatically generated by 'prisma contract emit'.
|
||||||
|
// To regenerate, run: prisma contract emit
|
||||||
|
import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types';
|
||||||
|
import type {
|
||||||
|
Bit,
|
||||||
|
Char,
|
||||||
|
CodecTypes as PgTypes,
|
||||||
|
Interval,
|
||||||
|
JsonValue,
|
||||||
|
Numeric,
|
||||||
|
Time,
|
||||||
|
TimeString,
|
||||||
|
Timestamp,
|
||||||
|
TimestampString,
|
||||||
|
Timestamptz,
|
||||||
|
TimestamptzString,
|
||||||
|
Timetz,
|
||||||
|
VarBit,
|
||||||
|
Varchar,
|
||||||
|
} from '@prisma/orm-postgres/target/codec-types';
|
||||||
|
|
||||||
|
import type {
|
||||||
|
ContractWithTypeMaps,
|
||||||
|
RelationKeys,
|
||||||
|
TypeMaps as TypeMapsType,
|
||||||
|
} from '@prisma/orm-postgres/family-contract/types';
|
||||||
|
import type {
|
||||||
|
Contract as ContractType,
|
||||||
|
ExecutionHashBase,
|
||||||
|
NamespaceId,
|
||||||
|
ProfileHashBase,
|
||||||
|
StorageHashBase,
|
||||||
|
} from '@prisma/orm-postgres/contract/types';
|
||||||
|
|
||||||
|
export type StorageHash =
|
||||||
|
StorageHashBase<'66cb816949cf8f6a536fcdd60eeb1bb528c3e58ae9bc6737273a2fe0a26f5843'>;
|
||||||
|
export type ExecutionHash = ExecutionHashBase<string>;
|
||||||
|
export type ProfileHash =
|
||||||
|
ProfileHashBase<'3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2'>;
|
||||||
|
|
||||||
|
export type CodecTypes = PgTypes;
|
||||||
|
export type LaneCodecTypes = CodecTypes;
|
||||||
|
export type QueryOperationTypes = PgAdapterQueryOps<CodecTypes>;
|
||||||
|
export type AggregateTypes = {
|
||||||
|
readonly avg: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly avgDecimal: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly count: {
|
||||||
|
readonly byCodec: {};
|
||||||
|
readonly withoutInput: { readonly output: 'pg/int8number@1'; readonly nullable: false };
|
||||||
|
readonly anyInput: { readonly output: 'pg/int8number@1'; readonly nullable: false };
|
||||||
|
};
|
||||||
|
readonly countBigInt: {
|
||||||
|
readonly byCodec: {};
|
||||||
|
readonly withoutInput: { readonly output: 'pg/int8@1'; readonly nullable: false };
|
||||||
|
readonly anyInput: { readonly output: 'pg/int8@1'; readonly nullable: false };
|
||||||
|
};
|
||||||
|
readonly max: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/char@1': { readonly output: 'pg/char@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-string@1': { readonly output: 'pg/date-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-temporal@1': {
|
||||||
|
readonly output: 'pg/date-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/enum@1': { readonly output: 'pg/enum@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/inet@1': { readonly output: 'pg/inet@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int2@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text-array@1': { readonly output: 'pg/text-array@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/time-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': {
|
||||||
|
readonly output: 'pg/time-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-string@1': {
|
||||||
|
readonly output: 'pg/timestamp-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamp-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-string@1': {
|
||||||
|
readonly output: 'pg/timestamptz-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamptz-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timetz@1': { readonly output: 'pg/timetz@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/char@1': { readonly output: 'sql/char@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/float@1': { readonly output: 'sql/float@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'sql/int@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/text@1': { readonly output: 'sql/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly min: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/char@1': { readonly output: 'pg/char@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-string@1': { readonly output: 'pg/date-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-temporal@1': {
|
||||||
|
readonly output: 'pg/date-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/enum@1': { readonly output: 'pg/enum@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/inet@1': { readonly output: 'pg/inet@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int2@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text-array@1': { readonly output: 'pg/text-array@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/time-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': {
|
||||||
|
readonly output: 'pg/time-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-string@1': {
|
||||||
|
readonly output: 'pg/timestamp-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamp-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-string@1': {
|
||||||
|
readonly output: 'pg/timestamptz-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamptz-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timetz@1': { readonly output: 'pg/timetz@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/char@1': { readonly output: 'sql/char@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/float@1': { readonly output: 'sql/float@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'sql/int@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/text@1': { readonly output: 'sql/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly sum: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'sql/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly sumBigInt: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/unboundedint@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/unboundedint@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
type DefaultLiteralValue<CodecId extends string, Encoded> = CodecId extends keyof CodecTypes
|
||||||
|
? Encoded extends CodecTypes[CodecId]['json']
|
||||||
|
? Encoded
|
||||||
|
: CodecTypes[CodecId]['json']
|
||||||
|
: Encoded;
|
||||||
|
|
||||||
|
export type FieldOutputTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly Post: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly user_id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly title: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly context: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly is_public: CodecTypes['pg/bool@1']['output'];
|
||||||
|
readonly status: CodecTypes['pg/int4@1']['output'];
|
||||||
|
};
|
||||||
|
readonly User: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['output'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type FieldInputTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly Post: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly user_id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly title: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly context: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly is_public: CodecTypes['pg/bool@1']['input'];
|
||||||
|
readonly status: CodecTypes['pg/int4@1']['input'];
|
||||||
|
};
|
||||||
|
readonly User: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['input'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type StorageColumnTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly post: {
|
||||||
|
readonly context: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly is_public: CodecTypes['pg/bool@1']['output'];
|
||||||
|
readonly status: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly title: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly user_id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
};
|
||||||
|
readonly user: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['output'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type StorageColumnInputTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly post: {
|
||||||
|
readonly context: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly is_public: CodecTypes['pg/bool@1']['input'];
|
||||||
|
readonly status: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly title: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly user_id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
};
|
||||||
|
readonly user: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['input'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export namespace Models {
|
||||||
|
export type public_User = {
|
||||||
|
id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
nickname: CodecTypes['pg/text@1']['output'];
|
||||||
|
username: CodecTypes['pg/text@1']['output'];
|
||||||
|
password: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly [RelationKeys]?: never;
|
||||||
|
};
|
||||||
|
export type public_Post = {
|
||||||
|
id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
user_id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
title: CodecTypes['pg/text@1']['output'];
|
||||||
|
context: CodecTypes['pg/text@1']['output'];
|
||||||
|
is_public: CodecTypes['pg/bool@1']['output'];
|
||||||
|
status: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly [RelationKeys]?: never;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare const models: {
|
||||||
|
public: {
|
||||||
|
User: Models.public_User;
|
||||||
|
Post: Models.public_Post;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TypeMaps = TypeMapsType<
|
||||||
|
CodecTypes,
|
||||||
|
QueryOperationTypes,
|
||||||
|
FieldOutputTypes,
|
||||||
|
FieldInputTypes,
|
||||||
|
StorageColumnTypes,
|
||||||
|
StorageColumnInputTypes,
|
||||||
|
AggregateTypes
|
||||||
|
>;
|
||||||
|
|
||||||
|
type ContractBase = Omit<
|
||||||
|
ContractType<{
|
||||||
|
readonly namespaces: {
|
||||||
|
readonly public: {
|
||||||
|
readonly id: 'public';
|
||||||
|
readonly kind: 'postgres-schema';
|
||||||
|
readonly entries: {
|
||||||
|
readonly table: {
|
||||||
|
readonly post: {
|
||||||
|
columns: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nativeType: 'int4';
|
||||||
|
readonly codecId: 'pg/int4@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly default: {
|
||||||
|
readonly kind: 'function';
|
||||||
|
readonly expression: 'autoincrement()';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly user_id: {
|
||||||
|
readonly nativeType: 'int4';
|
||||||
|
readonly codecId: 'pg/int4@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly title: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly context: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly is_public: {
|
||||||
|
readonly nativeType: 'bool';
|
||||||
|
readonly codecId: 'pg/bool@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly default: {
|
||||||
|
readonly kind: 'literal';
|
||||||
|
readonly value: DefaultLiteralValue<'pg/bool@1', true>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly status: {
|
||||||
|
readonly nativeType: 'int4';
|
||||||
|
readonly codecId: 'pg/int4@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly default: {
|
||||||
|
readonly kind: 'literal';
|
||||||
|
readonly value: DefaultLiteralValue<'pg/int4@1', 0>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
primaryKey: { readonly columns: readonly ['id'] };
|
||||||
|
uniques: readonly [];
|
||||||
|
indexes: readonly [];
|
||||||
|
foreignKeys: readonly [];
|
||||||
|
};
|
||||||
|
readonly user: {
|
||||||
|
columns: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nativeType: 'int4';
|
||||||
|
readonly codecId: 'pg/int4@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly default: {
|
||||||
|
readonly kind: 'function';
|
||||||
|
readonly expression: 'autoincrement()';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly nickname: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly username: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly password: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
primaryKey: { readonly columns: readonly ['id'] };
|
||||||
|
uniques: readonly [{ readonly columns: readonly ['username'] }];
|
||||||
|
indexes: readonly [];
|
||||||
|
foreignKeys: readonly [];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly storageHash: StorageHash;
|
||||||
|
}>,
|
||||||
|
'roots' | 'domain'
|
||||||
|
> & {
|
||||||
|
readonly target: 'postgres';
|
||||||
|
readonly targetFamily: 'sql';
|
||||||
|
readonly roots: {
|
||||||
|
readonly user: { readonly namespace: 'public' & NamespaceId; readonly model: 'User' };
|
||||||
|
readonly post: { readonly namespace: 'public' & NamespaceId; readonly model: 'Post' };
|
||||||
|
};
|
||||||
|
readonly domain: {
|
||||||
|
readonly namespaces: {
|
||||||
|
readonly public: {
|
||||||
|
readonly models: {
|
||||||
|
readonly Post: {
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' };
|
||||||
|
};
|
||||||
|
readonly user_id: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' };
|
||||||
|
};
|
||||||
|
readonly title: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
readonly context: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
readonly is_public: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' };
|
||||||
|
};
|
||||||
|
readonly status: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly relations: Record<string, never>;
|
||||||
|
readonly storage: {
|
||||||
|
readonly table: 'post';
|
||||||
|
readonly namespaceId: 'public';
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: { readonly column: 'id' };
|
||||||
|
readonly user_id: { readonly column: 'user_id' };
|
||||||
|
readonly title: { readonly column: 'title' };
|
||||||
|
readonly context: { readonly column: 'context' };
|
||||||
|
readonly is_public: { readonly column: 'is_public' };
|
||||||
|
readonly status: { readonly column: 'status' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly User: {
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' };
|
||||||
|
};
|
||||||
|
readonly nickname: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
readonly username: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
readonly password: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly relations: Record<string, never>;
|
||||||
|
readonly storage: {
|
||||||
|
readonly table: 'user';
|
||||||
|
readonly namespaceId: 'public';
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: { readonly column: 'id' };
|
||||||
|
readonly nickname: { readonly column: 'nickname' };
|
||||||
|
readonly username: { readonly column: 'username' };
|
||||||
|
readonly password: { readonly column: 'password' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly capabilities: {
|
||||||
|
readonly postgres: {
|
||||||
|
readonly distinctOn: true;
|
||||||
|
readonly jsonAgg: true;
|
||||||
|
readonly lateral: true;
|
||||||
|
readonly limit: true;
|
||||||
|
readonly orderBy: true;
|
||||||
|
readonly returning: true;
|
||||||
|
};
|
||||||
|
readonly sql: {
|
||||||
|
readonly checkConstraint: true;
|
||||||
|
readonly defaultInInsert: true;
|
||||||
|
readonly enums: true;
|
||||||
|
readonly lateral: true;
|
||||||
|
readonly returning: true;
|
||||||
|
readonly scalarList: true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly extensions: {};
|
||||||
|
readonly meta: {};
|
||||||
|
|
||||||
|
readonly profileHash: ProfileHash;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Contract = ContractWithTypeMaps<ContractBase, TypeMaps>;
|
||||||
|
|
||||||
|
export type Namespaces = Contract['storage']['namespaces'];
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
{"_generated":{"message":"This file is automatically generated by \"prisma contract emit\".","regenerate":"To regenerate, run: prisma contract emit","warning":"⚠️ GENERATED FILE - DO NOT EDIT"},"capabilities":{"postgres":{"distinctOn":true,"jsonAgg":true,"lateral":true,"limit":true,"orderBy":true,"returning":true},"sql":{"checkConstraint":true,"defaultInInsert":true,"enums":true,"lateral":true,"returning":true,"scalarList":true}},"domain":{"namespaces":{"public":{"models":{"Post":{"fields":{"context":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}},"id":{"nullable":false,"type":{"codecId":"pg/int4@1","kind":"scalar"}},"is_public":{"nullable":false,"type":{"codecId":"pg/bool@1","kind":"scalar"}},"status":{"nullable":false,"type":{"codecId":"pg/int4@1","kind":"scalar"}},"title":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}},"user_id":{"nullable":false,"type":{"codecId":"pg/int4@1","kind":"scalar"}}},"relations":{},"storage":{"fields":{"context":{"column":"context"},"id":{"column":"id"},"is_public":{"column":"is_public"},"status":{"column":"status"},"title":{"column":"title"},"user_id":{"column":"user_id"}},"namespaceId":"public","table":"post"}},"User":{"fields":{"id":{"nullable":false,"type":{"codecId":"pg/int4@1","kind":"scalar"}},"nickname":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}},"password":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}},"username":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}}},"relations":{},"storage":{"fields":{"id":{"column":"id"},"nickname":{"column":"nickname"},"password":{"column":"password"},"username":{"column":"username"}},"namespaceId":"public","table":"user"}}}}}},"extensions":{},"meta":{},"profileHash":"3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2","roots":{"post":{"model":"Post","namespace":"public"},"user":{"model":"User","namespace":"public"}},"schemaVersion":"1","storage":{"namespaces":{"public":{"entries":{"table":{"post":{"columns":{"context":{"codecId":"pg/text@1","nativeType":"text","nullable":false},"id":{"codecId":"pg/int4@1","default":{"expression":"autoincrement()","kind":"function"},"nativeType":"int4","nullable":false},"is_public":{"codecId":"pg/bool@1","default":{"kind":"literal","value":true},"nativeType":"bool","nullable":false},"status":{"codecId":"pg/int4@1","default":{"kind":"literal","value":0},"nativeType":"int4","nullable":false},"title":{"codecId":"pg/text@1","nativeType":"text","nullable":false},"user_id":{"codecId":"pg/int4@1","nativeType":"int4","nullable":false}},"foreignKeys":[],"indexes":[],"primaryKey":{"columns":["id"]},"uniques":[]},"user":{"columns":{"id":{"codecId":"pg/int4@1","default":{"expression":"autoincrement()","kind":"function"},"nativeType":"int4","nullable":false},"nickname":{"codecId":"pg/text@1","nativeType":"text","nullable":false},"password":{"codecId":"pg/text@1","nativeType":"text","nullable":false},"username":{"codecId":"pg/text@1","nativeType":"text","nullable":false}},"foreignKeys":[],"indexes":[],"primaryKey":{"columns":["id"]},"uniques":[{"columns":["username"]}]}}},"id":"public","kind":"postgres-schema"}},"storageHash":"66cb816949cf8f6a536fcdd60eeb1bb528c3e58ae9bc6737273a2fe0a26f5843"},"target":"postgres","targetFamily":"sql"}
|
||||||
Vendored
+427
@@ -0,0 +1,427 @@
|
|||||||
|
// ⚠️ GENERATED FILE - DO NOT EDIT
|
||||||
|
// This file is automatically generated by 'prisma contract emit'.
|
||||||
|
// To regenerate, run: prisma contract emit
|
||||||
|
import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types';
|
||||||
|
import type {
|
||||||
|
Bit,
|
||||||
|
Char,
|
||||||
|
CodecTypes as PgTypes,
|
||||||
|
Interval,
|
||||||
|
JsonValue,
|
||||||
|
Numeric,
|
||||||
|
Time,
|
||||||
|
TimeString,
|
||||||
|
Timestamp,
|
||||||
|
TimestampString,
|
||||||
|
Timestamptz,
|
||||||
|
TimestamptzString,
|
||||||
|
Timetz,
|
||||||
|
VarBit,
|
||||||
|
Varchar,
|
||||||
|
} from '@prisma/orm-postgres/target/codec-types';
|
||||||
|
|
||||||
|
import type {
|
||||||
|
ContractWithTypeMaps,
|
||||||
|
RelationKeys,
|
||||||
|
TypeMaps as TypeMapsType,
|
||||||
|
} from '@prisma/orm-postgres/family-contract/types';
|
||||||
|
import type {
|
||||||
|
Contract as ContractType,
|
||||||
|
ExecutionHashBase,
|
||||||
|
NamespaceId,
|
||||||
|
ProfileHashBase,
|
||||||
|
StorageHashBase,
|
||||||
|
} from '@prisma/orm-postgres/contract/types';
|
||||||
|
|
||||||
|
export type StorageHash =
|
||||||
|
StorageHashBase<'6d4e64348cacbe8efec961e207dadcb208487796fec57113519e0f12fbfaeee8'>;
|
||||||
|
export type ExecutionHash = ExecutionHashBase<string>;
|
||||||
|
export type ProfileHash =
|
||||||
|
ProfileHashBase<'3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2'>;
|
||||||
|
|
||||||
|
export type CodecTypes = PgTypes;
|
||||||
|
export type LaneCodecTypes = CodecTypes;
|
||||||
|
export type QueryOperationTypes = PgAdapterQueryOps<CodecTypes>;
|
||||||
|
export type AggregateTypes = {
|
||||||
|
readonly avg: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly avgDecimal: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly count: {
|
||||||
|
readonly byCodec: {};
|
||||||
|
readonly withoutInput: { readonly output: 'pg/int8number@1'; readonly nullable: false };
|
||||||
|
readonly anyInput: { readonly output: 'pg/int8number@1'; readonly nullable: false };
|
||||||
|
};
|
||||||
|
readonly countBigInt: {
|
||||||
|
readonly byCodec: {};
|
||||||
|
readonly withoutInput: { readonly output: 'pg/int8@1'; readonly nullable: false };
|
||||||
|
readonly anyInput: { readonly output: 'pg/int8@1'; readonly nullable: false };
|
||||||
|
};
|
||||||
|
readonly max: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/char@1': { readonly output: 'pg/char@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-string@1': { readonly output: 'pg/date-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-temporal@1': {
|
||||||
|
readonly output: 'pg/date-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/enum@1': { readonly output: 'pg/enum@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/inet@1': { readonly output: 'pg/inet@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int2@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text-array@1': { readonly output: 'pg/text-array@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/time-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': {
|
||||||
|
readonly output: 'pg/time-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-string@1': {
|
||||||
|
readonly output: 'pg/timestamp-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamp-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-string@1': {
|
||||||
|
readonly output: 'pg/timestamptz-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamptz-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timetz@1': { readonly output: 'pg/timetz@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/char@1': { readonly output: 'sql/char@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/float@1': { readonly output: 'sql/float@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'sql/int@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/text@1': { readonly output: 'sql/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly min: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/char@1': { readonly output: 'pg/char@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-string@1': { readonly output: 'pg/date-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-temporal@1': {
|
||||||
|
readonly output: 'pg/date-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/enum@1': { readonly output: 'pg/enum@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/inet@1': { readonly output: 'pg/inet@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int2@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text-array@1': { readonly output: 'pg/text-array@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/time-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': {
|
||||||
|
readonly output: 'pg/time-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-string@1': {
|
||||||
|
readonly output: 'pg/timestamp-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamp-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-string@1': {
|
||||||
|
readonly output: 'pg/timestamptz-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamptz-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timetz@1': { readonly output: 'pg/timetz@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/char@1': { readonly output: 'sql/char@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/float@1': { readonly output: 'sql/float@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'sql/int@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/text@1': { readonly output: 'sql/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly sum: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'sql/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly sumBigInt: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/unboundedint@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/unboundedint@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
type DefaultLiteralValue<CodecId extends string, Encoded> = CodecId extends keyof CodecTypes
|
||||||
|
? Encoded extends CodecTypes[CodecId]['json']
|
||||||
|
? Encoded
|
||||||
|
: CodecTypes[CodecId]['json']
|
||||||
|
: Encoded;
|
||||||
|
|
||||||
|
export type FieldOutputTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly User: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['output'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type FieldInputTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly User: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['input'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type StorageColumnTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly user: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['output'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type StorageColumnInputTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly user: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['input'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export namespace Models {
|
||||||
|
export type public_User = {
|
||||||
|
id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
nickname: CodecTypes['pg/text@1']['output'];
|
||||||
|
username: CodecTypes['pg/text@1']['output'];
|
||||||
|
password: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly [RelationKeys]?: never;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare const models: {
|
||||||
|
public: {
|
||||||
|
User: Models.public_User;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TypeMaps = TypeMapsType<
|
||||||
|
CodecTypes,
|
||||||
|
QueryOperationTypes,
|
||||||
|
FieldOutputTypes,
|
||||||
|
FieldInputTypes,
|
||||||
|
StorageColumnTypes,
|
||||||
|
StorageColumnInputTypes,
|
||||||
|
AggregateTypes
|
||||||
|
>;
|
||||||
|
|
||||||
|
type ContractBase = Omit<
|
||||||
|
ContractType<{
|
||||||
|
readonly namespaces: {
|
||||||
|
readonly public: {
|
||||||
|
readonly id: 'public';
|
||||||
|
readonly kind: 'postgres-schema';
|
||||||
|
readonly entries: {
|
||||||
|
readonly table: {
|
||||||
|
readonly user: {
|
||||||
|
columns: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nativeType: 'int4';
|
||||||
|
readonly codecId: 'pg/int4@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly default: {
|
||||||
|
readonly kind: 'function';
|
||||||
|
readonly expression: 'autoincrement()';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly nickname: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly username: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly password: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
primaryKey: { readonly columns: readonly ['id'] };
|
||||||
|
uniques: readonly [{ readonly columns: readonly ['username'] }];
|
||||||
|
indexes: readonly [];
|
||||||
|
foreignKeys: readonly [];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly storageHash: StorageHash;
|
||||||
|
}>,
|
||||||
|
'roots' | 'domain'
|
||||||
|
> & {
|
||||||
|
readonly target: 'postgres';
|
||||||
|
readonly targetFamily: 'sql';
|
||||||
|
readonly roots: {
|
||||||
|
readonly user: { readonly namespace: 'public' & NamespaceId; readonly model: 'User' };
|
||||||
|
};
|
||||||
|
readonly domain: {
|
||||||
|
readonly namespaces: {
|
||||||
|
readonly public: {
|
||||||
|
readonly models: {
|
||||||
|
readonly User: {
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' };
|
||||||
|
};
|
||||||
|
readonly nickname: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
readonly username: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
readonly password: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly relations: Record<string, never>;
|
||||||
|
readonly storage: {
|
||||||
|
readonly table: 'user';
|
||||||
|
readonly namespaceId: 'public';
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: { readonly column: 'id' };
|
||||||
|
readonly nickname: { readonly column: 'nickname' };
|
||||||
|
readonly username: { readonly column: 'username' };
|
||||||
|
readonly password: { readonly column: 'password' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly capabilities: {
|
||||||
|
readonly postgres: {
|
||||||
|
readonly distinctOn: true;
|
||||||
|
readonly jsonAgg: true;
|
||||||
|
readonly lateral: true;
|
||||||
|
readonly limit: true;
|
||||||
|
readonly orderBy: true;
|
||||||
|
readonly returning: true;
|
||||||
|
};
|
||||||
|
readonly sql: {
|
||||||
|
readonly checkConstraint: true;
|
||||||
|
readonly defaultInInsert: true;
|
||||||
|
readonly enums: true;
|
||||||
|
readonly lateral: true;
|
||||||
|
readonly returning: true;
|
||||||
|
readonly scalarList: true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly extensions: {};
|
||||||
|
readonly meta: {};
|
||||||
|
|
||||||
|
readonly profileHash: ProfileHash;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Contract = ContractWithTypeMaps<ContractBase, TypeMaps>;
|
||||||
|
|
||||||
|
export type Namespaces = Contract['storage']['namespaces'];
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
{"_generated":{"message":"This file is automatically generated by \"prisma contract emit\".","regenerate":"To regenerate, run: prisma contract emit","warning":"⚠️ GENERATED FILE - DO NOT EDIT"},"capabilities":{"postgres":{"distinctOn":true,"jsonAgg":true,"lateral":true,"limit":true,"orderBy":true,"returning":true},"sql":{"checkConstraint":true,"defaultInInsert":true,"enums":true,"lateral":true,"returning":true,"scalarList":true}},"domain":{"namespaces":{"public":{"models":{"User":{"fields":{"id":{"nullable":false,"type":{"codecId":"pg/int4@1","kind":"scalar"}},"nickname":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}},"password":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}},"username":{"nullable":false,"type":{"codecId":"pg/text@1","kind":"scalar"}}},"relations":{},"storage":{"fields":{"id":{"column":"id"},"nickname":{"column":"nickname"},"password":{"column":"password"},"username":{"column":"username"}},"namespaceId":"public","table":"user"}}}}}},"extensions":{},"meta":{},"profileHash":"3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2","roots":{"user":{"model":"User","namespace":"public"}},"schemaVersion":"1","storage":{"namespaces":{"public":{"entries":{"table":{"user":{"columns":{"id":{"codecId":"pg/int4@1","default":{"expression":"autoincrement()","kind":"function"},"nativeType":"int4","nullable":false},"nickname":{"codecId":"pg/text@1","nativeType":"text","nullable":false},"password":{"codecId":"pg/text@1","nativeType":"text","nullable":false},"username":{"codecId":"pg/text@1","nativeType":"text","nullable":false}},"foreignKeys":[],"indexes":[],"primaryKey":{"columns":["id"]},"uniques":[{"columns":["username"]}]}}},"id":"public","kind":"postgres-schema"}},"storageHash":"6d4e64348cacbe8efec961e207dadcb208487796fec57113519e0f12fbfaeee8"},"target":"postgres","targetFamily":"sql"}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"name": "elysia",
|
||||||
|
"type": "module",
|
||||||
|
"version": "1.0.50",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"dev": "bun run --watch src/index.ts",
|
||||||
|
"contract:emit": "prisma contract emit"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@elysia/cors": "^1.4.2",
|
||||||
|
"@elysia/jwt": "^1.4.2",
|
||||||
|
"@elysia/openapi": "^1.4.16",
|
||||||
|
"@prisma/orm-family-sql": "^8.0.0-rc.11",
|
||||||
|
"@prisma/orm-postgres": "^8.0.0-rc.11",
|
||||||
|
"dotenv": "^18.0.1",
|
||||||
|
"elysia": "latest"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@prisma/cli-engine": "0.4.0",
|
||||||
|
"@types/node": "^26.6.2",
|
||||||
|
"bun-types": "latest",
|
||||||
|
"prisma": "^8.0.0-rc.15"
|
||||||
|
},
|
||||||
|
"module": "src/index.js"
|
||||||
|
}
|
||||||
+106
@@ -0,0 +1,106 @@
|
|||||||
|
# Welcome to Prisma ORM!
|
||||||
|
|
||||||
|
Prisma ORM lets you query your database in simple, easy-to-read TypeScript. Define what your data looks like, and Prisma ORM gives you a fully typed client — with autocomplete for every table, column, and relation.
|
||||||
|
|
||||||
|
This project is set up for PostgreSQL. Prisma ORM also supports other databases.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- **PostgreSQL 15 or newer.** Older servers are not supported. Run `SELECT version()` against your server to verify.
|
||||||
|
- The CLI never connects to your database without explicit consent. Pass `--probe-db` to `bun prisma orm init` if you want `init` to verify the server version itself.
|
||||||
|
|
||||||
|
## Your data contract
|
||||||
|
|
||||||
|
Your data contract is the heart of your application. It lives at [`src/prisma/contract.prisma`](src/prisma/contract.prisma) and describes your models:
|
||||||
|
|
||||||
|
```prisma
|
||||||
|
model User {
|
||||||
|
id Int @id @default(autoincrement())
|
||||||
|
email String @unique
|
||||||
|
username String?
|
||||||
|
name String?
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Every model you define in your contract can be queried from your app. Your editor will autocomplete the query methods and show you what type each model field is:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { db } from './src/prisma/db';
|
||||||
|
|
||||||
|
const user = await db.orm.public.User
|
||||||
|
.where({ email: 'alice@example.com' })
|
||||||
|
.first();
|
||||||
|
|
||||||
|
// Your editor will show the type of user as
|
||||||
|
// { id: number; email: string; username: string | null; name: string | null; createdAt: Date; posts: Post[] } | null
|
||||||
|
```
|
||||||
|
|
||||||
|
Your contract has two companion files in the same directory:
|
||||||
|
|
||||||
|
- **`contract.json`** — this tells your application what models exist, just like `package-lock.json` tells your package manager what dependencies your project has
|
||||||
|
- **`contract.d.ts`** — this powers autocomplete and type checking in your editor
|
||||||
|
|
||||||
|
Commit both files to git. When you change your contract, run `bun prisma contract emit` to update them.
|
||||||
|
|
||||||
|
If you use a framework like Next.js or Vite, the Prisma ORM plugin will do this for you automatically.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
[`prisma.config.ts`](prisma.config.ts) tells the CLI where your contract lives and how to connect to your database. It loads environment variables from `.env` automatically:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import 'dotenv/config';
|
||||||
|
import { definePrismaConfig } from '@prisma/cli-engine';
|
||||||
|
import { defineConfig as ormConfig } from '@prisma/orm-postgres/config';
|
||||||
|
|
||||||
|
export default definePrismaConfig({
|
||||||
|
orm: ormConfig({
|
||||||
|
contract: './src/prisma/contract.prisma',
|
||||||
|
db: {
|
||||||
|
connection: process.env['DATABASE_URL']!,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
Notice the `DATABASE_URL` above? It's defined in your [`.env`](./.env) file:
|
||||||
|
|
||||||
|
```env
|
||||||
|
DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
|
||||||
|
```
|
||||||
|
|
||||||
|
You can customize how your environment variables are loaded by changing or removing the `import 'dotenv/config'` line.
|
||||||
|
|
||||||
|
## Quick reference
|
||||||
|
|
||||||
|
### Commands
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bun prisma contract emit # Update contract.json and contract.d.ts
|
||||||
|
bun prisma db init # Create tables in the database
|
||||||
|
bun prisma migration status # Show migration status
|
||||||
|
```
|
||||||
|
|
||||||
|
### Files
|
||||||
|
|
||||||
|
| File | Purpose |
|
||||||
|
|---|---|
|
||||||
|
| [`src/prisma/contract.prisma`](src/prisma/contract.prisma) | Your data contract — define your models here |
|
||||||
|
| [`prisma.config.ts`](prisma.config.ts) | CLI configuration |
|
||||||
|
| [`src/prisma/db.ts`](src/prisma/db.ts) | Database client — `import { db } from './src/prisma/db'` |
|
||||||
|
| `src/prisma/contract.json` | Compiled contract (generated) |
|
||||||
|
| `src/prisma/contract.d.ts` | Contract types (generated) |
|
||||||
|
|
||||||
|
### Workflow
|
||||||
|
|
||||||
|
1. Edit [`src/prisma/contract.prisma`](src/prisma/contract.prisma) to add or change models.
|
||||||
|
2. Run `bun prisma contract emit` to regenerate the contract.
|
||||||
|
3. Query your models — your IDE will autocomplete everything.
|
||||||
|
|
||||||
|
## Monorepo notes (pnpm workspaces)
|
||||||
|
|
||||||
|
If this project lives inside a pnpm workspace, a few things are worth knowing:
|
||||||
|
|
||||||
|
- **Catalogs.** When the workspace's `pnpm-workspace.yaml` defines a `catalogs` entry for `prisma` or `@prisma/orm-postgres`, pnpm uses the catalog version everywhere — `init` does too. If you wanted the published `latest` instead, update or remove the catalog entry, then re-run `pnpm install`.
|
||||||
|
- **`pnpm dlx`.** `pnpm dlx prisma@latest orm init …` works in any directory. Inside a workspace, pnpm still resolves dependencies through the workspace's catalog/overrides rather than the registry; expect the installed Prisma ORM packages to reflect the workspace's catalog rather than `latest`.
|
||||||
|
- **`pnpm` → `npm` fallback.** If `pnpm` ever fails to install Prisma ORM with a `workspace:*` or `catalog:` resolution error (a leak in a published artefact), `init` falls back to `npm install` and surfaces a warning. Once the offending package republishes a clean version you can switch back with `pnpm install`.
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import 'dotenv/config';
|
||||||
|
import { definePrismaConfig } from '@prisma/cli-engine';
|
||||||
|
import { defineConfig as ormConfig } from '@prisma/orm-postgres/config';
|
||||||
|
|
||||||
|
export default definePrismaConfig({
|
||||||
|
orm: ormConfig({
|
||||||
|
contract: "./src/prisma/contract.prisma",
|
||||||
|
db: {
|
||||||
|
connection: process.env['DATABASE_URL']!,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
});
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { t } from "elysia"
|
||||||
|
|
||||||
|
export const PostCreate = t.Object({
|
||||||
|
title: t.String({ minLength: 1, error: '标题不能为空' }),
|
||||||
|
context: t.String({ minLength: 1, error: '内容不能为空' })
|
||||||
|
})
|
||||||
|
|
||||||
|
export const PostUpdate = t.Object({
|
||||||
|
title: t.String({ minLength: 1, error: '标题不能为空' }),
|
||||||
|
context: t.String({ minLength: 1, error: '内容不能为空' })
|
||||||
|
})
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { t } from "elysia"
|
||||||
|
|
||||||
|
export const UserCreate = t.Object({
|
||||||
|
nickname: t.String({ minLength: 2, error: '昵称最少两位' }),
|
||||||
|
username: t.String({ minLength: 5, error: '用户名最少五位' }),
|
||||||
|
password: t.String({ minLength: 8, error: '密码最少八位' })
|
||||||
|
})
|
||||||
|
|
||||||
|
export const UserUpdate = t.Object({
|
||||||
|
nickname: t.Optional(t.String({ minLength: 2, error: '昵称最少两位' })),
|
||||||
|
username: t.Optional(t.String({ minLength: 5, error: '用户名最少五位' }))
|
||||||
|
})
|
||||||
|
|
||||||
|
export const UserLogin = t.Object({
|
||||||
|
username: t.String({ minLength: 5, error: "用户名最少五位" }),
|
||||||
|
password: t.String({ minLength: 8, error: "密码最少八位" })
|
||||||
|
})
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import { t } from "elysia";
|
||||||
|
|
||||||
|
export const ToId = t.Object({
|
||||||
|
id: t.Number(),
|
||||||
|
})
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import { Elysia, t } from "elysia";
|
||||||
|
import openapi from "@elysia/openapi";
|
||||||
|
import { router } from "./router";
|
||||||
|
import cors from "@elysia/cors";
|
||||||
|
|
||||||
|
const app = new Elysia().use(cors()).use(openapi())
|
||||||
|
|
||||||
|
// 字段判断
|
||||||
|
.onError(({ error, code, set }) => {
|
||||||
|
if (code === 'VALIDATION') {
|
||||||
|
set.status = 422
|
||||||
|
return {
|
||||||
|
msg: error.customError
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
.use(router)
|
||||||
|
|
||||||
|
app.listen(3000);
|
||||||
|
|
||||||
|
export type App = typeof app
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
`🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`
|
||||||
|
);
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import jwt from "@elysia/jwt";
|
||||||
|
import Elysia from "elysia";
|
||||||
|
import { db } from "../prisma/db";
|
||||||
|
|
||||||
|
export const auth = new Elysia()
|
||||||
|
.use(jwt({
|
||||||
|
secret: "test"
|
||||||
|
}))
|
||||||
|
|
||||||
|
.macro({
|
||||||
|
isAuth: {
|
||||||
|
async resolve({ jwt, headers: { authorization }, status }) {
|
||||||
|
const token = authorization?.replace('^Bearer\s+/i', "")
|
||||||
|
const payload = await jwt.verify(token)
|
||||||
|
const isUser = await db.orm.public.User.where({ id: Number(payload.sub) }).select('id').first()
|
||||||
|
if (!payload || !isUser) {
|
||||||
|
return status(401, 'Unauthorized')
|
||||||
|
}
|
||||||
|
return { Auth: isUser }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
Vendored
+561
@@ -0,0 +1,561 @@
|
|||||||
|
// ⚠️ GENERATED FILE - DO NOT EDIT
|
||||||
|
// This file is automatically generated by 'prisma contract emit'.
|
||||||
|
// To regenerate, run: prisma contract emit
|
||||||
|
import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types';
|
||||||
|
import type {
|
||||||
|
Bit,
|
||||||
|
Char,
|
||||||
|
CodecTypes as PgTypes,
|
||||||
|
Interval,
|
||||||
|
JsonValue,
|
||||||
|
Numeric,
|
||||||
|
Time,
|
||||||
|
TimeString,
|
||||||
|
Timestamp,
|
||||||
|
TimestampString,
|
||||||
|
Timestamptz,
|
||||||
|
TimestamptzString,
|
||||||
|
Timetz,
|
||||||
|
VarBit,
|
||||||
|
Varchar,
|
||||||
|
} from '@prisma/orm-postgres/target/codec-types';
|
||||||
|
|
||||||
|
import type {
|
||||||
|
ContractWithTypeMaps,
|
||||||
|
RelationKeys,
|
||||||
|
TypeMaps as TypeMapsType,
|
||||||
|
} from '@prisma/orm-postgres/family-contract/types';
|
||||||
|
import type {
|
||||||
|
Contract as ContractType,
|
||||||
|
ExecutionHashBase,
|
||||||
|
NamespaceId,
|
||||||
|
ProfileHashBase,
|
||||||
|
StorageHashBase,
|
||||||
|
} from '@prisma/orm-postgres/contract/types';
|
||||||
|
|
||||||
|
export type StorageHash =
|
||||||
|
StorageHashBase<'66cb816949cf8f6a536fcdd60eeb1bb528c3e58ae9bc6737273a2fe0a26f5843'>;
|
||||||
|
export type ExecutionHash = ExecutionHashBase<string>;
|
||||||
|
export type ProfileHash =
|
||||||
|
ProfileHashBase<'3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2'>;
|
||||||
|
|
||||||
|
export type CodecTypes = PgTypes;
|
||||||
|
export type LaneCodecTypes = CodecTypes;
|
||||||
|
export type QueryOperationTypes = PgAdapterQueryOps<CodecTypes>;
|
||||||
|
export type AggregateTypes = {
|
||||||
|
readonly avg: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly avgDecimal: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly count: {
|
||||||
|
readonly byCodec: {};
|
||||||
|
readonly withoutInput: { readonly output: 'pg/int8number@1'; readonly nullable: false };
|
||||||
|
readonly anyInput: { readonly output: 'pg/int8number@1'; readonly nullable: false };
|
||||||
|
};
|
||||||
|
readonly countBigInt: {
|
||||||
|
readonly byCodec: {};
|
||||||
|
readonly withoutInput: { readonly output: 'pg/int8@1'; readonly nullable: false };
|
||||||
|
readonly anyInput: { readonly output: 'pg/int8@1'; readonly nullable: false };
|
||||||
|
};
|
||||||
|
readonly max: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/char@1': { readonly output: 'pg/char@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-string@1': { readonly output: 'pg/date-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-temporal@1': {
|
||||||
|
readonly output: 'pg/date-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/enum@1': { readonly output: 'pg/enum@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/inet@1': { readonly output: 'pg/inet@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int2@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text-array@1': { readonly output: 'pg/text-array@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/time-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': {
|
||||||
|
readonly output: 'pg/time-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-string@1': {
|
||||||
|
readonly output: 'pg/timestamp-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamp-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-string@1': {
|
||||||
|
readonly output: 'pg/timestamptz-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamptz-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timetz@1': { readonly output: 'pg/timetz@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/char@1': { readonly output: 'sql/char@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/float@1': { readonly output: 'sql/float@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'sql/int@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/text@1': { readonly output: 'sql/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly min: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/char@1': { readonly output: 'pg/char@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-string@1': { readonly output: 'pg/date-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/date-temporal@1': {
|
||||||
|
readonly output: 'pg/date-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/enum@1': { readonly output: 'pg/enum@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/inet@1': { readonly output: 'pg/inet@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int2@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text-array@1': { readonly output: 'pg/text-array@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/text@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/time-string@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': {
|
||||||
|
readonly output: 'pg/time-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-string@1': {
|
||||||
|
readonly output: 'pg/timestamp-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamp-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamp-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-string@1': {
|
||||||
|
readonly output: 'pg/timestamptz-string@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timestamptz-temporal@1': {
|
||||||
|
readonly output: 'pg/timestamptz-temporal@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/timetz@1': { readonly output: 'pg/timetz@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'pg/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/char@1': { readonly output: 'sql/char@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/float@1': { readonly output: 'sql/float@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'sql/int@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/text@1': { readonly output: 'sql/text@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/varchar@1': { readonly output: 'pg/text@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly sum: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float4@1': { readonly output: 'pg/float4@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/float8@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/interval@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/numeric@1': { readonly output: 'pg/numeric@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-string@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/time-temporal@1': { readonly output: 'pg/interval@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'sql/float@1': { readonly output: 'pg/float8@1'; readonly nullable: true };
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/int8number@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly sumBigInt: {
|
||||||
|
readonly byCodec: {
|
||||||
|
readonly 'pg/int@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int2@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int4@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8@1': { readonly output: 'pg/unboundedint@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/int8number@1': { readonly output: 'pg/unboundedint@1'; readonly nullable: true };
|
||||||
|
readonly 'pg/unboundedint@1': {
|
||||||
|
readonly output: 'pg/unboundedint@1';
|
||||||
|
readonly nullable: true;
|
||||||
|
};
|
||||||
|
readonly 'sql/int@1': { readonly output: 'pg/int8@1'; readonly nullable: true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
type DefaultLiteralValue<CodecId extends string, Encoded> = CodecId extends keyof CodecTypes
|
||||||
|
? Encoded extends CodecTypes[CodecId]['json']
|
||||||
|
? Encoded
|
||||||
|
: CodecTypes[CodecId]['json']
|
||||||
|
: Encoded;
|
||||||
|
|
||||||
|
export type FieldOutputTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly Post: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly user_id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly title: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly context: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly is_public: CodecTypes['pg/bool@1']['output'];
|
||||||
|
readonly status: CodecTypes['pg/int4@1']['output'];
|
||||||
|
};
|
||||||
|
readonly User: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['output'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type FieldInputTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly Post: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly user_id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly title: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly context: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly is_public: CodecTypes['pg/bool@1']['input'];
|
||||||
|
readonly status: CodecTypes['pg/int4@1']['input'];
|
||||||
|
};
|
||||||
|
readonly User: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['input'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type StorageColumnTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly post: {
|
||||||
|
readonly context: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly is_public: CodecTypes['pg/bool@1']['output'];
|
||||||
|
readonly status: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly title: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly user_id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
};
|
||||||
|
readonly user: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['output'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type StorageColumnInputTypes = {
|
||||||
|
readonly public: {
|
||||||
|
readonly post: {
|
||||||
|
readonly context: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly is_public: CodecTypes['pg/bool@1']['input'];
|
||||||
|
readonly status: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly title: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly user_id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
};
|
||||||
|
readonly user: {
|
||||||
|
readonly id: CodecTypes['pg/int4@1']['input'];
|
||||||
|
readonly nickname: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly password: CodecTypes['pg/text@1']['input'];
|
||||||
|
readonly username: CodecTypes['pg/text@1']['input'];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export namespace Models {
|
||||||
|
export type public_User = {
|
||||||
|
id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
nickname: CodecTypes['pg/text@1']['output'];
|
||||||
|
username: CodecTypes['pg/text@1']['output'];
|
||||||
|
password: CodecTypes['pg/text@1']['output'];
|
||||||
|
readonly [RelationKeys]?: never;
|
||||||
|
};
|
||||||
|
export type public_Post = {
|
||||||
|
id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
user_id: CodecTypes['pg/int4@1']['output'];
|
||||||
|
title: CodecTypes['pg/text@1']['output'];
|
||||||
|
context: CodecTypes['pg/text@1']['output'];
|
||||||
|
is_public: CodecTypes['pg/bool@1']['output'];
|
||||||
|
status: CodecTypes['pg/int4@1']['output'];
|
||||||
|
readonly [RelationKeys]?: never;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare const models: {
|
||||||
|
public: {
|
||||||
|
User: Models.public_User;
|
||||||
|
Post: Models.public_Post;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TypeMaps = TypeMapsType<
|
||||||
|
CodecTypes,
|
||||||
|
QueryOperationTypes,
|
||||||
|
FieldOutputTypes,
|
||||||
|
FieldInputTypes,
|
||||||
|
StorageColumnTypes,
|
||||||
|
StorageColumnInputTypes,
|
||||||
|
AggregateTypes
|
||||||
|
>;
|
||||||
|
|
||||||
|
type ContractBase = Omit<
|
||||||
|
ContractType<{
|
||||||
|
readonly namespaces: {
|
||||||
|
readonly public: {
|
||||||
|
readonly id: 'public';
|
||||||
|
readonly kind: 'postgres-schema';
|
||||||
|
readonly entries: {
|
||||||
|
readonly table: {
|
||||||
|
readonly post: {
|
||||||
|
columns: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nativeType: 'int4';
|
||||||
|
readonly codecId: 'pg/int4@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly default: {
|
||||||
|
readonly kind: 'function';
|
||||||
|
readonly expression: 'autoincrement()';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly user_id: {
|
||||||
|
readonly nativeType: 'int4';
|
||||||
|
readonly codecId: 'pg/int4@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly title: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly context: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly is_public: {
|
||||||
|
readonly nativeType: 'bool';
|
||||||
|
readonly codecId: 'pg/bool@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly default: {
|
||||||
|
readonly kind: 'literal';
|
||||||
|
readonly value: DefaultLiteralValue<'pg/bool@1', true>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly status: {
|
||||||
|
readonly nativeType: 'int4';
|
||||||
|
readonly codecId: 'pg/int4@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly default: {
|
||||||
|
readonly kind: 'literal';
|
||||||
|
readonly value: DefaultLiteralValue<'pg/int4@1', 0>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
primaryKey: { readonly columns: readonly ['id'] };
|
||||||
|
uniques: readonly [];
|
||||||
|
indexes: readonly [];
|
||||||
|
foreignKeys: readonly [];
|
||||||
|
};
|
||||||
|
readonly user: {
|
||||||
|
columns: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nativeType: 'int4';
|
||||||
|
readonly codecId: 'pg/int4@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly default: {
|
||||||
|
readonly kind: 'function';
|
||||||
|
readonly expression: 'autoincrement()';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly nickname: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly username: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
readonly password: {
|
||||||
|
readonly nativeType: 'text';
|
||||||
|
readonly codecId: 'pg/text@1';
|
||||||
|
readonly nullable: false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
primaryKey: { readonly columns: readonly ['id'] };
|
||||||
|
uniques: readonly [{ readonly columns: readonly ['username'] }];
|
||||||
|
indexes: readonly [];
|
||||||
|
foreignKeys: readonly [];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly storageHash: StorageHash;
|
||||||
|
}>,
|
||||||
|
'roots' | 'domain'
|
||||||
|
> & {
|
||||||
|
readonly target: 'postgres';
|
||||||
|
readonly targetFamily: 'sql';
|
||||||
|
readonly roots: {
|
||||||
|
readonly user: { readonly namespace: 'public' & NamespaceId; readonly model: 'User' };
|
||||||
|
readonly post: { readonly namespace: 'public' & NamespaceId; readonly model: 'Post' };
|
||||||
|
};
|
||||||
|
readonly domain: {
|
||||||
|
readonly namespaces: {
|
||||||
|
readonly public: {
|
||||||
|
readonly models: {
|
||||||
|
readonly Post: {
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' };
|
||||||
|
};
|
||||||
|
readonly user_id: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' };
|
||||||
|
};
|
||||||
|
readonly title: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
readonly context: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
readonly is_public: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' };
|
||||||
|
};
|
||||||
|
readonly status: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly relations: Record<string, never>;
|
||||||
|
readonly storage: {
|
||||||
|
readonly table: 'post';
|
||||||
|
readonly namespaceId: 'public';
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: { readonly column: 'id' };
|
||||||
|
readonly user_id: { readonly column: 'user_id' };
|
||||||
|
readonly title: { readonly column: 'title' };
|
||||||
|
readonly context: { readonly column: 'context' };
|
||||||
|
readonly is_public: { readonly column: 'is_public' };
|
||||||
|
readonly status: { readonly column: 'status' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly User: {
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' };
|
||||||
|
};
|
||||||
|
readonly nickname: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
readonly username: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
readonly password: {
|
||||||
|
readonly nullable: false;
|
||||||
|
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly relations: Record<string, never>;
|
||||||
|
readonly storage: {
|
||||||
|
readonly table: 'user';
|
||||||
|
readonly namespaceId: 'public';
|
||||||
|
readonly fields: {
|
||||||
|
readonly id: { readonly column: 'id' };
|
||||||
|
readonly nickname: { readonly column: 'nickname' };
|
||||||
|
readonly username: { readonly column: 'username' };
|
||||||
|
readonly password: { readonly column: 'password' };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly capabilities: {
|
||||||
|
readonly postgres: {
|
||||||
|
readonly distinctOn: true;
|
||||||
|
readonly jsonAgg: true;
|
||||||
|
readonly lateral: true;
|
||||||
|
readonly limit: true;
|
||||||
|
readonly orderBy: true;
|
||||||
|
readonly returning: true;
|
||||||
|
};
|
||||||
|
readonly sql: {
|
||||||
|
readonly checkConstraint: true;
|
||||||
|
readonly defaultInInsert: true;
|
||||||
|
readonly enums: true;
|
||||||
|
readonly lateral: true;
|
||||||
|
readonly returning: true;
|
||||||
|
readonly scalarList: true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly extensions: {};
|
||||||
|
readonly meta: {};
|
||||||
|
|
||||||
|
readonly profileHash: ProfileHash;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Contract = ContractWithTypeMaps<ContractBase, TypeMaps>;
|
||||||
|
|
||||||
|
export type Namespaces = Contract['storage']['namespaces'];
|
||||||
@@ -0,0 +1,280 @@
|
|||||||
|
{
|
||||||
|
"schemaVersion": "1",
|
||||||
|
"targetFamily": "sql",
|
||||||
|
"target": "postgres",
|
||||||
|
"profileHash": "3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2",
|
||||||
|
"roots": {
|
||||||
|
"post": {
|
||||||
|
"model": "Post",
|
||||||
|
"namespace": "public"
|
||||||
|
},
|
||||||
|
"user": {
|
||||||
|
"model": "User",
|
||||||
|
"namespace": "public"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"domain": {
|
||||||
|
"namespaces": {
|
||||||
|
"public": {
|
||||||
|
"models": {
|
||||||
|
"Post": {
|
||||||
|
"fields": {
|
||||||
|
"context": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": {
|
||||||
|
"codecId": "pg/text@1",
|
||||||
|
"kind": "scalar"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": {
|
||||||
|
"codecId": "pg/int4@1",
|
||||||
|
"kind": "scalar"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"is_public": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": {
|
||||||
|
"codecId": "pg/bool@1",
|
||||||
|
"kind": "scalar"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": {
|
||||||
|
"codecId": "pg/int4@1",
|
||||||
|
"kind": "scalar"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": {
|
||||||
|
"codecId": "pg/text@1",
|
||||||
|
"kind": "scalar"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": {
|
||||||
|
"codecId": "pg/int4@1",
|
||||||
|
"kind": "scalar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {},
|
||||||
|
"storage": {
|
||||||
|
"fields": {
|
||||||
|
"context": {
|
||||||
|
"column": "context"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"column": "id"
|
||||||
|
},
|
||||||
|
"is_public": {
|
||||||
|
"column": "is_public"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"column": "status"
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"column": "title"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"column": "user_id"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"namespaceId": "public",
|
||||||
|
"table": "post"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"User": {
|
||||||
|
"fields": {
|
||||||
|
"id": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": {
|
||||||
|
"codecId": "pg/int4@1",
|
||||||
|
"kind": "scalar"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nickname": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": {
|
||||||
|
"codecId": "pg/text@1",
|
||||||
|
"kind": "scalar"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": {
|
||||||
|
"codecId": "pg/text@1",
|
||||||
|
"kind": "scalar"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"username": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": {
|
||||||
|
"codecId": "pg/text@1",
|
||||||
|
"kind": "scalar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {},
|
||||||
|
"storage": {
|
||||||
|
"fields": {
|
||||||
|
"id": {
|
||||||
|
"column": "id"
|
||||||
|
},
|
||||||
|
"nickname": {
|
||||||
|
"column": "nickname"
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"column": "password"
|
||||||
|
},
|
||||||
|
"username": {
|
||||||
|
"column": "username"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"namespaceId": "public",
|
||||||
|
"table": "user"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"storage": {
|
||||||
|
"namespaces": {
|
||||||
|
"public": {
|
||||||
|
"entries": {
|
||||||
|
"table": {
|
||||||
|
"post": {
|
||||||
|
"columns": {
|
||||||
|
"context": {
|
||||||
|
"codecId": "pg/text@1",
|
||||||
|
"nativeType": "text",
|
||||||
|
"nullable": false
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"codecId": "pg/int4@1",
|
||||||
|
"default": {
|
||||||
|
"expression": "autoincrement()",
|
||||||
|
"kind": "function"
|
||||||
|
},
|
||||||
|
"nativeType": "int4",
|
||||||
|
"nullable": false
|
||||||
|
},
|
||||||
|
"is_public": {
|
||||||
|
"codecId": "pg/bool@1",
|
||||||
|
"default": {
|
||||||
|
"kind": "literal",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"nativeType": "bool",
|
||||||
|
"nullable": false
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"codecId": "pg/int4@1",
|
||||||
|
"default": {
|
||||||
|
"kind": "literal",
|
||||||
|
"value": 0
|
||||||
|
},
|
||||||
|
"nativeType": "int4",
|
||||||
|
"nullable": false
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"codecId": "pg/text@1",
|
||||||
|
"nativeType": "text",
|
||||||
|
"nullable": false
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"codecId": "pg/int4@1",
|
||||||
|
"nativeType": "int4",
|
||||||
|
"nullable": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": [],
|
||||||
|
"indexes": [],
|
||||||
|
"primaryKey": {
|
||||||
|
"columns": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"uniques": []
|
||||||
|
},
|
||||||
|
"user": {
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"codecId": "pg/int4@1",
|
||||||
|
"default": {
|
||||||
|
"expression": "autoincrement()",
|
||||||
|
"kind": "function"
|
||||||
|
},
|
||||||
|
"nativeType": "int4",
|
||||||
|
"nullable": false
|
||||||
|
},
|
||||||
|
"nickname": {
|
||||||
|
"codecId": "pg/text@1",
|
||||||
|
"nativeType": "text",
|
||||||
|
"nullable": false
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"codecId": "pg/text@1",
|
||||||
|
"nativeType": "text",
|
||||||
|
"nullable": false
|
||||||
|
},
|
||||||
|
"username": {
|
||||||
|
"codecId": "pg/text@1",
|
||||||
|
"nativeType": "text",
|
||||||
|
"nullable": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": [],
|
||||||
|
"indexes": [],
|
||||||
|
"primaryKey": {
|
||||||
|
"columns": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"uniques": [
|
||||||
|
{
|
||||||
|
"columns": [
|
||||||
|
"username"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": "public",
|
||||||
|
"kind": "postgres-schema"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"storageHash": "66cb816949cf8f6a536fcdd60eeb1bb528c3e58ae9bc6737273a2fe0a26f5843"
|
||||||
|
},
|
||||||
|
"capabilities": {
|
||||||
|
"postgres": {
|
||||||
|
"distinctOn": true,
|
||||||
|
"jsonAgg": true,
|
||||||
|
"lateral": true,
|
||||||
|
"limit": true,
|
||||||
|
"orderBy": true,
|
||||||
|
"returning": true
|
||||||
|
},
|
||||||
|
"sql": {
|
||||||
|
"checkConstraint": true,
|
||||||
|
"defaultInInsert": true,
|
||||||
|
"enums": true,
|
||||||
|
"lateral": true,
|
||||||
|
"returning": true,
|
||||||
|
"scalarList": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extensions": {},
|
||||||
|
"meta": {},
|
||||||
|
"_generated": {
|
||||||
|
"warning": "⚠️ GENERATED FILE - DO NOT EDIT",
|
||||||
|
"message": "This file is automatically generated by \"prisma contract emit\".",
|
||||||
|
"regenerate": "To regenerate, run: prisma contract emit"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// use prisma-8
|
||||||
|
model User {
|
||||||
|
id Int @id @default(autoincrement())
|
||||||
|
nickname String
|
||||||
|
username String @unique
|
||||||
|
password String
|
||||||
|
}
|
||||||
|
|
||||||
|
model Post {
|
||||||
|
id Int @id @default(autoincrement())
|
||||||
|
user_id Int
|
||||||
|
title String
|
||||||
|
context String
|
||||||
|
is_public Boolean @default(true)
|
||||||
|
status Int @default(0) // 0: 待审核, 1: 审核通过, -1: 驳回
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import 'dotenv/config';
|
||||||
|
import postgres from '@prisma/orm-postgres/runtime';
|
||||||
|
import type { Contract } from './contract.d';
|
||||||
|
import contractJson from './contract.json' with { type: 'json' };
|
||||||
|
|
||||||
|
export const db = postgres<Contract>({
|
||||||
|
contractJson,
|
||||||
|
url: process.env['DATABASE_URL']!,
|
||||||
|
});
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import Elysia from "elysia";
|
||||||
|
import { userRouter } from "./userRouter";
|
||||||
|
import { postRouter } from "./postRouter";
|
||||||
|
|
||||||
|
export const router = new Elysia({ prefix: '/api' })
|
||||||
|
.use(userRouter)
|
||||||
|
.use(postRouter)
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
import { isUniqueConstraintViolation } from "@prisma/orm-family-sql/errors"
|
||||||
|
import Elysia from "elysia"
|
||||||
|
import { db } from "../prisma/db"
|
||||||
|
import { PostCreate, PostUpdate } from "../dto/postDto"
|
||||||
|
import { ToId } from "../dto/utils"
|
||||||
|
import { auth } from "../plugins/auth"
|
||||||
|
|
||||||
|
|
||||||
|
export const postRouter = new Elysia({ prefix: '/post' }).use(auth)
|
||||||
|
// 获取全部文章
|
||||||
|
.get("/", async () => {
|
||||||
|
const posts = await db.orm.public.Post.select('id', 'user_id', 'title', 'context').all()
|
||||||
|
return posts
|
||||||
|
})
|
||||||
|
|
||||||
|
// 获取单个文章
|
||||||
|
.get("/:id", async ({ params: { id } }) => {
|
||||||
|
const post = await db.orm.public.Post.where({ id }).select('id', 'user_id', 'title', 'context').first()
|
||||||
|
|
||||||
|
if (!post) {
|
||||||
|
return { msg: `文章 ${id} 不存在` }
|
||||||
|
}
|
||||||
|
return post
|
||||||
|
}, { params: ToId })
|
||||||
|
|
||||||
|
// 新增文章
|
||||||
|
.post("/", async ({ body, set, Auth }) => {
|
||||||
|
try {
|
||||||
|
|
||||||
|
const isUser = await db.orm.public.User.first({
|
||||||
|
id: Number(Auth.id)
|
||||||
|
})
|
||||||
|
if (!isUser) {
|
||||||
|
return { msg: '文章所属用户不存在' }
|
||||||
|
}
|
||||||
|
|
||||||
|
const newPost = await db.orm.public.Post.select('id', 'user_id', 'title', 'context', 'status').create({
|
||||||
|
user_id: Auth.id,
|
||||||
|
title: body.title,
|
||||||
|
context: body.context
|
||||||
|
})
|
||||||
|
return {
|
||||||
|
msg: '文章创建成功',
|
||||||
|
data: newPost
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (isUniqueConstraintViolation(error)) {
|
||||||
|
set.status = 409
|
||||||
|
console.log(error)
|
||||||
|
return { msg: '文章创建失败' }
|
||||||
|
}
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}, { body: PostCreate, isAuth: true })
|
||||||
|
|
||||||
|
// 更新文章
|
||||||
|
.patch("/:id", async ({ body, params: { id }, set, Auth }) => {
|
||||||
|
try {
|
||||||
|
const findPost = await db.orm.public.Post.where({ id }).first()
|
||||||
|
if (!findPost) {
|
||||||
|
return {
|
||||||
|
msg: '文章不存在,修改失败'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (findPost.user_id === Auth.id) {
|
||||||
|
const updatePost = await db.orm.public.Post.where({ id }).select('id', 'user_id', 'title', 'context', 'is_public', 'status').update(body)
|
||||||
|
return {
|
||||||
|
msg: '文章修改成功',
|
||||||
|
data: updatePost
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return { msg: "仅本人修改" }
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (isUniqueConstraintViolation(error)) {
|
||||||
|
set.status = 409
|
||||||
|
return { msg: '文章修改失败' }
|
||||||
|
}
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
|
||||||
|
}, { params: ToId, body: PostUpdate, isAuth: true })
|
||||||
|
|
||||||
|
// 删除文章
|
||||||
|
.delete("/:id", async ({ params: { id }, set, Auth }) => {
|
||||||
|
try {
|
||||||
|
const findPost = await db.orm.public.Post.where({ id }).first()
|
||||||
|
if (!findPost) {
|
||||||
|
return {
|
||||||
|
msg: '文章不存在,删除失败'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (findPost.user_id !== Auth.id) return { msg: "仅本人删除" }
|
||||||
|
const deletePost = await db.orm.public.Post.where({ id }).select('id', 'user_id', 'title', 'context').delete()
|
||||||
|
return {
|
||||||
|
msg: '文章删除成功',
|
||||||
|
data: deletePost
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (isUniqueConstraintViolation(error)) {
|
||||||
|
set.status = 409
|
||||||
|
return { msg: '文章删除失败' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, { params: ToId, isAuth: true })
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
import { isUniqueConstraintViolation } from "@prisma/orm-family-sql/errors"
|
||||||
|
import Elysia from "elysia"
|
||||||
|
import { db } from "../prisma/db"
|
||||||
|
import { UserCreate, UserLogin, UserUpdate } from "../dto/userDto"
|
||||||
|
import { ToId } from "../dto/utils"
|
||||||
|
import { auth } from "../plugins/auth"
|
||||||
|
|
||||||
|
export const userRouter = new Elysia({ prefix: '/user' })
|
||||||
|
.use(auth)
|
||||||
|
|
||||||
|
//获取全部用户
|
||||||
|
.get("/", async () => {
|
||||||
|
const users = await db.orm.public.User.select('id', 'nickname', 'username').all()
|
||||||
|
return users
|
||||||
|
})
|
||||||
|
|
||||||
|
// 获取单个用户
|
||||||
|
.get("/:id", async ({ params: { id } }) => {
|
||||||
|
const posts = await db.orm.public.Post.where({ user_id: id }).select('id', 'title', 'context').all()
|
||||||
|
const user = await db.orm.public.User.where({ id }).select('id', 'nickname', 'username').first()
|
||||||
|
const userPosts = { ...user, posts }
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
return { msg: `ID ${id} 不存在` }
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
msg: '获取成功',
|
||||||
|
data: userPosts
|
||||||
|
}
|
||||||
|
}, { params: ToId })
|
||||||
|
|
||||||
|
// 创建用户
|
||||||
|
.post("/", async ({ body, set }) => {
|
||||||
|
try {
|
||||||
|
const newUser = await db.orm.public.User.select('id', 'nickname', 'username').create(body)
|
||||||
|
return {
|
||||||
|
msg: '用户创建成功',
|
||||||
|
data: newUser
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (isUniqueConstraintViolation(error)) {
|
||||||
|
set.status = 409
|
||||||
|
return { msg: '用户名已存在' }
|
||||||
|
}
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
|
||||||
|
}, { body: UserCreate })
|
||||||
|
|
||||||
|
// 修改用户信息
|
||||||
|
.patch("/:id", async ({ body, params: { id }, set }) => {
|
||||||
|
try {
|
||||||
|
const updateUser = await db.orm.public.User.where({ id }).select('id', 'nickname', 'username').update(body)
|
||||||
|
return {
|
||||||
|
msg: '用户信息修改成功',
|
||||||
|
data: updateUser
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (isUniqueConstraintViolation(error)) {
|
||||||
|
set.status = 409
|
||||||
|
return { msg: '用户名已存在' }
|
||||||
|
}
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
|
||||||
|
}, { params: ToId, body: UserUpdate })
|
||||||
|
|
||||||
|
// 删除用户
|
||||||
|
.delete("/:id", async ({ params: { id }, set }) => {
|
||||||
|
try {
|
||||||
|
const findUser = await db.orm.public.User.where({ id }).first()
|
||||||
|
if (!findUser) {
|
||||||
|
return {
|
||||||
|
msg: '用户不存在,删除失败'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const deleteUser = await db.orm.public.User.where({ id }).select('id', 'nickname', 'username').delete()
|
||||||
|
return {
|
||||||
|
msg: '用户删除成功',
|
||||||
|
data: deleteUser
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (isUniqueConstraintViolation(error)) {
|
||||||
|
set.status = 409
|
||||||
|
return { msg: '用户删除失败' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, { params: ToId })
|
||||||
|
|
||||||
|
// 登录
|
||||||
|
.post("/login", async ({ body, jwt }) => {
|
||||||
|
const isUser = await db.orm.public.User.where({ username: body.username }).first()
|
||||||
|
if (!isUser) {
|
||||||
|
return { msg: "用户名或密码错误" }
|
||||||
|
}
|
||||||
|
const token = await jwt.sign({ sub: String(isUser.id), username: body.username })
|
||||||
|
return { msg: "登录成功", token }
|
||||||
|
}, { body: UserLogin })
|
||||||
+107
@@ -0,0 +1,107 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||||
|
|
||||||
|
/* Projects */
|
||||||
|
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
||||||
|
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
||||||
|
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
||||||
|
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
||||||
|
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||||
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||||
|
|
||||||
|
/* Language and Environment */
|
||||||
|
"target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||||
|
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||||
|
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||||
|
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
||||||
|
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
||||||
|
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
||||||
|
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
||||||
|
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
||||||
|
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
||||||
|
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
||||||
|
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||||
|
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
||||||
|
|
||||||
|
/* Modules */
|
||||||
|
"module": "preserve", /* Specify what module code is generated. */
|
||||||
|
// "rootDir": "./", /* Specify the root folder within your source files. */
|
||||||
|
"moduleResolution": "bundler", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||||
|
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||||
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||||
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||||
|
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||||
|
"types": [
|
||||||
|
"bun-types",
|
||||||
|
"node"
|
||||||
|
], /* Specify type package names to be included without being referenced in a source file. */
|
||||||
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||||
|
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||||
|
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||||
|
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||||
|
|
||||||
|
/* JavaScript Support */
|
||||||
|
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
||||||
|
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
||||||
|
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
||||||
|
|
||||||
|
/* Emit */
|
||||||
|
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||||
|
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||||
|
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||||
|
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||||
|
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||||
|
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
||||||
|
// "removeComments": true, /* Disable emitting comments. */
|
||||||
|
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||||
|
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||||
|
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
||||||
|
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||||
|
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
||||||
|
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||||
|
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||||
|
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
||||||
|
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
||||||
|
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
||||||
|
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
||||||
|
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
||||||
|
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
||||||
|
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
||||||
|
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
||||||
|
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
||||||
|
|
||||||
|
/* Interop Constraints */
|
||||||
|
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
||||||
|
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
||||||
|
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
||||||
|
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
||||||
|
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
||||||
|
|
||||||
|
/* Type Checking */
|
||||||
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
|
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
||||||
|
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
||||||
|
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||||
|
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
||||||
|
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||||
|
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
||||||
|
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
||||||
|
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||||
|
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
||||||
|
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
||||||
|
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||||
|
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||||
|
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||||
|
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
||||||
|
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
||||||
|
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
||||||
|
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
||||||
|
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
||||||
|
|
||||||
|
/* Completeness */
|
||||||
|
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"resolveJsonModule": true /* Skip type checking all .d.ts files. */
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user