Merge branch 'feature/auth-configure' of https://github.com/IT-Lab-KubSU/platform into feature/auth-configure

feature/auth-configure
AlexBarmen 1 year ago
commit 327767169b

@ -1,4 +1,6 @@
import { Global, Module } from "@nestjs/common";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { PrismaService } from "./service/prisma.service";
@Global()

@ -1,8 +1,8 @@
import { INestApplication, Injectable, OnModuleInit } from "@nestjs/common";
import { PrismaClient } from "@prisma/client";
import { AuthClient } from "@platform/prisma-clients";
@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
export class PrismaService extends AuthClient implements OnModuleInit {
async onModuleInit() {
await this.$connect();
}

@ -1,5 +1,5 @@
import { Body, Controller, HttpCode, Inject, Post, UseInterceptors } from "@nestjs/common";
import { EmailFindUniqueArgs, EmailFindFirstArgs, EmailFindManyArgs, EmailUpdateArgs, EmailCountArgs, EmailCreateArgs, EmailDeleteArgs, Email } from "@platform/prisma-clients/user-data";
import { Prisma, Email } from "@platform/prisma-clients/user-data";
import { EmailService } from "./service/email.service";
import { PrismaErrorInterceptor } from "../prisma/interceptor/prisma-error.interceptor";
@ -11,43 +11,43 @@ export class EmailController {
@Post("find/unique")
@HttpCode(200)
async FindUnique(@Body() emailFindUniqueArgs: EmailFindUniqueArgs): Promise<Partial<Email> | null> {
async FindUnique(@Body() emailFindUniqueArgs: Prisma.EmailFindUniqueArgs): Promise<Partial<Email> | null> {
return await this.email.FindUnique(emailFindUniqueArgs);
}
@Post("find/first")
@HttpCode(200)
async FindFirst(@Body() emailFindFirstArgs: EmailFindFirstArgs): Promise<Partial<Email> | null> {
async FindFirst(@Body() emailFindFirstArgs: Prisma.EmailFindFirstArgs): Promise<Partial<Email> | null> {
return await this.email.FindFirst(emailFindFirstArgs);
}
@Post("find/many")
@HttpCode(200)
async FindMany(@Body() emailFindManyArgs: EmailFindManyArgs): Promise<Partial<Email>[]> {
async FindMany(@Body() emailFindManyArgs: Prisma.EmailFindManyArgs): Promise<Partial<Email>[]> {
return await this.email.FindMany(emailFindManyArgs);
}
@Post("update")
@HttpCode(200)
async Update(@Body() emailUpdateArgs: EmailUpdateArgs): Promise<Partial<Email>> {
async Update(@Body() emailUpdateArgs: Prisma.EmailUpdateArgs): Promise<Partial<Email>> {
return await this.email.Update(emailUpdateArgs);
}
@Post("count")
@HttpCode(200)
async Count(@Body() emailCountArgs: EmailCountArgs): Promise<number> {
async Count(@Body() emailCountArgs: Prisma.EmailCountArgs): Promise<number> {
return await this.email.Count(emailCountArgs);
}
@Post("create")
@HttpCode(200)
async Create(@Body() emailCreateArgs: EmailCreateArgs): Promise<Partial<Email>> {
async Create(@Body() emailCreateArgs: Prisma.EmailCreateArgs): Promise<Partial<Email>> {
return await this.email.Create(emailCreateArgs);
}
@Post("delete")
@HttpCode(200)
async Delete(@Body() emailDeleteArgs: EmailDeleteArgs): Promise<Partial<Email>> {
async Delete(@Body() emailDeleteArgs: Prisma.EmailDeleteArgs): Promise<Partial<Email>> {
return await this.email.Delete(emailDeleteArgs);
}
}

@ -1,10 +1,6 @@
import { Inject, Injectable } from "@nestjs/common";
import { PrismaService } from '../../prisma/service/prisma.service';
import { UserDataClient as Prisma } from "@platform/prisma-clients";
import { Email, EmailFindUniqueArgs,
EmailFindFirstArgs, EmailFindManyArgs, EmailUpdateArgs,
EmailCountArgs, EmailCreateArgs, EmailDeleteArgs
} from "@platform/prisma-clients/user-data";
import { Email, Prisma } from "@platform/prisma-clients/user-data";
import { PrismaClientKnownRequestError } from "@prisma/client/runtime";
import { UniqueConstraintFailedError } from "../../prisma/error/unique-constraint-failed.error";
import { RecordNotFoundError } from "../../prisma/error/record-not-found.error";
@ -14,19 +10,19 @@ export class EmailService {
constructor(@Inject(PrismaService) private prisma: PrismaService) {
}
async FindUnique(emailFindUniqueArgs: EmailFindUniqueArgs): Promise<Partial<Email> | null> {
async FindUnique(emailFindUniqueArgs: Prisma.EmailFindUniqueArgs): Promise<Partial<Email> | null> {
return await this.prisma.email.findUnique(emailFindUniqueArgs);
}
async FindFirst(emailFindFirstArgs: EmailFindFirstArgs): Promise<Partial<Email> | null> {
async FindFirst(emailFindFirstArgs: Prisma.EmailFindFirstArgs): Promise<Partial<Email> | null> {
return await this.prisma.email.findFirst(emailFindFirstArgs);
}
async FindMany(emailFindManyArgs: EmailFindManyArgs): Promise<Partial<Email>[]> {
async FindMany(emailFindManyArgs: Prisma.EmailFindManyArgs): Promise<Partial<Email>[]> {
return await this.prisma.email.findMany(emailFindManyArgs);
}
async Update(emailUpdateArgs: EmailUpdateArgs): Promise<Partial<Email>> {
async Update(emailUpdateArgs: Prisma.EmailUpdateArgs): Promise<Partial<Email>> {
try {
return await this.prisma.email.update(emailUpdateArgs);
} catch (e) {
@ -38,11 +34,11 @@ export class EmailService {
}
}
async Count(emailCountArgs: EmailCountArgs): Promise<number> {
async Count(emailCountArgs: Prisma.EmailCountArgs): Promise<number> {
return await this.prisma.email.count(emailCountArgs);
}
async Create(emailCreateArgs: EmailCreateArgs): Promise<Partial<Email>> {
async Create(emailCreateArgs: Prisma.EmailCreateArgs): Promise<Partial<Email>> {
try {
return await this.prisma.email.create(emailCreateArgs);
} catch (e) {
@ -53,7 +49,7 @@ export class EmailService {
}
}
async Delete(emailDeleteArgs: EmailDeleteArgs): Promise<Partial<Email>> {
async Delete(emailDeleteArgs: Prisma.EmailDeleteArgs): Promise<Partial<Email>> {
try {
return await this.prisma.email.delete(emailDeleteArgs);
} catch (e) {

@ -1,9 +1,5 @@
import { Body, Controller, HttpCode, Inject, Post, UseInterceptors } from "@nestjs/common";
import { UserDataClient as Prisma } from "@platform/prisma-clients";
import { PhoneNumber, PhoneNumberFindUniqueArgs,
PhoneNumberFindFirstArgs, PhoneNumberFindManyArgs, PhoneNumberUpdateArgs,
PhoneNumberCountArgs, PhoneNumberCreateArgs, PhoneNumberDeleteArgs
} from "@platform/prisma-clients/user-data";
import { PhoneNumber, Prisma } from "@platform/prisma-clients/user-data";
import { PhoneNumberService } from "./service/phone-number.service";
import { PrismaErrorInterceptor } from "../prisma/interceptor/prisma-error.interceptor";
@ -15,43 +11,43 @@ export class PhoneNumberController {
@Post("find/unique")
@HttpCode(200)
async FindUnique(@Body() phoneNumberFindUniqueArgs: PhoneNumberFindUniqueArgs): Promise<Partial<PhoneNumber> | null> {
async FindUnique(@Body() phoneNumberFindUniqueArgs: Prisma.PhoneNumberFindUniqueArgs): Promise<Partial<PhoneNumber> | null> {
return await this.phoneNumber.FindUnique(phoneNumberFindUniqueArgs);
}
@Post("find/first")
@HttpCode(200)
async FindFirst(@Body() phoneNumberFindFirstArgs: PhoneNumberFindFirstArgs): Promise<Partial<PhoneNumber> | null> {
async FindFirst(@Body() phoneNumberFindFirstArgs: Prisma.PhoneNumberFindFirstArgs): Promise<Partial<PhoneNumber> | null> {
return await this.phoneNumber.FindFirst(phoneNumberFindFirstArgs);
}
@Post("find/many")
@HttpCode(200)
async FindMany(@Body() phoneNumberFindManyArgs: PhoneNumberFindManyArgs): Promise<Partial<PhoneNumber>[]> {
async FindMany(@Body() phoneNumberFindManyArgs: Prisma.PhoneNumberFindManyArgs): Promise<Partial<PhoneNumber>[]> {
return await this.phoneNumber.FindMany(phoneNumberFindManyArgs);
}
@Post("update")
@HttpCode(200)
async Update(@Body() phoneNumberUpdateArgs: PhoneNumberUpdateArgs): Promise<Partial<PhoneNumber>> {
async Update(@Body() phoneNumberUpdateArgs: Prisma.PhoneNumberUpdateArgs): Promise<Partial<PhoneNumber>> {
return await this.phoneNumber.Update(phoneNumberUpdateArgs);
}
@Post("count")
@HttpCode(200)
async Count(@Body() phoneNumberCountArgs: PhoneNumberCountArgs): Promise<number> {
async Count(@Body() phoneNumberCountArgs: Prisma.PhoneNumberCountArgs): Promise<number> {
return await this.phoneNumber.Count(phoneNumberCountArgs);
}
@Post("create")
@HttpCode(200)
async Create(@Body() phoneNumberCreateArgs: PhoneNumberCreateArgs): Promise<Partial<PhoneNumber>> {
async Create(@Body() phoneNumberCreateArgs: Prisma.PhoneNumberCreateArgs): Promise<Partial<PhoneNumber>> {
return await this.phoneNumber.Create(phoneNumberCreateArgs);
}
@Post("delete")
@HttpCode(200)
async Delete(@Body() phoneNumberDeleteArgs: PhoneNumberDeleteArgs): Promise<Partial<PhoneNumber>> {
async Delete(@Body() phoneNumberDeleteArgs: Prisma.PhoneNumberDeleteArgs): Promise<Partial<PhoneNumber>> {
return await this.phoneNumber.Delete(phoneNumberDeleteArgs);
}
}

@ -1,9 +1,6 @@
import { Inject, Injectable } from "@nestjs/common";
import { PrismaService } from "../../prisma/service/prisma.service";
import { PhoneNumber, PhoneNumberFindUniqueArgs,
PhoneNumberFindFirstArgs, PhoneNumberFindManyArgs, PhoneNumberUpdateArgs,
PhoneNumberCountArgs, PhoneNumberCreateArgs, PhoneNumberDeleteArgs
} from "@platform/prisma-clients/user-data";
import { PhoneNumber, Prisma } from "@platform/prisma-clients/user-data";
import { PrismaClientKnownRequestError } from "@prisma/client/runtime";
import { UniqueConstraintFailedError } from "../../prisma/error/unique-constraint-failed.error";
import { RecordNotFoundError } from "../../prisma/error/record-not-found.error";
@ -13,19 +10,19 @@ export class PhoneNumberService {
constructor(@Inject(PrismaService) private prisma: PrismaService) {
}
async FindUnique(phoneNumberFindUniqueArgs: PhoneNumberFindUniqueArgs): Promise<Partial<PhoneNumber> | null> {
async FindUnique(phoneNumberFindUniqueArgs: Prisma.PhoneNumberFindUniqueArgs): Promise<Partial<PhoneNumber> | null> {
return await this.prisma.phoneNumber.findUnique(phoneNumberFindUniqueArgs);
}
async FindFirst(phoneNumberFindFirstArgs: PhoneNumberFindFirstArgs): Promise<Partial<PhoneNumber> | null> {
async FindFirst(phoneNumberFindFirstArgs: Prisma.PhoneNumberFindFirstArgs): Promise<Partial<PhoneNumber> | null> {
return await this.prisma.phoneNumber.findFirst(phoneNumberFindFirstArgs);
}
async FindMany(phoneNumberFindManyArgs: PhoneNumberFindManyArgs): Promise<Partial<PhoneNumber>[]> {
async FindMany(phoneNumberFindManyArgs: Prisma.PhoneNumberFindManyArgs): Promise<Partial<PhoneNumber>[]> {
return await this.prisma.phoneNumber.findMany(phoneNumberFindManyArgs);
}
async Update(phoneNumberUpdateArgs: PhoneNumberUpdateArgs): Promise<Partial<PhoneNumber>> {
async Update(phoneNumberUpdateArgs: Prisma.PhoneNumberUpdateArgs): Promise<Partial<PhoneNumber>> {
try {
return await this.prisma.phoneNumber.update(phoneNumberUpdateArgs);
} catch (e) {
@ -37,11 +34,11 @@ export class PhoneNumberService {
}
}
async Count(phoneNumberCountArgs: PhoneNumberCountArgs): Promise<number> {
async Count(phoneNumberCountArgs: Prisma.PhoneNumberCountArgs): Promise<number> {
return await this.prisma.phoneNumber.count(phoneNumberCountArgs);
}
async Create(phoneNumberCreateArgs: PhoneNumberCreateArgs): Promise<Partial<PhoneNumber>> {
async Create(phoneNumberCreateArgs: Prisma.PhoneNumberCreateArgs): Promise<Partial<PhoneNumber>> {
try {
return await this.prisma.phoneNumber.create(phoneNumberCreateArgs);
} catch (e) {
@ -52,7 +49,7 @@ export class PhoneNumberService {
}
}
async Delete(phoneNumberDeleteArgs: PhoneNumberDeleteArgs): Promise<Partial<PhoneNumber>> {
async Delete(phoneNumberDeleteArgs: Prisma.PhoneNumberDeleteArgs): Promise<Partial<PhoneNumber>> {
try {
return await this.prisma.phoneNumber.delete(phoneNumberDeleteArgs);
} catch (e) {

@ -1,9 +1,6 @@
import { Inject, Injectable } from "@nestjs/common";
import { PrismaService } from "../../prisma/service/prisma.service";
import { User, UserFindUniqueArgs,
UserFindUniqueArgs, UserFindFirstArgs, UserFindManyArgs,
UserUpdateArgs, UserCountArgs, UserCreateArgs, UserDeleteArgs
} from "@platform/prisma-clients/user-data";
import { User, Prisma } from "@platform/prisma-clients/user-data";
import { PrismaClientKnownRequestError } from "@prisma/client/runtime";
import { UniqueConstraintFailedError } from "../../prisma/error/unique-constraint-failed.error";
import { RecordNotFoundError } from "../../prisma/error/record-not-found.error";
@ -13,19 +10,19 @@ export class UserService {
constructor(@Inject(PrismaService) private prisma: PrismaService) {
}
async FindUnique(userFindUniqueArgs: UserFindUniqueArgs): Promise<Partial<User> | null> {
async FindUnique(userFindUniqueArgs: Prisma.UserFindUniqueArgs): Promise<Partial<User> | null> {
return await this.prisma.user.findUnique(userFindUniqueArgs);
}
async FindFirst(userFindFirstArgs: UserFindFirstArgs): Promise<Partial<User> | null> {
async FindFirst(userFindFirstArgs: Prisma.UserFindFirstArgs): Promise<Partial<User> | null> {
return await this.prisma.user.findFirst(userFindFirstArgs);
}
async FindMany(userFindManyArgs: UserFindManyArgs): Promise<Partial<User>[]> {
async FindMany(userFindManyArgs: Prisma.UserFindManyArgs): Promise<Partial<User>[]> {
return await this.prisma.user.findMany(userFindManyArgs);
}
async Update(userUpdateArgs: UserUpdateArgs): Promise<Partial<User>> {
async Update(userUpdateArgs: Prisma.UserUpdateArgs): Promise<Partial<User>> {
try {
return await this.prisma.user.update(userUpdateArgs);
} catch (e) {
@ -37,11 +34,11 @@ export class UserService {
}
}
async Count(userCountArgs: UserCountArgs): Promise<number> {
async Count(userCountArgs: Prisma.UserCountArgs): Promise<number> {
return await this.prisma.user.count(userCountArgs);
}
async Create(userCreateArgs: UserCreateArgs): Promise<Partial<User>> {
async Create(userCreateArgs: Prisma.UserCreateArgs): Promise<Partial<User>> {
try {
return await this.prisma.user.create(userCreateArgs);
} catch (e) {
@ -52,7 +49,7 @@ export class UserService {
}
}
async Delete(userDeleteArgs: UserDeleteArgs): Promise<Partial<User>> {
async Delete(userDeleteArgs: Prisma.UserDeleteArgs): Promise<Partial<User>> {
try {
return await this.prisma.user.delete(userDeleteArgs);
} catch (e) {

@ -1,8 +1,5 @@
import { Body, Controller, HttpCode, Inject, Post, UseInterceptors } from "@nestjs/common";
import { User, UserFindUniqueArgs,
UserFindUniqueArgs, UserFindFirstArgs, UserFindManyArgs,
UserUpdateArgs, UserCountArgs, UserCreateArgs, UserDeleteArgs
} from "@platform/prisma-clients/user-data";
import { User, Prisma } from "@platform/prisma-clients/user-data";
import { UserService } from "./service/user.service";
import { PrismaErrorInterceptor } from "../prisma/interceptor/prisma-error.interceptor";
@ -14,43 +11,43 @@ export class UserController {
@Post("find/unique")
@HttpCode(200)
async FindUnique(@Body() userFindUniqueArgs: UserFindUniqueArgs): Promise<Partial<User> | null> {
async FindUnique(@Body() userFindUniqueArgs: Prisma.UserFindUniqueArgs): Promise<Partial<User> | null> {
return await this.user.FindUnique(userFindUniqueArgs);
}
@Post("find/first")
@HttpCode(200)
async FindFirst(@Body() userFindFirstArgs: UserFindFirstArgs): Promise<Partial<User> | null> {
async FindFirst(@Body() userFindFirstArgs: Prisma.UserFindFirstArgs): Promise<Partial<User> | null> {
return await this.user.FindFirst(userFindFirstArgs);
}
@Post("find/many")
@HttpCode(200)
async FindMany(@Body() userFindManyArgs: UserFindManyArgs): Promise<Partial<User>[]> {
async FindMany(@Body() userFindManyArgs: Prisma.UserFindManyArgs): Promise<Partial<User>[]> {
return await this.user.FindMany(userFindManyArgs);
}
@Post("update")
@HttpCode(200)
async Update(@Body() userUpdateArgs: UserUpdateArgs): Promise<Partial<User>> {
async Update(@Body() userUpdateArgs: Prisma.UserUpdateArgs): Promise<Partial<User>> {
return await this.user.Update(userUpdateArgs);
}
@Post("count")
@HttpCode(200)
async Count(@Body() userCountArgs: UserCountArgs): Promise<number> {
async Count(@Body() userCountArgs: Prisma.UserCountArgs): Promise<number> {
return await this.user.Count(userCountArgs);
}
@Post("create")
@HttpCode(200)
async Create(@Body() userCreateArgs: UserCreateArgs): Promise<Partial<User>> {
async Create(@Body() userCreateArgs: Prisma.UserCreateArgs): Promise<Partial<User>> {
return await this.user.Create(userCreateArgs);
}
@Post("delete")
@HttpCode(200)
async Delete(@Body() userDeleteArgs: UserDeleteArgs): Promise<Partial<User>> {
async Delete(@Body() userDeleteArgs: Prisma.UserDeleteArgs): Promise<Partial<User>> {
return await this.user.Delete(userDeleteArgs);
}
}

Loading…
Cancel
Save