first commit
This commit is contained in:
commit
4016f41435
145
Draft.md
Normal file
145
Draft.md
Normal file
@ -0,0 +1,145 @@
|
||||
## Project setup
|
||||
|
||||
### Nestjs
|
||||
|
||||
Clone a Nest starter project
|
||||
```bash
|
||||
git clone https://github.com/nestjs/typescript-starter.git demo-app
|
||||
cd demo-app
|
||||
npm install
|
||||
```
|
||||
|
||||
dependentele
|
||||
```bash
|
||||
npm install @zenstackhq/runtime @nestjs/jwt bcrypt @nestjs/graphql @nestjs/apollo @apollo/server graphql graphql-scalars type-graphql
|
||||
npm install prisma zenstack @types/bcrypt typegraphql-prisma-nestjs --save-dev
|
||||
```
|
||||
|
||||
### Prisma
|
||||
|
||||
Initializam stack-ul Prisma
|
||||
```bash
|
||||
npx prisma init
|
||||
```
|
||||
|
||||
Conexiunea db catre bd sqlite
|
||||
1. schimbam provider-ul in fisierul `schema.prisma`
|
||||
```
|
||||
...
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
...
|
||||
```
|
||||
2. Ajustam url-ul de conectare catre db in fisierul `.env`
|
||||
```
|
||||
DATABASE_URL="file:./demo-app.db"
|
||||
```
|
||||
3. Declaram tabele unde se vor stoca utilizatorii, rolurile si nivelele de acces
|
||||
`schema.prisma `
|
||||
```
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
email String @unique
|
||||
password String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now())
|
||||
roles UsersRoles[]
|
||||
}
|
||||
|
||||
model Role {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now())
|
||||
permission Permission[]
|
||||
users UsersRoles[]
|
||||
}
|
||||
|
||||
model Permission {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now())
|
||||
role Role @relation(fields: [roleId], references: [id])
|
||||
roleId Int
|
||||
}
|
||||
|
||||
model UsersRoles {
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int
|
||||
role Role @relation(fields: [roleId], references: [id])
|
||||
roleId Int
|
||||
assignedAt DateTime @default(now())
|
||||
assignedBy String
|
||||
@@id([userId, roleId])
|
||||
}
|
||||
```
|
||||
4. Generam clientul prisma
|
||||
``` bash
|
||||
npx prisma generate
|
||||
```
|
||||
|
||||
### Zenstack
|
||||
|
||||
Copy `schema.prisma` to `../schema.zmodel`
|
||||
|
||||
Declaram zmodel-ul pentru tabela produselor `schema.zmodel` si gestionam acesele la ea
|
||||
```
|
||||
model Product {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
title String
|
||||
published Boolean @default(false)
|
||||
author User @relation(fields: [authorId], references: [id])
|
||||
authorId Int
|
||||
|
||||
// author has full access
|
||||
@@allow('all', auth() == author)
|
||||
|
||||
// logged-in users can view published posts
|
||||
@@allow('read', auth() != null && published)
|
||||
}
|
||||
```
|
||||
generam staf-ul zenstack
|
||||
``` bash
|
||||
npx zenstack generate
|
||||
```
|
||||
|
||||
Creem ceva date mock in `prisma/seed.ts`
|
||||
``` bash
|
||||
npx prisma migrate dev
|
||||
npx prisma db seed
|
||||
```
|
||||
|
||||
### GraphQL Integration
|
||||
|
||||
In fisierul `schema.zmodel` adaugam si rulam `npx zenstack generate`
|
||||
```
|
||||
generator typegraphql {
|
||||
provider = "typegraphql-prisma-nestjs"
|
||||
output = "../prisma/generated/type-graphql"
|
||||
}
|
||||
```
|
||||
|
||||
Enable graphql integration *app.module* si tot aici indicam clientul prisma enhancing de ZenStack
|
||||
```
|
||||
...
|
||||
imports: [
|
||||
GraphQLModule.forRoot<ApolloDriverConfig>({
|
||||
driver: ApolloDriver,
|
||||
autoSchemaFile: join(process.cwd(), 'src/schema.gql'),
|
||||
playground: true,
|
||||
buildSchemaOptions: { dateScalarMode: 'timestamp' },
|
||||
],
|
||||
controllers:
|
||||
...
|
||||
```
|
||||
|
||||
Registering all resolvers inside `providers` of the Nest module
|
||||
```
|
||||
providers: [
|
||||
...
|
||||
|
||||
```
|
||||
|
22
README.md
Normal file
22
README.md
Normal file
@ -0,0 +1,22 @@
|
||||
## Description
|
||||
|
||||
Sarcina tehnica WAITER JAN
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install
|
||||
```
|
||||
|
||||
## Running the app
|
||||
|
||||
```bash
|
||||
# development
|
||||
$ npm run start
|
||||
|
||||
# watch mode
|
||||
$ npm run start:dev
|
||||
|
||||
# production mode
|
||||
$ npm run start:prod
|
||||
```
|
8
nest-cli.json
Normal file
8
nest-cli.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/nest-cli",
|
||||
"collection": "@nestjs/schematics",
|
||||
"sourceRoot": "src",
|
||||
"compilerOptions": {
|
||||
"deleteOutDir": true
|
||||
}
|
||||
}
|
14041
package-lock.json
generated
Normal file
14041
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
87
package.json
Normal file
87
package.json
Normal file
@ -0,0 +1,87 @@
|
||||
{
|
||||
"name": "nest-typescript-starter",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"prisma": {
|
||||
"seed": "ts-node prisma/seed.ts"
|
||||
},
|
||||
"description": "Nest TypeScript starter repository",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "nest build",
|
||||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"start": "nest start",
|
||||
"start:dev": "nest start --watch",
|
||||
"start:debug": "nest start --debug --watch",
|
||||
"start:prod": "node dist/main",
|
||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
"test:cov": "jest --coverage",
|
||||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/jest/bin/jest --runInBand",
|
||||
"test:e2e": "jest --config ./test/jest-e2e.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apollo/server": "^4.10.2",
|
||||
"@nestjs/apollo": "^12.1.0",
|
||||
"@nestjs/common": "^10.3.2",
|
||||
"@nestjs/core": "^10.3.2",
|
||||
"@nestjs/graphql": "^12.1.1",
|
||||
"@nestjs/jwt": "^10.2.0",
|
||||
"@nestjs/platform-express": "^10.3.2",
|
||||
"@prisma/client": "^5.11.0",
|
||||
"@zenstackhq/runtime": "^1.12.0",
|
||||
"bcrypt": "^5.1.1",
|
||||
"graphql": "^16.8.1",
|
||||
"graphql-scalars": "^1.23.0",
|
||||
"reflect-metadata": "^0.2.1",
|
||||
"rxjs": "^7.8.1",
|
||||
"type-graphql": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/cli": "^10.3.1",
|
||||
"@nestjs/schematics": "^10.1.0",
|
||||
"@nestjs/testing": "^10.3.2",
|
||||
"@swc/cli": "^0.3.9",
|
||||
"@swc/core": "^1.4.0",
|
||||
"@types/bcrypt": "^5.0.2",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/node": "^20.11.16",
|
||||
"@types/supertest": "^6.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
||||
"@typescript-eslint/parser": "^6.21.0",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"jest": "^29.7.0",
|
||||
"prettier": "^3.2.5",
|
||||
"prisma": "^5.11.0",
|
||||
"source-map-support": "^0.5.21",
|
||||
"supertest": "^6.3.4",
|
||||
"ts-jest": "^29.1.2",
|
||||
"ts-loader": "^9.5.1",
|
||||
"ts-node": "^10.9.2",
|
||||
"tsconfig-paths": "^4.2.0",
|
||||
"typegraphql-prisma-nestjs": "^0.2707.0",
|
||||
"typescript": "^5.3.3",
|
||||
"zenstack": "^1.12.0"
|
||||
},
|
||||
"jest": {
|
||||
"moduleFileExtensions": [
|
||||
"js",
|
||||
"json",
|
||||
"ts"
|
||||
],
|
||||
"rootDir": "src",
|
||||
"testRegex": ".*\\.spec\\.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
},
|
||||
"collectCoverageFrom": [
|
||||
"**/*.(t|j)s"
|
||||
],
|
||||
"coverageDirectory": "../coverage",
|
||||
"testEnvironment": "node"
|
||||
}
|
||||
}
|
BIN
prisma/demo-app.db
Normal file
BIN
prisma/demo-app.db
Normal file
Binary file not shown.
58
prisma/migrations/20240402092008_/migration.sql
Normal file
58
prisma/migrations/20240402092008_/migration.sql
Normal file
@ -0,0 +1,58 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "User" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"email" TEXT NOT NULL,
|
||||
"password" TEXT NOT NULL,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Role" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"name" TEXT NOT NULL,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Permission" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"name" TEXT NOT NULL,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"roleId" INTEGER NOT NULL,
|
||||
CONSTRAINT "Permission_roleId_fkey" FOREIGN KEY ("roleId") REFERENCES "Role" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "UsersRoles" (
|
||||
"userId" INTEGER NOT NULL,
|
||||
"roleId" INTEGER NOT NULL,
|
||||
"assignedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"assignedBy" TEXT NOT NULL,
|
||||
|
||||
PRIMARY KEY ("userId", "roleId"),
|
||||
CONSTRAINT "UsersRoles_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
|
||||
CONSTRAINT "UsersRoles_roleId_fkey" FOREIGN KEY ("roleId") REFERENCES "Role" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Product" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL,
|
||||
"title" TEXT NOT NULL,
|
||||
"published" BOOLEAN NOT NULL DEFAULT false,
|
||||
"authorId" INTEGER NOT NULL,
|
||||
CONSTRAINT "Product_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Role_name_key" ON "Role"("name");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Permission_name_key" ON "Permission"("name");
|
3
prisma/migrations/migration_lock.toml
Normal file
3
prisma/migrations/migration_lock.toml
Normal file
@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (i.e. Git)
|
||||
provider = "sqlite"
|
72
prisma/schema.prisma
Normal file
72
prisma/schema.prisma
Normal file
@ -0,0 +1,72 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// DO NOT MODIFY THIS FILE //
|
||||
// This file is automatically generated by ZenStack CLI and should not be manually updated. //
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
generator typegraphql {
|
||||
provider = "typegraphql-prisma-nestjs"
|
||||
output = "../src/type-graphql/generated"
|
||||
}
|
||||
|
||||
/// @@allow('create,read', true)
|
||||
/// @@allow('update', auth() == this && future().email == email)
|
||||
model User {
|
||||
id Int @id() @default(autoincrement())
|
||||
email String @unique()
|
||||
/// @omit
|
||||
password String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now())
|
||||
role UsersRoles[]
|
||||
product Product[]
|
||||
}
|
||||
|
||||
model Role {
|
||||
id Int @id() @default(autoincrement())
|
||||
name String @unique()
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now())
|
||||
permission Permission[]
|
||||
user UsersRoles[]
|
||||
}
|
||||
|
||||
model Permission {
|
||||
id Int @id() @default(autoincrement())
|
||||
name String @unique()
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now())
|
||||
role Role @relation(fields: [roleId], references: [id])
|
||||
roleId Int
|
||||
}
|
||||
|
||||
model UsersRoles {
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int
|
||||
role Role @relation(fields: [roleId], references: [id])
|
||||
roleId Int
|
||||
assignedAt DateTime @default(now())
|
||||
assignedBy String
|
||||
|
||||
@@id([userId, roleId])
|
||||
}
|
||||
|
||||
/// @@allow('all', auth() == author)
|
||||
/// @@allow('read', auth() != null && published)
|
||||
model Product {
|
||||
id String @id() @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt()
|
||||
title String
|
||||
published Boolean @default(false)
|
||||
author User @relation(fields: [authorId], references: [id])
|
||||
authorId Int
|
||||
}
|
88
prisma/seed.ts
Normal file
88
prisma/seed.ts
Normal file
@ -0,0 +1,88 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import * as bcrypt from 'bcrypt';
|
||||
const prisma = new PrismaClient();
|
||||
async function main() {
|
||||
const password = await bcrypt.hash('asdf', 10);
|
||||
// bcrypt.hash('asdf', 10, async (err, password) => {
|
||||
const clinetRole = await prisma.role.upsert({
|
||||
where: { name: 'client' },
|
||||
update: {},
|
||||
create: {
|
||||
name: 'client',
|
||||
},
|
||||
});
|
||||
const adminRole = await prisma.role.upsert({
|
||||
where: { name: 'client' },
|
||||
update: {},
|
||||
create: {
|
||||
name: 'admin',
|
||||
},
|
||||
});
|
||||
const customer = await prisma.user.upsert({
|
||||
where: { email: 'client@example.com' },
|
||||
update: {},
|
||||
create: {
|
||||
email: 'client@example.com',
|
||||
password: password,
|
||||
product: {
|
||||
create: [
|
||||
{
|
||||
title: 'Product 1',
|
||||
published: true,
|
||||
},
|
||||
{
|
||||
title: 'Product 2',
|
||||
published: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
const admin = await prisma.user.upsert({
|
||||
where: { email: 'admin@example.com' },
|
||||
update: {},
|
||||
create: {
|
||||
email: 'admin@example.com',
|
||||
password: password,
|
||||
},
|
||||
});
|
||||
await prisma.usersRoles.upsert({
|
||||
where: {
|
||||
userId_roleId: {
|
||||
userId: customer.id,
|
||||
roleId: clinetRole.id,
|
||||
},
|
||||
},
|
||||
update: {},
|
||||
create: {
|
||||
roleId: clinetRole.id,
|
||||
userId: customer.id,
|
||||
assignedBy: 'seed.ts',
|
||||
},
|
||||
});
|
||||
await prisma.usersRoles.upsert({
|
||||
where: {
|
||||
userId_roleId: {
|
||||
userId: admin.id,
|
||||
roleId: adminRole.id,
|
||||
},
|
||||
},
|
||||
update: {},
|
||||
create: {
|
||||
roleId: adminRole.id,
|
||||
userId: admin.id,
|
||||
assignedBy: 'seed.ts',
|
||||
},
|
||||
});
|
||||
console.log({ customer, admin });
|
||||
// }
|
||||
}
|
||||
main()
|
||||
.then(async () => {
|
||||
await prisma.$disconnect();
|
||||
})
|
||||
.catch(async (e) => {
|
||||
console.error(e);
|
||||
await prisma.$disconnect();
|
||||
process.exit(1);
|
||||
});
|
77
schema.zmodel
Normal file
77
schema.zmodel
Normal file
@ -0,0 +1,77 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
||||
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
generator typegraphql {
|
||||
provider = "typegraphql-prisma-nestjs"
|
||||
output = "../src/type-graphql/generated"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
// provider = "postgresql"
|
||||
provider = "sqlite"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
email String @unique
|
||||
password String @omit
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now())
|
||||
role UsersRoles[]
|
||||
product Product[]
|
||||
|
||||
@@allow("create,read", true)
|
||||
@@allow("update", auth() == this && future().email == email)
|
||||
}
|
||||
|
||||
model Role {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now())
|
||||
permission Permission[]
|
||||
user UsersRoles[]
|
||||
}
|
||||
|
||||
model Permission {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now())
|
||||
role Role @relation(fields: [roleId], references: [id])
|
||||
roleId Int
|
||||
}
|
||||
|
||||
model UsersRoles {
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int
|
||||
role Role @relation(fields: [roleId], references: [id])
|
||||
roleId Int
|
||||
assignedAt DateTime @default(now())
|
||||
assignedBy String
|
||||
@@id([userId, roleId])
|
||||
}
|
||||
|
||||
model Product {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
title String
|
||||
published Boolean @default(false)
|
||||
author User @relation(fields: [authorId], references: [id])
|
||||
authorId Int
|
||||
|
||||
// author has full access
|
||||
@@allow('all', auth() == author)
|
||||
|
||||
// logged-in users can view published posts
|
||||
@@allow('read', auth() != null && published)
|
||||
}
|
21
src/app.controller.spec.ts
Normal file
21
src/app.controller.spec.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
|
||||
describe('AppController', () => {
|
||||
let app: TestingModule;
|
||||
|
||||
beforeAll(async () => {
|
||||
app = await Test.createTestingModule({
|
||||
controllers: [AppController],
|
||||
providers: [AppService],
|
||||
}).compile();
|
||||
});
|
||||
|
||||
describe('getHello', () => {
|
||||
it('should return "Hello World!"', () => {
|
||||
const appController = app.get(AppController);
|
||||
expect(appController.getHello()).toBe('Hello World!');
|
||||
});
|
||||
});
|
||||
});
|
12
src/app.controller.ts
Normal file
12
src/app.controller.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { Controller, Get } from '@nestjs/common';
|
||||
import { AppService } from './app.service';
|
||||
|
||||
@Controller()
|
||||
export class AppController {
|
||||
constructor(private readonly appService: AppService) {}
|
||||
|
||||
@Get()
|
||||
getHello(): string {
|
||||
return this.appService.getHello();
|
||||
}
|
||||
}
|
59
src/app.module.ts
Normal file
59
src/app.module.ts
Normal file
@ -0,0 +1,59 @@
|
||||
import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
|
||||
import { Module } from '@nestjs/common';
|
||||
import { GraphQLModule } from '@nestjs/graphql';
|
||||
import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
import { JwtService } from '@nestjs/jwt';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import { join } from 'path';
|
||||
import {
|
||||
PermissionCrudResolver,
|
||||
PermissionRelationsResolver,
|
||||
ProductCrudResolver,
|
||||
ProductRelationsResolver,
|
||||
RoleCrudResolver,
|
||||
RoleRelationsResolver,
|
||||
UserCrudResolver,
|
||||
UserRelationsResolver,
|
||||
} from './type-graphql/generated';
|
||||
import { enhance } from '@zenstackhq/runtime';
|
||||
|
||||
function getPrisma() {
|
||||
const prisma = new PrismaClient();
|
||||
return enhance(prisma);
|
||||
}
|
||||
|
||||
const prisma = getPrisma();
|
||||
|
||||
interface Context {
|
||||
prisma: PrismaClient;
|
||||
}
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
GraphQLModule.forRoot<ApolloDriverConfig>({
|
||||
driver: ApolloDriver,
|
||||
fieldResolverEnhancers: ['guards'], // Applying guards as field resolver enhancers, providing additional control and securi
|
||||
autoSchemaFile: join(process.cwd(), 'src/schema.gql'),
|
||||
playground: true,
|
||||
buildSchemaOptions: { dateScalarMode: 'timestamp' },
|
||||
context: (): Context => ({ prisma }),
|
||||
// context: ({ req }) => new AppContext(req), // function will be called once for each request, the created context will be passed down to each resolver. (It is usually used for authentication)
|
||||
}),
|
||||
],
|
||||
controllers: [AppController],
|
||||
providers: [
|
||||
AppService,
|
||||
JwtService,
|
||||
PrismaClient,
|
||||
UserRelationsResolver,
|
||||
UserCrudResolver,
|
||||
RoleRelationsResolver,
|
||||
RoleCrudResolver,
|
||||
PermissionRelationsResolver,
|
||||
PermissionCrudResolver,
|
||||
ProductRelationsResolver,
|
||||
ProductCrudResolver,
|
||||
],
|
||||
})
|
||||
export class AppModule {}
|
8
src/app.service.ts
Normal file
8
src/app.service.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class AppService {
|
||||
getHello(): string {
|
||||
return 'Hello World!';
|
||||
}
|
||||
}
|
8
src/main.ts
Normal file
8
src/main.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
await app.listen(3000);
|
||||
}
|
||||
bootstrap();
|
1612
src/schema.gql
Normal file
1612
src/schema.gql
Normal file
@ -0,0 +1,1612 @@
|
||||
# ------------------------------------------------------
|
||||
# THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
|
||||
# ------------------------------------------------------
|
||||
|
||||
type Permission {
|
||||
id: Int!
|
||||
name: String!
|
||||
createdAt: Timestamp!
|
||||
updatedAt: Timestamp!
|
||||
roleId: Int!
|
||||
role: Role!
|
||||
}
|
||||
|
||||
"""
|
||||
`Date` type as integer. Type represents date and time as number of milliseconds from start of UNIX epoch.
|
||||
"""
|
||||
scalar Timestamp
|
||||
|
||||
type AffectedRowsOutput {
|
||||
count: Int!
|
||||
}
|
||||
|
||||
type PermissionAvgAggregate {
|
||||
id: Float
|
||||
roleId: Float
|
||||
}
|
||||
|
||||
type PermissionCountAggregate {
|
||||
id: Int!
|
||||
name: Int!
|
||||
createdAt: Int!
|
||||
updatedAt: Int!
|
||||
roleId: Int!
|
||||
_all: Int!
|
||||
}
|
||||
|
||||
type PermissionMaxAggregate {
|
||||
id: Int
|
||||
name: String
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
roleId: Int
|
||||
}
|
||||
|
||||
type PermissionMinAggregate {
|
||||
id: Int
|
||||
name: String
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
roleId: Int
|
||||
}
|
||||
|
||||
type PermissionSumAggregate {
|
||||
id: Int
|
||||
roleId: Int
|
||||
}
|
||||
|
||||
type AggregatePermission {
|
||||
_count: PermissionCountAggregate
|
||||
_avg: PermissionAvgAggregate
|
||||
_sum: PermissionSumAggregate
|
||||
_min: PermissionMinAggregate
|
||||
_max: PermissionMaxAggregate
|
||||
}
|
||||
|
||||
type PermissionGroupBy {
|
||||
id: Int!
|
||||
name: String!
|
||||
createdAt: Timestamp!
|
||||
updatedAt: Timestamp!
|
||||
roleId: Int!
|
||||
_count: PermissionCountAggregate
|
||||
_avg: PermissionAvgAggregate
|
||||
_sum: PermissionSumAggregate
|
||||
_min: PermissionMinAggregate
|
||||
_max: PermissionMaxAggregate
|
||||
}
|
||||
|
||||
"""
|
||||
@@allow('all', auth() == author)
|
||||
@@allow('read', auth() != null && published)
|
||||
"""
|
||||
type Product {
|
||||
id: String!
|
||||
createdAt: Timestamp!
|
||||
updatedAt: Timestamp!
|
||||
title: String!
|
||||
published: Boolean!
|
||||
authorId: Int!
|
||||
author: User!
|
||||
}
|
||||
|
||||
type ProductAvgAggregate {
|
||||
authorId: Float
|
||||
}
|
||||
|
||||
type ProductCountAggregate {
|
||||
id: Int!
|
||||
createdAt: Int!
|
||||
updatedAt: Int!
|
||||
title: Int!
|
||||
published: Int!
|
||||
authorId: Int!
|
||||
_all: Int!
|
||||
}
|
||||
|
||||
type ProductMaxAggregate {
|
||||
id: String
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
title: String
|
||||
published: Boolean
|
||||
authorId: Int
|
||||
}
|
||||
|
||||
type ProductMinAggregate {
|
||||
id: String
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
title: String
|
||||
published: Boolean
|
||||
authorId: Int
|
||||
}
|
||||
|
||||
type ProductSumAggregate {
|
||||
authorId: Int
|
||||
}
|
||||
|
||||
type AggregateProduct {
|
||||
_count: ProductCountAggregate
|
||||
_avg: ProductAvgAggregate
|
||||
_sum: ProductSumAggregate
|
||||
_min: ProductMinAggregate
|
||||
_max: ProductMaxAggregate
|
||||
}
|
||||
|
||||
type ProductGroupBy {
|
||||
id: String!
|
||||
createdAt: Timestamp!
|
||||
updatedAt: Timestamp!
|
||||
title: String!
|
||||
published: Boolean!
|
||||
authorId: Int!
|
||||
_count: ProductCountAggregate
|
||||
_avg: ProductAvgAggregate
|
||||
_sum: ProductSumAggregate
|
||||
_min: ProductMinAggregate
|
||||
_max: ProductMaxAggregate
|
||||
}
|
||||
|
||||
type RoleCount {
|
||||
permission: Int!
|
||||
user: Int!
|
||||
}
|
||||
|
||||
type Role {
|
||||
id: Int!
|
||||
name: String!
|
||||
createdAt: Timestamp!
|
||||
updatedAt: Timestamp!
|
||||
_count: RoleCount
|
||||
permission(where: PermissionWhereInput, orderBy: [PermissionOrderByWithRelationInput!], cursor: PermissionWhereUniqueInput, take: Int, skip: Int, distinct: [PermissionScalarFieldEnum!]): [Permission!]!
|
||||
user(where: UsersRolesWhereInput, orderBy: [UsersRolesOrderByWithRelationInput!], cursor: UsersRolesWhereUniqueInput, take: Int, skip: Int, distinct: [UsersRolesScalarFieldEnum!]): [UsersRoles!]!
|
||||
}
|
||||
|
||||
input PermissionWhereInput {
|
||||
AND: [PermissionWhereInput!]
|
||||
OR: [PermissionWhereInput!]
|
||||
NOT: [PermissionWhereInput!]
|
||||
id: IntFilter
|
||||
name: StringFilter
|
||||
createdAt: DateTimeFilter
|
||||
updatedAt: DateTimeFilter
|
||||
roleId: IntFilter
|
||||
role: RoleRelationFilter
|
||||
}
|
||||
|
||||
input IntFilter {
|
||||
equals: Int
|
||||
in: [Int!]
|
||||
notIn: [Int!]
|
||||
lt: Int
|
||||
lte: Int
|
||||
gt: Int
|
||||
gte: Int
|
||||
not: NestedIntFilter
|
||||
}
|
||||
|
||||
input NestedIntFilter {
|
||||
equals: Int
|
||||
in: [Int!]
|
||||
notIn: [Int!]
|
||||
lt: Int
|
||||
lte: Int
|
||||
gt: Int
|
||||
gte: Int
|
||||
not: NestedIntFilter
|
||||
}
|
||||
|
||||
input StringFilter {
|
||||
equals: String
|
||||
in: [String!]
|
||||
notIn: [String!]
|
||||
lt: String
|
||||
lte: String
|
||||
gt: String
|
||||
gte: String
|
||||
contains: String
|
||||
startsWith: String
|
||||
endsWith: String
|
||||
not: NestedStringFilter
|
||||
}
|
||||
|
||||
input NestedStringFilter {
|
||||
equals: String
|
||||
in: [String!]
|
||||
notIn: [String!]
|
||||
lt: String
|
||||
lte: String
|
||||
gt: String
|
||||
gte: String
|
||||
contains: String
|
||||
startsWith: String
|
||||
endsWith: String
|
||||
not: NestedStringFilter
|
||||
}
|
||||
|
||||
input DateTimeFilter {
|
||||
equals: Timestamp
|
||||
in: [Timestamp!]
|
||||
notIn: [Timestamp!]
|
||||
lt: Timestamp
|
||||
lte: Timestamp
|
||||
gt: Timestamp
|
||||
gte: Timestamp
|
||||
not: NestedDateTimeFilter
|
||||
}
|
||||
|
||||
input NestedDateTimeFilter {
|
||||
equals: Timestamp
|
||||
in: [Timestamp!]
|
||||
notIn: [Timestamp!]
|
||||
lt: Timestamp
|
||||
lte: Timestamp
|
||||
gt: Timestamp
|
||||
gte: Timestamp
|
||||
not: NestedDateTimeFilter
|
||||
}
|
||||
|
||||
input RoleRelationFilter {
|
||||
is: RoleWhereInput
|
||||
isNot: RoleWhereInput
|
||||
}
|
||||
|
||||
input RoleWhereInput {
|
||||
AND: [RoleWhereInput!]
|
||||
OR: [RoleWhereInput!]
|
||||
NOT: [RoleWhereInput!]
|
||||
id: IntFilter
|
||||
name: StringFilter
|
||||
createdAt: DateTimeFilter
|
||||
updatedAt: DateTimeFilter
|
||||
permission: PermissionListRelationFilter
|
||||
user: UsersRolesListRelationFilter
|
||||
}
|
||||
|
||||
input PermissionListRelationFilter {
|
||||
every: PermissionWhereInput
|
||||
some: PermissionWhereInput
|
||||
none: PermissionWhereInput
|
||||
}
|
||||
|
||||
input UsersRolesListRelationFilter {
|
||||
every: UsersRolesWhereInput
|
||||
some: UsersRolesWhereInput
|
||||
none: UsersRolesWhereInput
|
||||
}
|
||||
|
||||
input UsersRolesWhereInput {
|
||||
AND: [UsersRolesWhereInput!]
|
||||
OR: [UsersRolesWhereInput!]
|
||||
NOT: [UsersRolesWhereInput!]
|
||||
userId: IntFilter
|
||||
roleId: IntFilter
|
||||
assignedAt: DateTimeFilter
|
||||
assignedBy: StringFilter
|
||||
user: UserRelationFilter
|
||||
role: RoleRelationFilter
|
||||
}
|
||||
|
||||
input UserRelationFilter {
|
||||
is: UserWhereInput
|
||||
isNot: UserWhereInput
|
||||
}
|
||||
|
||||
input UserWhereInput {
|
||||
AND: [UserWhereInput!]
|
||||
OR: [UserWhereInput!]
|
||||
NOT: [UserWhereInput!]
|
||||
id: IntFilter
|
||||
email: StringFilter
|
||||
password: StringFilter
|
||||
createdAt: DateTimeFilter
|
||||
updatedAt: DateTimeFilter
|
||||
role: UsersRolesListRelationFilter
|
||||
product: ProductListRelationFilter
|
||||
}
|
||||
|
||||
input ProductListRelationFilter {
|
||||
every: ProductWhereInput
|
||||
some: ProductWhereInput
|
||||
none: ProductWhereInput
|
||||
}
|
||||
|
||||
input ProductWhereInput {
|
||||
AND: [ProductWhereInput!]
|
||||
OR: [ProductWhereInput!]
|
||||
NOT: [ProductWhereInput!]
|
||||
id: StringFilter
|
||||
createdAt: DateTimeFilter
|
||||
updatedAt: DateTimeFilter
|
||||
title: StringFilter
|
||||
published: BoolFilter
|
||||
authorId: IntFilter
|
||||
author: UserRelationFilter
|
||||
}
|
||||
|
||||
input BoolFilter {
|
||||
equals: Boolean
|
||||
not: NestedBoolFilter
|
||||
}
|
||||
|
||||
input NestedBoolFilter {
|
||||
equals: Boolean
|
||||
not: NestedBoolFilter
|
||||
}
|
||||
|
||||
input PermissionOrderByWithRelationInput {
|
||||
id: SortOrder
|
||||
name: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
roleId: SortOrder
|
||||
role: RoleOrderByWithRelationInput
|
||||
}
|
||||
|
||||
enum SortOrder {
|
||||
asc
|
||||
desc
|
||||
}
|
||||
|
||||
input RoleOrderByWithRelationInput {
|
||||
id: SortOrder
|
||||
name: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
permission: PermissionOrderByRelationAggregateInput
|
||||
user: UsersRolesOrderByRelationAggregateInput
|
||||
}
|
||||
|
||||
input PermissionOrderByRelationAggregateInput {
|
||||
_count: SortOrder
|
||||
}
|
||||
|
||||
input UsersRolesOrderByRelationAggregateInput {
|
||||
_count: SortOrder
|
||||
}
|
||||
|
||||
input PermissionWhereUniqueInput {
|
||||
id: Int
|
||||
name: String
|
||||
AND: [PermissionWhereInput!]
|
||||
OR: [PermissionWhereInput!]
|
||||
NOT: [PermissionWhereInput!]
|
||||
createdAt: DateTimeFilter
|
||||
updatedAt: DateTimeFilter
|
||||
roleId: IntFilter
|
||||
role: RoleRelationFilter
|
||||
}
|
||||
|
||||
enum PermissionScalarFieldEnum {
|
||||
id
|
||||
name
|
||||
createdAt
|
||||
updatedAt
|
||||
roleId
|
||||
}
|
||||
|
||||
input UsersRolesOrderByWithRelationInput {
|
||||
userId: SortOrder
|
||||
roleId: SortOrder
|
||||
assignedAt: SortOrder
|
||||
assignedBy: SortOrder
|
||||
user: UserOrderByWithRelationInput
|
||||
role: RoleOrderByWithRelationInput
|
||||
}
|
||||
|
||||
input UserOrderByWithRelationInput {
|
||||
id: SortOrder
|
||||
email: SortOrder
|
||||
password: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
role: UsersRolesOrderByRelationAggregateInput
|
||||
product: ProductOrderByRelationAggregateInput
|
||||
}
|
||||
|
||||
input ProductOrderByRelationAggregateInput {
|
||||
_count: SortOrder
|
||||
}
|
||||
|
||||
input UsersRolesWhereUniqueInput {
|
||||
userId_roleId: UsersRolesUserIdRoleIdCompoundUniqueInput
|
||||
AND: [UsersRolesWhereInput!]
|
||||
OR: [UsersRolesWhereInput!]
|
||||
NOT: [UsersRolesWhereInput!]
|
||||
userId: IntFilter
|
||||
roleId: IntFilter
|
||||
assignedAt: DateTimeFilter
|
||||
assignedBy: StringFilter
|
||||
user: UserRelationFilter
|
||||
role: RoleRelationFilter
|
||||
}
|
||||
|
||||
input UsersRolesUserIdRoleIdCompoundUniqueInput {
|
||||
userId: Int!
|
||||
roleId: Int!
|
||||
}
|
||||
|
||||
enum UsersRolesScalarFieldEnum {
|
||||
userId
|
||||
roleId
|
||||
assignedAt
|
||||
assignedBy
|
||||
}
|
||||
|
||||
type RoleAvgAggregate {
|
||||
id: Float
|
||||
}
|
||||
|
||||
type RoleCountAggregate {
|
||||
id: Int!
|
||||
name: Int!
|
||||
createdAt: Int!
|
||||
updatedAt: Int!
|
||||
_all: Int!
|
||||
}
|
||||
|
||||
type RoleMaxAggregate {
|
||||
id: Int
|
||||
name: String
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
}
|
||||
|
||||
type RoleMinAggregate {
|
||||
id: Int
|
||||
name: String
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
}
|
||||
|
||||
type RoleSumAggregate {
|
||||
id: Int
|
||||
}
|
||||
|
||||
type AggregateRole {
|
||||
_count: RoleCountAggregate
|
||||
_avg: RoleAvgAggregate
|
||||
_sum: RoleSumAggregate
|
||||
_min: RoleMinAggregate
|
||||
_max: RoleMaxAggregate
|
||||
}
|
||||
|
||||
type RoleGroupBy {
|
||||
id: Int!
|
||||
name: String!
|
||||
createdAt: Timestamp!
|
||||
updatedAt: Timestamp!
|
||||
_count: RoleCountAggregate
|
||||
_avg: RoleAvgAggregate
|
||||
_sum: RoleSumAggregate
|
||||
_min: RoleMinAggregate
|
||||
_max: RoleMaxAggregate
|
||||
}
|
||||
|
||||
type UserCount {
|
||||
role: Int!
|
||||
product: Int!
|
||||
}
|
||||
|
||||
"""
|
||||
@@allow('create,read', true)
|
||||
@@allow('update', auth() == this && future().email == email)
|
||||
"""
|
||||
type User {
|
||||
id: Int!
|
||||
email: String!
|
||||
|
||||
"""@omit"""
|
||||
password: String!
|
||||
createdAt: Timestamp!
|
||||
updatedAt: Timestamp!
|
||||
_count: UserCount
|
||||
role(where: UsersRolesWhereInput, orderBy: [UsersRolesOrderByWithRelationInput!], cursor: UsersRolesWhereUniqueInput, take: Int, skip: Int, distinct: [UsersRolesScalarFieldEnum!]): [UsersRoles!]!
|
||||
product(where: ProductWhereInput, orderBy: [ProductOrderByWithRelationInput!], cursor: ProductWhereUniqueInput, take: Int, skip: Int, distinct: [ProductScalarFieldEnum!]): [Product!]!
|
||||
}
|
||||
|
||||
input ProductOrderByWithRelationInput {
|
||||
id: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
title: SortOrder
|
||||
published: SortOrder
|
||||
authorId: SortOrder
|
||||
author: UserOrderByWithRelationInput
|
||||
}
|
||||
|
||||
input ProductWhereUniqueInput {
|
||||
id: String
|
||||
AND: [ProductWhereInput!]
|
||||
OR: [ProductWhereInput!]
|
||||
NOT: [ProductWhereInput!]
|
||||
createdAt: DateTimeFilter
|
||||
updatedAt: DateTimeFilter
|
||||
title: StringFilter
|
||||
published: BoolFilter
|
||||
authorId: IntFilter
|
||||
author: UserRelationFilter
|
||||
}
|
||||
|
||||
enum ProductScalarFieldEnum {
|
||||
id
|
||||
createdAt
|
||||
updatedAt
|
||||
title
|
||||
published
|
||||
authorId
|
||||
}
|
||||
|
||||
type UserAvgAggregate {
|
||||
id: Float
|
||||
}
|
||||
|
||||
type UserCountAggregate {
|
||||
id: Int!
|
||||
email: Int!
|
||||
password: Int!
|
||||
createdAt: Int!
|
||||
updatedAt: Int!
|
||||
_all: Int!
|
||||
}
|
||||
|
||||
type UserMaxAggregate {
|
||||
id: Int
|
||||
email: String
|
||||
password: String
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
}
|
||||
|
||||
type UserMinAggregate {
|
||||
id: Int
|
||||
email: String
|
||||
password: String
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
}
|
||||
|
||||
type UserSumAggregate {
|
||||
id: Int
|
||||
}
|
||||
|
||||
type AggregateUser {
|
||||
_count: UserCountAggregate
|
||||
_avg: UserAvgAggregate
|
||||
_sum: UserSumAggregate
|
||||
_min: UserMinAggregate
|
||||
_max: UserMaxAggregate
|
||||
}
|
||||
|
||||
type UserGroupBy {
|
||||
id: Int!
|
||||
email: String!
|
||||
password: String!
|
||||
createdAt: Timestamp!
|
||||
updatedAt: Timestamp!
|
||||
_count: UserCountAggregate
|
||||
_avg: UserAvgAggregate
|
||||
_sum: UserSumAggregate
|
||||
_min: UserMinAggregate
|
||||
_max: UserMaxAggregate
|
||||
}
|
||||
|
||||
type UsersRoles {
|
||||
userId: Int!
|
||||
roleId: Int!
|
||||
assignedAt: Timestamp!
|
||||
assignedBy: String!
|
||||
}
|
||||
|
||||
type UsersRolesAvgAggregate {
|
||||
userId: Float
|
||||
roleId: Float
|
||||
}
|
||||
|
||||
type UsersRolesCountAggregate {
|
||||
userId: Int!
|
||||
roleId: Int!
|
||||
assignedAt: Int!
|
||||
assignedBy: Int!
|
||||
_all: Int!
|
||||
}
|
||||
|
||||
type UsersRolesMaxAggregate {
|
||||
userId: Int
|
||||
roleId: Int
|
||||
assignedAt: Timestamp
|
||||
assignedBy: String
|
||||
}
|
||||
|
||||
type UsersRolesMinAggregate {
|
||||
userId: Int
|
||||
roleId: Int
|
||||
assignedAt: Timestamp
|
||||
assignedBy: String
|
||||
}
|
||||
|
||||
type UsersRolesSumAggregate {
|
||||
userId: Int
|
||||
roleId: Int
|
||||
}
|
||||
|
||||
type Query {
|
||||
aggregateUser(where: UserWhereInput, orderBy: [UserOrderByWithRelationInput!], cursor: UserWhereUniqueInput, take: Int, skip: Int): AggregateUser!
|
||||
findFirstUser(where: UserWhereInput, orderBy: [UserOrderByWithRelationInput!], cursor: UserWhereUniqueInput, take: Int, skip: Int, distinct: [UserScalarFieldEnum!]): User
|
||||
findFirstUserOrThrow(where: UserWhereInput, orderBy: [UserOrderByWithRelationInput!], cursor: UserWhereUniqueInput, take: Int, skip: Int, distinct: [UserScalarFieldEnum!]): User
|
||||
users(where: UserWhereInput, orderBy: [UserOrderByWithRelationInput!], cursor: UserWhereUniqueInput, take: Int, skip: Int, distinct: [UserScalarFieldEnum!]): [User!]!
|
||||
user(where: UserWhereUniqueInput!): User
|
||||
getUser(where: UserWhereUniqueInput!): User
|
||||
groupByUser(where: UserWhereInput, orderBy: [UserOrderByWithAggregationInput!], by: [UserScalarFieldEnum!]!, having: UserScalarWhereWithAggregatesInput, take: Int, skip: Int): [UserGroupBy!]!
|
||||
aggregateRole(where: RoleWhereInput, orderBy: [RoleOrderByWithRelationInput!], cursor: RoleWhereUniqueInput, take: Int, skip: Int): AggregateRole!
|
||||
findFirstRole(where: RoleWhereInput, orderBy: [RoleOrderByWithRelationInput!], cursor: RoleWhereUniqueInput, take: Int, skip: Int, distinct: [RoleScalarFieldEnum!]): Role
|
||||
findFirstRoleOrThrow(where: RoleWhereInput, orderBy: [RoleOrderByWithRelationInput!], cursor: RoleWhereUniqueInput, take: Int, skip: Int, distinct: [RoleScalarFieldEnum!]): Role
|
||||
roles(where: RoleWhereInput, orderBy: [RoleOrderByWithRelationInput!], cursor: RoleWhereUniqueInput, take: Int, skip: Int, distinct: [RoleScalarFieldEnum!]): [Role!]!
|
||||
role(where: RoleWhereUniqueInput!): Role
|
||||
getRole(where: RoleWhereUniqueInput!): Role
|
||||
groupByRole(where: RoleWhereInput, orderBy: [RoleOrderByWithAggregationInput!], by: [RoleScalarFieldEnum!]!, having: RoleScalarWhereWithAggregatesInput, take: Int, skip: Int): [RoleGroupBy!]!
|
||||
aggregatePermission(where: PermissionWhereInput, orderBy: [PermissionOrderByWithRelationInput!], cursor: PermissionWhereUniqueInput, take: Int, skip: Int): AggregatePermission!
|
||||
findFirstPermission(where: PermissionWhereInput, orderBy: [PermissionOrderByWithRelationInput!], cursor: PermissionWhereUniqueInput, take: Int, skip: Int, distinct: [PermissionScalarFieldEnum!]): Permission
|
||||
findFirstPermissionOrThrow(where: PermissionWhereInput, orderBy: [PermissionOrderByWithRelationInput!], cursor: PermissionWhereUniqueInput, take: Int, skip: Int, distinct: [PermissionScalarFieldEnum!]): Permission
|
||||
permissions(where: PermissionWhereInput, orderBy: [PermissionOrderByWithRelationInput!], cursor: PermissionWhereUniqueInput, take: Int, skip: Int, distinct: [PermissionScalarFieldEnum!]): [Permission!]!
|
||||
permission(where: PermissionWhereUniqueInput!): Permission
|
||||
getPermission(where: PermissionWhereUniqueInput!): Permission
|
||||
groupByPermission(where: PermissionWhereInput, orderBy: [PermissionOrderByWithAggregationInput!], by: [PermissionScalarFieldEnum!]!, having: PermissionScalarWhereWithAggregatesInput, take: Int, skip: Int): [PermissionGroupBy!]!
|
||||
aggregateProduct(where: ProductWhereInput, orderBy: [ProductOrderByWithRelationInput!], cursor: ProductWhereUniqueInput, take: Int, skip: Int): AggregateProduct!
|
||||
findFirstProduct(where: ProductWhereInput, orderBy: [ProductOrderByWithRelationInput!], cursor: ProductWhereUniqueInput, take: Int, skip: Int, distinct: [ProductScalarFieldEnum!]): Product
|
||||
findFirstProductOrThrow(where: ProductWhereInput, orderBy: [ProductOrderByWithRelationInput!], cursor: ProductWhereUniqueInput, take: Int, skip: Int, distinct: [ProductScalarFieldEnum!]): Product
|
||||
products(where: ProductWhereInput, orderBy: [ProductOrderByWithRelationInput!], cursor: ProductWhereUniqueInput, take: Int, skip: Int, distinct: [ProductScalarFieldEnum!]): [Product!]!
|
||||
product(where: ProductWhereUniqueInput!): Product
|
||||
getProduct(where: ProductWhereUniqueInput!): Product
|
||||
groupByProduct(where: ProductWhereInput, orderBy: [ProductOrderByWithAggregationInput!], by: [ProductScalarFieldEnum!]!, having: ProductScalarWhereWithAggregatesInput, take: Int, skip: Int): [ProductGroupBy!]!
|
||||
}
|
||||
|
||||
input UserWhereUniqueInput {
|
||||
id: Int
|
||||
email: String
|
||||
AND: [UserWhereInput!]
|
||||
OR: [UserWhereInput!]
|
||||
NOT: [UserWhereInput!]
|
||||
password: StringFilter
|
||||
createdAt: DateTimeFilter
|
||||
updatedAt: DateTimeFilter
|
||||
role: UsersRolesListRelationFilter
|
||||
product: ProductListRelationFilter
|
||||
}
|
||||
|
||||
enum UserScalarFieldEnum {
|
||||
id
|
||||
email
|
||||
password
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
|
||||
input UserOrderByWithAggregationInput {
|
||||
id: SortOrder
|
||||
email: SortOrder
|
||||
password: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
_count: UserCountOrderByAggregateInput
|
||||
_avg: UserAvgOrderByAggregateInput
|
||||
_max: UserMaxOrderByAggregateInput
|
||||
_min: UserMinOrderByAggregateInput
|
||||
_sum: UserSumOrderByAggregateInput
|
||||
}
|
||||
|
||||
input UserCountOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
email: SortOrder
|
||||
password: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
}
|
||||
|
||||
input UserAvgOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
}
|
||||
|
||||
input UserMaxOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
email: SortOrder
|
||||
password: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
}
|
||||
|
||||
input UserMinOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
email: SortOrder
|
||||
password: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
}
|
||||
|
||||
input UserSumOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
}
|
||||
|
||||
input UserScalarWhereWithAggregatesInput {
|
||||
AND: [UserScalarWhereWithAggregatesInput!]
|
||||
OR: [UserScalarWhereWithAggregatesInput!]
|
||||
NOT: [UserScalarWhereWithAggregatesInput!]
|
||||
id: IntWithAggregatesFilter
|
||||
email: StringWithAggregatesFilter
|
||||
password: StringWithAggregatesFilter
|
||||
createdAt: DateTimeWithAggregatesFilter
|
||||
updatedAt: DateTimeWithAggregatesFilter
|
||||
}
|
||||
|
||||
input IntWithAggregatesFilter {
|
||||
equals: Int
|
||||
in: [Int!]
|
||||
notIn: [Int!]
|
||||
lt: Int
|
||||
lte: Int
|
||||
gt: Int
|
||||
gte: Int
|
||||
not: NestedIntWithAggregatesFilter
|
||||
_count: NestedIntFilter
|
||||
_avg: NestedFloatFilter
|
||||
_sum: NestedIntFilter
|
||||
_min: NestedIntFilter
|
||||
_max: NestedIntFilter
|
||||
}
|
||||
|
||||
input NestedIntWithAggregatesFilter {
|
||||
equals: Int
|
||||
in: [Int!]
|
||||
notIn: [Int!]
|
||||
lt: Int
|
||||
lte: Int
|
||||
gt: Int
|
||||
gte: Int
|
||||
not: NestedIntWithAggregatesFilter
|
||||
_count: NestedIntFilter
|
||||
_avg: NestedFloatFilter
|
||||
_sum: NestedIntFilter
|
||||
_min: NestedIntFilter
|
||||
_max: NestedIntFilter
|
||||
}
|
||||
|
||||
input NestedFloatFilter {
|
||||
equals: Float
|
||||
in: [Float!]
|
||||
notIn: [Float!]
|
||||
lt: Float
|
||||
lte: Float
|
||||
gt: Float
|
||||
gte: Float
|
||||
not: NestedFloatFilter
|
||||
}
|
||||
|
||||
input StringWithAggregatesFilter {
|
||||
equals: String
|
||||
in: [String!]
|
||||
notIn: [String!]
|
||||
lt: String
|
||||
lte: String
|
||||
gt: String
|
||||
gte: String
|
||||
contains: String
|
||||
startsWith: String
|
||||
endsWith: String
|
||||
not: NestedStringWithAggregatesFilter
|
||||
_count: NestedIntFilter
|
||||
_min: NestedStringFilter
|
||||
_max: NestedStringFilter
|
||||
}
|
||||
|
||||
input NestedStringWithAggregatesFilter {
|
||||
equals: String
|
||||
in: [String!]
|
||||
notIn: [String!]
|
||||
lt: String
|
||||
lte: String
|
||||
gt: String
|
||||
gte: String
|
||||
contains: String
|
||||
startsWith: String
|
||||
endsWith: String
|
||||
not: NestedStringWithAggregatesFilter
|
||||
_count: NestedIntFilter
|
||||
_min: NestedStringFilter
|
||||
_max: NestedStringFilter
|
||||
}
|
||||
|
||||
input DateTimeWithAggregatesFilter {
|
||||
equals: Timestamp
|
||||
in: [Timestamp!]
|
||||
notIn: [Timestamp!]
|
||||
lt: Timestamp
|
||||
lte: Timestamp
|
||||
gt: Timestamp
|
||||
gte: Timestamp
|
||||
not: NestedDateTimeWithAggregatesFilter
|
||||
_count: NestedIntFilter
|
||||
_min: NestedDateTimeFilter
|
||||
_max: NestedDateTimeFilter
|
||||
}
|
||||
|
||||
input NestedDateTimeWithAggregatesFilter {
|
||||
equals: Timestamp
|
||||
in: [Timestamp!]
|
||||
notIn: [Timestamp!]
|
||||
lt: Timestamp
|
||||
lte: Timestamp
|
||||
gt: Timestamp
|
||||
gte: Timestamp
|
||||
not: NestedDateTimeWithAggregatesFilter
|
||||
_count: NestedIntFilter
|
||||
_min: NestedDateTimeFilter
|
||||
_max: NestedDateTimeFilter
|
||||
}
|
||||
|
||||
input RoleWhereUniqueInput {
|
||||
id: Int
|
||||
name: String
|
||||
AND: [RoleWhereInput!]
|
||||
OR: [RoleWhereInput!]
|
||||
NOT: [RoleWhereInput!]
|
||||
createdAt: DateTimeFilter
|
||||
updatedAt: DateTimeFilter
|
||||
permission: PermissionListRelationFilter
|
||||
user: UsersRolesListRelationFilter
|
||||
}
|
||||
|
||||
enum RoleScalarFieldEnum {
|
||||
id
|
||||
name
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
|
||||
input RoleOrderByWithAggregationInput {
|
||||
id: SortOrder
|
||||
name: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
_count: RoleCountOrderByAggregateInput
|
||||
_avg: RoleAvgOrderByAggregateInput
|
||||
_max: RoleMaxOrderByAggregateInput
|
||||
_min: RoleMinOrderByAggregateInput
|
||||
_sum: RoleSumOrderByAggregateInput
|
||||
}
|
||||
|
||||
input RoleCountOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
name: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
}
|
||||
|
||||
input RoleAvgOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
}
|
||||
|
||||
input RoleMaxOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
name: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
}
|
||||
|
||||
input RoleMinOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
name: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
}
|
||||
|
||||
input RoleSumOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
}
|
||||
|
||||
input RoleScalarWhereWithAggregatesInput {
|
||||
AND: [RoleScalarWhereWithAggregatesInput!]
|
||||
OR: [RoleScalarWhereWithAggregatesInput!]
|
||||
NOT: [RoleScalarWhereWithAggregatesInput!]
|
||||
id: IntWithAggregatesFilter
|
||||
name: StringWithAggregatesFilter
|
||||
createdAt: DateTimeWithAggregatesFilter
|
||||
updatedAt: DateTimeWithAggregatesFilter
|
||||
}
|
||||
|
||||
input PermissionOrderByWithAggregationInput {
|
||||
id: SortOrder
|
||||
name: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
roleId: SortOrder
|
||||
_count: PermissionCountOrderByAggregateInput
|
||||
_avg: PermissionAvgOrderByAggregateInput
|
||||
_max: PermissionMaxOrderByAggregateInput
|
||||
_min: PermissionMinOrderByAggregateInput
|
||||
_sum: PermissionSumOrderByAggregateInput
|
||||
}
|
||||
|
||||
input PermissionCountOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
name: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
roleId: SortOrder
|
||||
}
|
||||
|
||||
input PermissionAvgOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
roleId: SortOrder
|
||||
}
|
||||
|
||||
input PermissionMaxOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
name: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
roleId: SortOrder
|
||||
}
|
||||
|
||||
input PermissionMinOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
name: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
roleId: SortOrder
|
||||
}
|
||||
|
||||
input PermissionSumOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
roleId: SortOrder
|
||||
}
|
||||
|
||||
input PermissionScalarWhereWithAggregatesInput {
|
||||
AND: [PermissionScalarWhereWithAggregatesInput!]
|
||||
OR: [PermissionScalarWhereWithAggregatesInput!]
|
||||
NOT: [PermissionScalarWhereWithAggregatesInput!]
|
||||
id: IntWithAggregatesFilter
|
||||
name: StringWithAggregatesFilter
|
||||
createdAt: DateTimeWithAggregatesFilter
|
||||
updatedAt: DateTimeWithAggregatesFilter
|
||||
roleId: IntWithAggregatesFilter
|
||||
}
|
||||
|
||||
input ProductOrderByWithAggregationInput {
|
||||
id: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
title: SortOrder
|
||||
published: SortOrder
|
||||
authorId: SortOrder
|
||||
_count: ProductCountOrderByAggregateInput
|
||||
_avg: ProductAvgOrderByAggregateInput
|
||||
_max: ProductMaxOrderByAggregateInput
|
||||
_min: ProductMinOrderByAggregateInput
|
||||
_sum: ProductSumOrderByAggregateInput
|
||||
}
|
||||
|
||||
input ProductCountOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
title: SortOrder
|
||||
published: SortOrder
|
||||
authorId: SortOrder
|
||||
}
|
||||
|
||||
input ProductAvgOrderByAggregateInput {
|
||||
authorId: SortOrder
|
||||
}
|
||||
|
||||
input ProductMaxOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
title: SortOrder
|
||||
published: SortOrder
|
||||
authorId: SortOrder
|
||||
}
|
||||
|
||||
input ProductMinOrderByAggregateInput {
|
||||
id: SortOrder
|
||||
createdAt: SortOrder
|
||||
updatedAt: SortOrder
|
||||
title: SortOrder
|
||||
published: SortOrder
|
||||
authorId: SortOrder
|
||||
}
|
||||
|
||||
input ProductSumOrderByAggregateInput {
|
||||
authorId: SortOrder
|
||||
}
|
||||
|
||||
input ProductScalarWhereWithAggregatesInput {
|
||||
AND: [ProductScalarWhereWithAggregatesInput!]
|
||||
OR: [ProductScalarWhereWithAggregatesInput!]
|
||||
NOT: [ProductScalarWhereWithAggregatesInput!]
|
||||
id: StringWithAggregatesFilter
|
||||
createdAt: DateTimeWithAggregatesFilter
|
||||
updatedAt: DateTimeWithAggregatesFilter
|
||||
title: StringWithAggregatesFilter
|
||||
published: BoolWithAggregatesFilter
|
||||
authorId: IntWithAggregatesFilter
|
||||
}
|
||||
|
||||
input BoolWithAggregatesFilter {
|
||||
equals: Boolean
|
||||
not: NestedBoolWithAggregatesFilter
|
||||
_count: NestedIntFilter
|
||||
_min: NestedBoolFilter
|
||||
_max: NestedBoolFilter
|
||||
}
|
||||
|
||||
input NestedBoolWithAggregatesFilter {
|
||||
equals: Boolean
|
||||
not: NestedBoolWithAggregatesFilter
|
||||
_count: NestedIntFilter
|
||||
_min: NestedBoolFilter
|
||||
_max: NestedBoolFilter
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
createOneUser(data: UserCreateInput!): User!
|
||||
deleteManyUser(where: UserWhereInput): AffectedRowsOutput!
|
||||
deleteOneUser(where: UserWhereUniqueInput!): User
|
||||
updateManyUser(data: UserUpdateManyMutationInput!, where: UserWhereInput): AffectedRowsOutput!
|
||||
updateOneUser(data: UserUpdateInput!, where: UserWhereUniqueInput!): User
|
||||
upsertOneUser(where: UserWhereUniqueInput!, create: UserCreateInput!, update: UserUpdateInput!): User!
|
||||
createOneRole(data: RoleCreateInput!): Role!
|
||||
deleteManyRole(where: RoleWhereInput): AffectedRowsOutput!
|
||||
deleteOneRole(where: RoleWhereUniqueInput!): Role
|
||||
updateManyRole(data: RoleUpdateManyMutationInput!, where: RoleWhereInput): AffectedRowsOutput!
|
||||
updateOneRole(data: RoleUpdateInput!, where: RoleWhereUniqueInput!): Role
|
||||
upsertOneRole(where: RoleWhereUniqueInput!, create: RoleCreateInput!, update: RoleUpdateInput!): Role!
|
||||
createOnePermission(data: PermissionCreateInput!): Permission!
|
||||
deleteManyPermission(where: PermissionWhereInput): AffectedRowsOutput!
|
||||
deleteOnePermission(where: PermissionWhereUniqueInput!): Permission
|
||||
updateManyPermission(data: PermissionUpdateManyMutationInput!, where: PermissionWhereInput): AffectedRowsOutput!
|
||||
updateOnePermission(data: PermissionUpdateInput!, where: PermissionWhereUniqueInput!): Permission
|
||||
upsertOnePermission(where: PermissionWhereUniqueInput!, create: PermissionCreateInput!, update: PermissionUpdateInput!): Permission!
|
||||
createOneProduct(data: ProductCreateInput!): Product!
|
||||
deleteManyProduct(where: ProductWhereInput): AffectedRowsOutput!
|
||||
deleteOneProduct(where: ProductWhereUniqueInput!): Product
|
||||
updateManyProduct(data: ProductUpdateManyMutationInput!, where: ProductWhereInput): AffectedRowsOutput!
|
||||
updateOneProduct(data: ProductUpdateInput!, where: ProductWhereUniqueInput!): Product
|
||||
upsertOneProduct(where: ProductWhereUniqueInput!, create: ProductCreateInput!, update: ProductUpdateInput!): Product!
|
||||
}
|
||||
|
||||
input UserCreateInput {
|
||||
email: String!
|
||||
password: String!
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
role: UsersRolesCreateNestedManyWithoutUserInput
|
||||
product: ProductCreateNestedManyWithoutAuthorInput
|
||||
}
|
||||
|
||||
input UsersRolesCreateNestedManyWithoutUserInput {
|
||||
create: [UsersRolesCreateWithoutUserInput!]
|
||||
connectOrCreate: [UsersRolesCreateOrConnectWithoutUserInput!]
|
||||
connect: [UsersRolesWhereUniqueInput!]
|
||||
}
|
||||
|
||||
input UsersRolesCreateWithoutUserInput {
|
||||
assignedAt: Timestamp
|
||||
assignedBy: String!
|
||||
role: RoleCreateNestedOneWithoutUserInput!
|
||||
}
|
||||
|
||||
input RoleCreateNestedOneWithoutUserInput {
|
||||
create: RoleCreateWithoutUserInput
|
||||
connectOrCreate: RoleCreateOrConnectWithoutUserInput
|
||||
connect: RoleWhereUniqueInput
|
||||
}
|
||||
|
||||
input RoleCreateWithoutUserInput {
|
||||
name: String!
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
permission: PermissionCreateNestedManyWithoutRoleInput
|
||||
}
|
||||
|
||||
input PermissionCreateNestedManyWithoutRoleInput {
|
||||
create: [PermissionCreateWithoutRoleInput!]
|
||||
connectOrCreate: [PermissionCreateOrConnectWithoutRoleInput!]
|
||||
connect: [PermissionWhereUniqueInput!]
|
||||
}
|
||||
|
||||
input PermissionCreateWithoutRoleInput {
|
||||
name: String!
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
}
|
||||
|
||||
input PermissionCreateOrConnectWithoutRoleInput {
|
||||
where: PermissionWhereUniqueInput!
|
||||
create: PermissionCreateWithoutRoleInput!
|
||||
}
|
||||
|
||||
input RoleCreateOrConnectWithoutUserInput {
|
||||
where: RoleWhereUniqueInput!
|
||||
create: RoleCreateWithoutUserInput!
|
||||
}
|
||||
|
||||
input UsersRolesCreateOrConnectWithoutUserInput {
|
||||
where: UsersRolesWhereUniqueInput!
|
||||
create: UsersRolesCreateWithoutUserInput!
|
||||
}
|
||||
|
||||
input ProductCreateNestedManyWithoutAuthorInput {
|
||||
create: [ProductCreateWithoutAuthorInput!]
|
||||
connectOrCreate: [ProductCreateOrConnectWithoutAuthorInput!]
|
||||
connect: [ProductWhereUniqueInput!]
|
||||
}
|
||||
|
||||
input ProductCreateWithoutAuthorInput {
|
||||
id: String
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
title: String!
|
||||
published: Boolean
|
||||
}
|
||||
|
||||
input ProductCreateOrConnectWithoutAuthorInput {
|
||||
where: ProductWhereUniqueInput!
|
||||
create: ProductCreateWithoutAuthorInput!
|
||||
}
|
||||
|
||||
input UserUpdateManyMutationInput {
|
||||
email: StringFieldUpdateOperationsInput
|
||||
password: StringFieldUpdateOperationsInput
|
||||
createdAt: DateTimeFieldUpdateOperationsInput
|
||||
updatedAt: DateTimeFieldUpdateOperationsInput
|
||||
}
|
||||
|
||||
input StringFieldUpdateOperationsInput {
|
||||
set: String
|
||||
}
|
||||
|
||||
input DateTimeFieldUpdateOperationsInput {
|
||||
set: Timestamp
|
||||
}
|
||||
|
||||
input UserUpdateInput {
|
||||
email: StringFieldUpdateOperationsInput
|
||||
password: StringFieldUpdateOperationsInput
|
||||
createdAt: DateTimeFieldUpdateOperationsInput
|
||||
updatedAt: DateTimeFieldUpdateOperationsInput
|
||||
role: UsersRolesUpdateManyWithoutUserNestedInput
|
||||
product: ProductUpdateManyWithoutAuthorNestedInput
|
||||
}
|
||||
|
||||
input UsersRolesUpdateManyWithoutUserNestedInput {
|
||||
create: [UsersRolesCreateWithoutUserInput!]
|
||||
connectOrCreate: [UsersRolesCreateOrConnectWithoutUserInput!]
|
||||
upsert: [UsersRolesUpsertWithWhereUniqueWithoutUserInput!]
|
||||
set: [UsersRolesWhereUniqueInput!]
|
||||
disconnect: [UsersRolesWhereUniqueInput!]
|
||||
delete: [UsersRolesWhereUniqueInput!]
|
||||
connect: [UsersRolesWhereUniqueInput!]
|
||||
update: [UsersRolesUpdateWithWhereUniqueWithoutUserInput!]
|
||||
updateMany: [UsersRolesUpdateManyWithWhereWithoutUserInput!]
|
||||
deleteMany: [UsersRolesScalarWhereInput!]
|
||||
}
|
||||
|
||||
input UsersRolesUpsertWithWhereUniqueWithoutUserInput {
|
||||
where: UsersRolesWhereUniqueInput!
|
||||
update: UsersRolesUpdateWithoutUserInput!
|
||||
create: UsersRolesCreateWithoutUserInput!
|
||||
}
|
||||
|
||||
input UsersRolesUpdateWithoutUserInput {
|
||||
assignedAt: DateTimeFieldUpdateOperationsInput
|
||||
assignedBy: StringFieldUpdateOperationsInput
|
||||
role: RoleUpdateOneRequiredWithoutUserNestedInput
|
||||
}
|
||||
|
||||
input RoleUpdateOneRequiredWithoutUserNestedInput {
|
||||
create: RoleCreateWithoutUserInput
|
||||
connectOrCreate: RoleCreateOrConnectWithoutUserInput
|
||||
upsert: RoleUpsertWithoutUserInput
|
||||
connect: RoleWhereUniqueInput
|
||||
update: RoleUpdateToOneWithWhereWithoutUserInput
|
||||
}
|
||||
|
||||
input RoleUpsertWithoutUserInput {
|
||||
update: RoleUpdateWithoutUserInput!
|
||||
create: RoleCreateWithoutUserInput!
|
||||
where: RoleWhereInput
|
||||
}
|
||||
|
||||
input RoleUpdateWithoutUserInput {
|
||||
name: StringFieldUpdateOperationsInput
|
||||
createdAt: DateTimeFieldUpdateOperationsInput
|
||||
updatedAt: DateTimeFieldUpdateOperationsInput
|
||||
permission: PermissionUpdateManyWithoutRoleNestedInput
|
||||
}
|
||||
|
||||
input PermissionUpdateManyWithoutRoleNestedInput {
|
||||
create: [PermissionCreateWithoutRoleInput!]
|
||||
connectOrCreate: [PermissionCreateOrConnectWithoutRoleInput!]
|
||||
upsert: [PermissionUpsertWithWhereUniqueWithoutRoleInput!]
|
||||
set: [PermissionWhereUniqueInput!]
|
||||
disconnect: [PermissionWhereUniqueInput!]
|
||||
delete: [PermissionWhereUniqueInput!]
|
||||
connect: [PermissionWhereUniqueInput!]
|
||||
update: [PermissionUpdateWithWhereUniqueWithoutRoleInput!]
|
||||
updateMany: [PermissionUpdateManyWithWhereWithoutRoleInput!]
|
||||
deleteMany: [PermissionScalarWhereInput!]
|
||||
}
|
||||
|
||||
input PermissionUpsertWithWhereUniqueWithoutRoleInput {
|
||||
where: PermissionWhereUniqueInput!
|
||||
update: PermissionUpdateWithoutRoleInput!
|
||||
create: PermissionCreateWithoutRoleInput!
|
||||
}
|
||||
|
||||
input PermissionUpdateWithoutRoleInput {
|
||||
name: StringFieldUpdateOperationsInput
|
||||
createdAt: DateTimeFieldUpdateOperationsInput
|
||||
updatedAt: DateTimeFieldUpdateOperationsInput
|
||||
}
|
||||
|
||||
input PermissionUpdateWithWhereUniqueWithoutRoleInput {
|
||||
where: PermissionWhereUniqueInput!
|
||||
data: PermissionUpdateWithoutRoleInput!
|
||||
}
|
||||
|
||||
input PermissionUpdateManyWithWhereWithoutRoleInput {
|
||||
where: PermissionScalarWhereInput!
|
||||
data: PermissionUpdateManyMutationInput!
|
||||
}
|
||||
|
||||
input PermissionScalarWhereInput {
|
||||
AND: [PermissionScalarWhereInput!]
|
||||
OR: [PermissionScalarWhereInput!]
|
||||
NOT: [PermissionScalarWhereInput!]
|
||||
id: IntFilter
|
||||
name: StringFilter
|
||||
createdAt: DateTimeFilter
|
||||
updatedAt: DateTimeFilter
|
||||
roleId: IntFilter
|
||||
}
|
||||
|
||||
input PermissionUpdateManyMutationInput {
|
||||
name: StringFieldUpdateOperationsInput
|
||||
createdAt: DateTimeFieldUpdateOperationsInput
|
||||
updatedAt: DateTimeFieldUpdateOperationsInput
|
||||
}
|
||||
|
||||
input RoleUpdateToOneWithWhereWithoutUserInput {
|
||||
where: RoleWhereInput
|
||||
data: RoleUpdateWithoutUserInput!
|
||||
}
|
||||
|
||||
input UsersRolesUpdateWithWhereUniqueWithoutUserInput {
|
||||
where: UsersRolesWhereUniqueInput!
|
||||
data: UsersRolesUpdateWithoutUserInput!
|
||||
}
|
||||
|
||||
input UsersRolesUpdateManyWithWhereWithoutUserInput {
|
||||
where: UsersRolesScalarWhereInput!
|
||||
data: UsersRolesUpdateManyMutationInput!
|
||||
}
|
||||
|
||||
input UsersRolesScalarWhereInput {
|
||||
AND: [UsersRolesScalarWhereInput!]
|
||||
OR: [UsersRolesScalarWhereInput!]
|
||||
NOT: [UsersRolesScalarWhereInput!]
|
||||
userId: IntFilter
|
||||
roleId: IntFilter
|
||||
assignedAt: DateTimeFilter
|
||||
assignedBy: StringFilter
|
||||
}
|
||||
|
||||
input UsersRolesUpdateManyMutationInput {
|
||||
assignedAt: DateTimeFieldUpdateOperationsInput
|
||||
assignedBy: StringFieldUpdateOperationsInput
|
||||
}
|
||||
|
||||
input ProductUpdateManyWithoutAuthorNestedInput {
|
||||
create: [ProductCreateWithoutAuthorInput!]
|
||||
connectOrCreate: [ProductCreateOrConnectWithoutAuthorInput!]
|
||||
upsert: [ProductUpsertWithWhereUniqueWithoutAuthorInput!]
|
||||
set: [ProductWhereUniqueInput!]
|
||||
disconnect: [ProductWhereUniqueInput!]
|
||||
delete: [ProductWhereUniqueInput!]
|
||||
connect: [ProductWhereUniqueInput!]
|
||||
update: [ProductUpdateWithWhereUniqueWithoutAuthorInput!]
|
||||
updateMany: [ProductUpdateManyWithWhereWithoutAuthorInput!]
|
||||
deleteMany: [ProductScalarWhereInput!]
|
||||
}
|
||||
|
||||
input ProductUpsertWithWhereUniqueWithoutAuthorInput {
|
||||
where: ProductWhereUniqueInput!
|
||||
update: ProductUpdateWithoutAuthorInput!
|
||||
create: ProductCreateWithoutAuthorInput!
|
||||
}
|
||||
|
||||
input ProductUpdateWithoutAuthorInput {
|
||||
id: StringFieldUpdateOperationsInput
|
||||
createdAt: DateTimeFieldUpdateOperationsInput
|
||||
updatedAt: DateTimeFieldUpdateOperationsInput
|
||||
title: StringFieldUpdateOperationsInput
|
||||
published: BoolFieldUpdateOperationsInput
|
||||
}
|
||||
|
||||
input BoolFieldUpdateOperationsInput {
|
||||
set: Boolean
|
||||
}
|
||||
|
||||
input ProductUpdateWithWhereUniqueWithoutAuthorInput {
|
||||
where: ProductWhereUniqueInput!
|
||||
data: ProductUpdateWithoutAuthorInput!
|
||||
}
|
||||
|
||||
input ProductUpdateManyWithWhereWithoutAuthorInput {
|
||||
where: ProductScalarWhereInput!
|
||||
data: ProductUpdateManyMutationInput!
|
||||
}
|
||||
|
||||
input ProductScalarWhereInput {
|
||||
AND: [ProductScalarWhereInput!]
|
||||
OR: [ProductScalarWhereInput!]
|
||||
NOT: [ProductScalarWhereInput!]
|
||||
id: StringFilter
|
||||
createdAt: DateTimeFilter
|
||||
updatedAt: DateTimeFilter
|
||||
title: StringFilter
|
||||
published: BoolFilter
|
||||
authorId: IntFilter
|
||||
}
|
||||
|
||||
input ProductUpdateManyMutationInput {
|
||||
id: StringFieldUpdateOperationsInput
|
||||
createdAt: DateTimeFieldUpdateOperationsInput
|
||||
updatedAt: DateTimeFieldUpdateOperationsInput
|
||||
title: StringFieldUpdateOperationsInput
|
||||
published: BoolFieldUpdateOperationsInput
|
||||
}
|
||||
|
||||
input RoleCreateInput {
|
||||
name: String!
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
permission: PermissionCreateNestedManyWithoutRoleInput
|
||||
user: UsersRolesCreateNestedManyWithoutRoleInput
|
||||
}
|
||||
|
||||
input UsersRolesCreateNestedManyWithoutRoleInput {
|
||||
create: [UsersRolesCreateWithoutRoleInput!]
|
||||
connectOrCreate: [UsersRolesCreateOrConnectWithoutRoleInput!]
|
||||
connect: [UsersRolesWhereUniqueInput!]
|
||||
}
|
||||
|
||||
input UsersRolesCreateWithoutRoleInput {
|
||||
assignedAt: Timestamp
|
||||
assignedBy: String!
|
||||
user: UserCreateNestedOneWithoutRoleInput!
|
||||
}
|
||||
|
||||
input UserCreateNestedOneWithoutRoleInput {
|
||||
create: UserCreateWithoutRoleInput
|
||||
connectOrCreate: UserCreateOrConnectWithoutRoleInput
|
||||
connect: UserWhereUniqueInput
|
||||
}
|
||||
|
||||
input UserCreateWithoutRoleInput {
|
||||
email: String!
|
||||
password: String!
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
product: ProductCreateNestedManyWithoutAuthorInput
|
||||
}
|
||||
|
||||
input UserCreateOrConnectWithoutRoleInput {
|
||||
where: UserWhereUniqueInput!
|
||||
create: UserCreateWithoutRoleInput!
|
||||
}
|
||||
|
||||
input UsersRolesCreateOrConnectWithoutRoleInput {
|
||||
where: UsersRolesWhereUniqueInput!
|
||||
create: UsersRolesCreateWithoutRoleInput!
|
||||
}
|
||||
|
||||
input RoleUpdateManyMutationInput {
|
||||
name: StringFieldUpdateOperationsInput
|
||||
createdAt: DateTimeFieldUpdateOperationsInput
|
||||
updatedAt: DateTimeFieldUpdateOperationsInput
|
||||
}
|
||||
|
||||
input RoleUpdateInput {
|
||||
name: StringFieldUpdateOperationsInput
|
||||
createdAt: DateTimeFieldUpdateOperationsInput
|
||||
updatedAt: DateTimeFieldUpdateOperationsInput
|
||||
permission: PermissionUpdateManyWithoutRoleNestedInput
|
||||
user: UsersRolesUpdateManyWithoutRoleNestedInput
|
||||
}
|
||||
|
||||
input UsersRolesUpdateManyWithoutRoleNestedInput {
|
||||
create: [UsersRolesCreateWithoutRoleInput!]
|
||||
connectOrCreate: [UsersRolesCreateOrConnectWithoutRoleInput!]
|
||||
upsert: [UsersRolesUpsertWithWhereUniqueWithoutRoleInput!]
|
||||
set: [UsersRolesWhereUniqueInput!]
|
||||
disconnect: [UsersRolesWhereUniqueInput!]
|
||||
delete: [UsersRolesWhereUniqueInput!]
|
||||
connect: [UsersRolesWhereUniqueInput!]
|
||||
update: [UsersRolesUpdateWithWhereUniqueWithoutRoleInput!]
|
||||
updateMany: [UsersRolesUpdateManyWithWhereWithoutRoleInput!]
|
||||
deleteMany: [UsersRolesScalarWhereInput!]
|
||||
}
|
||||
|
||||
input UsersRolesUpsertWithWhereUniqueWithoutRoleInput {
|
||||
where: UsersRolesWhereUniqueInput!
|
||||
update: UsersRolesUpdateWithoutRoleInput!
|
||||
create: UsersRolesCreateWithoutRoleInput!
|
||||
}
|
||||
|
||||
input UsersRolesUpdateWithoutRoleInput {
|
||||
assignedAt: DateTimeFieldUpdateOperationsInput
|
||||
assignedBy: StringFieldUpdateOperationsInput
|
||||
user: UserUpdateOneRequiredWithoutRoleNestedInput
|
||||
}
|
||||
|
||||
input UserUpdateOneRequiredWithoutRoleNestedInput {
|
||||
create: UserCreateWithoutRoleInput
|
||||
connectOrCreate: UserCreateOrConnectWithoutRoleInput
|
||||
upsert: UserUpsertWithoutRoleInput
|
||||
connect: UserWhereUniqueInput
|
||||
update: UserUpdateToOneWithWhereWithoutRoleInput
|
||||
}
|
||||
|
||||
input UserUpsertWithoutRoleInput {
|
||||
update: UserUpdateWithoutRoleInput!
|
||||
create: UserCreateWithoutRoleInput!
|
||||
where: UserWhereInput
|
||||
}
|
||||
|
||||
input UserUpdateWithoutRoleInput {
|
||||
email: StringFieldUpdateOperationsInput
|
||||
password: StringFieldUpdateOperationsInput
|
||||
createdAt: DateTimeFieldUpdateOperationsInput
|
||||
updatedAt: DateTimeFieldUpdateOperationsInput
|
||||
product: ProductUpdateManyWithoutAuthorNestedInput
|
||||
}
|
||||
|
||||
input UserUpdateToOneWithWhereWithoutRoleInput {
|
||||
where: UserWhereInput
|
||||
data: UserUpdateWithoutRoleInput!
|
||||
}
|
||||
|
||||
input UsersRolesUpdateWithWhereUniqueWithoutRoleInput {
|
||||
where: UsersRolesWhereUniqueInput!
|
||||
data: UsersRolesUpdateWithoutRoleInput!
|
||||
}
|
||||
|
||||
input UsersRolesUpdateManyWithWhereWithoutRoleInput {
|
||||
where: UsersRolesScalarWhereInput!
|
||||
data: UsersRolesUpdateManyMutationInput!
|
||||
}
|
||||
|
||||
input PermissionCreateInput {
|
||||
name: String!
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
role: RoleCreateNestedOneWithoutPermissionInput!
|
||||
}
|
||||
|
||||
input RoleCreateNestedOneWithoutPermissionInput {
|
||||
create: RoleCreateWithoutPermissionInput
|
||||
connectOrCreate: RoleCreateOrConnectWithoutPermissionInput
|
||||
connect: RoleWhereUniqueInput
|
||||
}
|
||||
|
||||
input RoleCreateWithoutPermissionInput {
|
||||
name: String!
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
user: UsersRolesCreateNestedManyWithoutRoleInput
|
||||
}
|
||||
|
||||
input RoleCreateOrConnectWithoutPermissionInput {
|
||||
where: RoleWhereUniqueInput!
|
||||
create: RoleCreateWithoutPermissionInput!
|
||||
}
|
||||
|
||||
input PermissionUpdateInput {
|
||||
name: StringFieldUpdateOperationsInput
|
||||
createdAt: DateTimeFieldUpdateOperationsInput
|
||||
updatedAt: DateTimeFieldUpdateOperationsInput
|
||||
role: RoleUpdateOneRequiredWithoutPermissionNestedInput
|
||||
}
|
||||
|
||||
input RoleUpdateOneRequiredWithoutPermissionNestedInput {
|
||||
create: RoleCreateWithoutPermissionInput
|
||||
connectOrCreate: RoleCreateOrConnectWithoutPermissionInput
|
||||
upsert: RoleUpsertWithoutPermissionInput
|
||||
connect: RoleWhereUniqueInput
|
||||
update: RoleUpdateToOneWithWhereWithoutPermissionInput
|
||||
}
|
||||
|
||||
input RoleUpsertWithoutPermissionInput {
|
||||
update: RoleUpdateWithoutPermissionInput!
|
||||
create: RoleCreateWithoutPermissionInput!
|
||||
where: RoleWhereInput
|
||||
}
|
||||
|
||||
input RoleUpdateWithoutPermissionInput {
|
||||
name: StringFieldUpdateOperationsInput
|
||||
createdAt: DateTimeFieldUpdateOperationsInput
|
||||
updatedAt: DateTimeFieldUpdateOperationsInput
|
||||
user: UsersRolesUpdateManyWithoutRoleNestedInput
|
||||
}
|
||||
|
||||
input RoleUpdateToOneWithWhereWithoutPermissionInput {
|
||||
where: RoleWhereInput
|
||||
data: RoleUpdateWithoutPermissionInput!
|
||||
}
|
||||
|
||||
input ProductCreateInput {
|
||||
id: String
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
title: String!
|
||||
published: Boolean
|
||||
author: UserCreateNestedOneWithoutProductInput!
|
||||
}
|
||||
|
||||
input UserCreateNestedOneWithoutProductInput {
|
||||
create: UserCreateWithoutProductInput
|
||||
connectOrCreate: UserCreateOrConnectWithoutProductInput
|
||||
connect: UserWhereUniqueInput
|
||||
}
|
||||
|
||||
input UserCreateWithoutProductInput {
|
||||
email: String!
|
||||
password: String!
|
||||
createdAt: Timestamp
|
||||
updatedAt: Timestamp
|
||||
role: UsersRolesCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
input UserCreateOrConnectWithoutProductInput {
|
||||
where: UserWhereUniqueInput!
|
||||
create: UserCreateWithoutProductInput!
|
||||
}
|
||||
|
||||
input ProductUpdateInput {
|
||||
id: StringFieldUpdateOperationsInput
|
||||
createdAt: DateTimeFieldUpdateOperationsInput
|
||||
updatedAt: DateTimeFieldUpdateOperationsInput
|
||||
title: StringFieldUpdateOperationsInput
|
||||
published: BoolFieldUpdateOperationsInput
|
||||
author: UserUpdateOneRequiredWithoutProductNestedInput
|
||||
}
|
||||
|
||||
input UserUpdateOneRequiredWithoutProductNestedInput {
|
||||
create: UserCreateWithoutProductInput
|
||||
connectOrCreate: UserCreateOrConnectWithoutProductInput
|
||||
upsert: UserUpsertWithoutProductInput
|
||||
connect: UserWhereUniqueInput
|
||||
update: UserUpdateToOneWithWhereWithoutProductInput
|
||||
}
|
||||
|
||||
input UserUpsertWithoutProductInput {
|
||||
update: UserUpdateWithoutProductInput!
|
||||
create: UserCreateWithoutProductInput!
|
||||
where: UserWhereInput
|
||||
}
|
||||
|
||||
input UserUpdateWithoutProductInput {
|
||||
email: StringFieldUpdateOperationsInput
|
||||
password: StringFieldUpdateOperationsInput
|
||||
createdAt: DateTimeFieldUpdateOperationsInput
|
||||
updatedAt: DateTimeFieldUpdateOperationsInput
|
||||
role: UsersRolesUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
input UserUpdateToOneWithWhereWithoutProductInput {
|
||||
where: UserWhereInput
|
||||
data: UserUpdateWithoutProductInput!
|
||||
}
|
28
test/app.e2e-spec.ts
Normal file
28
test/app.e2e-spec.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import * as request from 'supertest';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { AppModule } from './../src/app.module';
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
|
||||
describe('AppController (e2e)', () => {
|
||||
let app: INestApplication;
|
||||
|
||||
beforeAll(async () => {
|
||||
const moduleFixture = await Test.createTestingModule({
|
||||
imports: [AppModule],
|
||||
}).compile();
|
||||
|
||||
app = moduleFixture.createNestApplication();
|
||||
await app.init();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await app.close();
|
||||
});
|
||||
|
||||
it('/ (GET)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/')
|
||||
.expect(200)
|
||||
.expect('Hello World!');
|
||||
});
|
||||
});
|
9
test/jest-e2e.json
Normal file
9
test/jest-e2e.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"moduleFileExtensions": ["js", "json", "ts"],
|
||||
"rootDir": ".",
|
||||
"testEnvironment": "node",
|
||||
"testRegex": "\\.e2e-spec\\.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
}
|
||||
}
|
4
tsconfig.build.json
Normal file
4
tsconfig.build.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
|
||||
}
|
16
tsconfig.json
Normal file
16
tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"declaration": true,
|
||||
"removeComments": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"target": "ES2021",
|
||||
"sourceMap": true,
|
||||
"outDir": "./dist",
|
||||
"baseUrl": "./",
|
||||
"incremental": true,
|
||||
"skipLibCheck": true
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user