
The creation of a single repository is no longer relevant. Therefore, we have to separate the front and back repo into two distinct repositories. This PR allows to repatriate the work on dev branch
64 lines
2.2 KiB
TypeScript
64 lines
2.2 KiB
TypeScript
// import TezosLink from "@Common/databases/TezosLink";
|
|
// import ObjectHydrate from "@Common/helpers/ObjectHydrate";
|
|
import { ProjectEntity } from "@Common/ressources";
|
|
// import { ORMBadQueryError } from "@Common/system/database/exceptions/ORMBadQueryError";
|
|
import { Service } from "typedi";
|
|
// import { v4 as uuidv4 } from "uuid";
|
|
import BaseRepository from "../BaseRepository";
|
|
|
|
@Service()
|
|
export default class ProjectsRepository extends BaseRepository {
|
|
// constructor(private database: TezosLink) {
|
|
// super();
|
|
// }
|
|
// protected get model() {
|
|
// return this.database.getClient().project;
|
|
// }
|
|
|
|
// public async findMany(query: Prisma.ProjectFindManyArgs): Promise<ProjectEntity[]> {
|
|
// try {
|
|
// // Use Math.min to limit the number of rows fetched
|
|
// const limit = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows);
|
|
|
|
// // Update the query with the limited limit
|
|
// const projects = await this.model.findMany({ ...query, take: limit });
|
|
// return ObjectHydrate.map<ProjectEntity>(ProjectEntity, projects, { strategy: "exposeAll" });
|
|
// } catch (error) {
|
|
// throw new ORMBadQueryError((error as Error).message, error as Error);
|
|
// }
|
|
// }
|
|
|
|
public async findOne(projectEntity: Partial<ProjectEntity>) {
|
|
// try {
|
|
// const project = (await this.model.findFirst({
|
|
// where: projectEntity,
|
|
// })) as ProjectEntity;
|
|
// return ObjectHydrate.hydrate<ProjectEntity>(new ProjectEntity(), project, { strategy: "exposeAll" });
|
|
// } catch (error) {
|
|
// throw new ORMBadQueryError((error as Error).message, error as Error);
|
|
// }
|
|
}
|
|
|
|
public async create(projectEntity: Partial<ProjectEntity>) {
|
|
// try {
|
|
// const data = { ...projectEntity };
|
|
// data.uuid = uuidv4();
|
|
// const project = (await this.model.create({
|
|
// data: {
|
|
// uuid: data.uuid,
|
|
// title: data.title!,
|
|
// network: data.network!,
|
|
// },
|
|
// include: {
|
|
// // Include metrics
|
|
// Metrics: true,
|
|
// },
|
|
// })) as ProjectEntity;
|
|
// return ObjectHydrate.hydrate<ProjectEntity>(new ProjectEntity(), project, { strategy: "exposeAll" });
|
|
// } catch (error) {
|
|
// throw new ORMBadQueryError((error as Error).message, error as Error);
|
|
// }
|
|
}
|
|
}
|
|
|