Remove hasura and hasura-auth (#134)
* Remove hasura and hasura-auth * Move all models to prisma * Start implementing graphql * chore: clean package json * chore: make the code build * chore: get initial graphql.tsx file * feature: use typegql as qgl server * refactor: small refactoring * refactor: clean tests * bugfix: make all filters not case sensitive * chore: remove unused imports --------- Co-authored-by: Sammy Teillet <sammy.teillet@gmail.com>
This commit is contained in:
10
server/src/entities/company/company.module.ts
Normal file
10
server/src/entities/company/company.module.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { CompanyRepository } from './company.repository';
|
||||
import { PrismaModule } from 'src/database/prisma.module';
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule],
|
||||
providers: [CompanyRepository],
|
||||
exports: [CompanyRepository]
|
||||
})
|
||||
export class CompanyModule {}
|
||||
25
server/src/entities/company/company.repository.ts
Normal file
25
server/src/entities/company/company.repository.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Company, Prisma } from '@prisma/client';
|
||||
import { PrismaService } from 'src/database/prisma.service';
|
||||
|
||||
@Injectable()
|
||||
export class CompanyRepository {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
async findMany(params: {
|
||||
skip?: number;
|
||||
take?: number;
|
||||
cursor?: Prisma.CompanyWhereUniqueInput;
|
||||
where?: Prisma.CompanyWhereInput;
|
||||
orderBy?: Prisma.CompanyOrderByWithRelationInput;
|
||||
}): Promise<Company[]> {
|
||||
const { skip, take, cursor, where, orderBy } = params;
|
||||
return this.prisma.company.findMany({ skip, take, cursor, where, orderBy });
|
||||
}
|
||||
|
||||
async findOne(id: string | null) {
|
||||
if (id === null) return null;
|
||||
const company = await this.prisma.company.findUnique({ where: { id } });
|
||||
return company;
|
||||
}
|
||||
}
|
||||
10
server/src/entities/person/person.module.ts
Normal file
10
server/src/entities/person/person.module.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { PersonRepository } from './person.repository';
|
||||
import { PrismaModule } from 'src/database/prisma.module';
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule],
|
||||
providers: [PersonRepository],
|
||||
exports: [PersonRepository]
|
||||
})
|
||||
export class PersonModule {}
|
||||
19
server/src/entities/person/person.repository.ts
Normal file
19
server/src/entities/person/person.repository.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Person, Prisma } from '@prisma/client';
|
||||
import { PrismaService } from 'src/database/prisma.service';
|
||||
|
||||
@Injectable()
|
||||
export class PersonRepository {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
async findMany(params: {
|
||||
skip?: number;
|
||||
take?: number;
|
||||
cursor?: Prisma.PersonWhereUniqueInput;
|
||||
where?: Prisma.PersonWhereInput;
|
||||
orderBy?: Prisma.PersonOrderByWithRelationInput;
|
||||
}): Promise<Person[]> {
|
||||
const { skip, take, cursor, where, orderBy } = params;
|
||||
return this.prisma.person.findMany({ skip, take, cursor, where, orderBy });
|
||||
}
|
||||
}
|
||||
10
server/src/entities/user/user.module.ts
Normal file
10
server/src/entities/user/user.module.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { UserRepository } from './user.repository';
|
||||
import { PrismaModule } from 'src/database/prisma.module';
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule],
|
||||
providers: [UserRepository],
|
||||
exports: [UserRepository]
|
||||
})
|
||||
export class UserModule {}
|
||||
19
server/src/entities/user/user.repository.ts
Normal file
19
server/src/entities/user/user.repository.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { User, Prisma } from '@prisma/client';
|
||||
import { PrismaService } from 'src/database/prisma.service';
|
||||
|
||||
@Injectable()
|
||||
export class UserRepository {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
async findMany(params: {
|
||||
skip?: number;
|
||||
take?: number;
|
||||
cursor?: Prisma.UserWhereUniqueInput;
|
||||
where?: Prisma.UserWhereInput;
|
||||
orderBy?: Prisma.UserOrderByWithRelationInput;
|
||||
}): Promise<User[]> {
|
||||
const { skip, take, cursor, where, orderBy } = params;
|
||||
return this.prisma.user.findMany({ skip, take, cursor, where, orderBy });
|
||||
}
|
||||
}
|
||||
10
server/src/entities/workspace/workspace.module.ts
Normal file
10
server/src/entities/workspace/workspace.module.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { WorkspaceRepository } from './workspace.repository';
|
||||
import { PrismaModule } from 'src/database/prisma.module';
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule],
|
||||
providers: [WorkspaceRepository],
|
||||
exports: [WorkspaceRepository]
|
||||
})
|
||||
export class WorkspaceModule {}
|
||||
19
server/src/entities/workspace/workspace.repository.ts
Normal file
19
server/src/entities/workspace/workspace.repository.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Workspace, Prisma } from '@prisma/client';
|
||||
import { PrismaService } from 'src/database/prisma.service';
|
||||
|
||||
@Injectable()
|
||||
export class WorkspaceRepository {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
async findMany(params: {
|
||||
skip?: number;
|
||||
take?: number;
|
||||
cursor?: Prisma.WorkspaceWhereUniqueInput;
|
||||
where?: Prisma.WorkspaceWhereInput;
|
||||
orderBy?: Prisma.WorkspaceOrderByWithRelationInput;
|
||||
}): Promise<Workspace[]> {
|
||||
const { skip, take, cursor, where, orderBy } = params;
|
||||
return this.prisma.workspace.findMany({ skip, take, cursor, where, orderBy });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user