import { Database } from './database'; import { Deployment } from './entity/Deployment'; import { Domain } from './entity/Domain'; import { EnvironmentVariable } from './entity/EnvironmentVariable'; import { Organization } from './entity/Organization'; import { Project } from './entity/Project'; import { ProjectMember } from './entity/ProjectMember'; import { User } from './entity/User'; export class Service { private db: Database; constructor (db: Database) { this.db = db; } async getUser (userId: number): Promise { return this.db.getUser(userId); } async getOrganizationsByUserId (userId: number): Promise { const dbOrganizations = await this.db.getOrganizationsByUserId(userId); return dbOrganizations; } async getProjectById (projectId: string): Promise { const dbProject = await this.db.getProjectById(projectId); return dbProject; } async getProjectsInOrganization (userId:string, organizationId: string): Promise { const dbProjects = await this.db.getProjectsInOrganization(userId, organizationId); return dbProjects; } async getDeployementsByProjectId (projectId: string): Promise { const dbDeployments = await this.db.getDeploymentsByProjectId(projectId); return dbDeployments; } async getEnvironmentVariablesByProjectId (projectId: string): Promise { const dbEnvironmentVariables = await this.db.getEnvironmentVariablesByProjectId(projectId); return dbEnvironmentVariables; } async getProjectMembersByProjectId (projectId: string): Promise { const dbProjectMembers = await this.db.getProjectMembersByProjectId(projectId); return dbProjectMembers; } async searchProjects (userId:string, searchText: string): Promise { const dbProjects = await this.db.getProjectsBySearchText(Number(userId), searchText); return dbProjects; } async getDomainsByProjectId (projectId: string): Promise { const dbDomains = await this.db.getDomainsByProjectId(projectId); return dbDomains; } }