Add script to load fixture data in database (#34)

* Add fixture data and populate database with it

* Use node to run commands in package scripts

* Move test directory out of src directory

* Save projects with user and organization relation

* Refactor and add generalized function to load data

* Populate userOrganization entity with test data

* Change project id type from number to string

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
This commit is contained in:
2024-02-01 11:37:57 +05:30
committed by Ashwin Phatak
co-authored by neeraj
parent 3829485672
commit 890603061f
11 changed files with 265 additions and 26 deletions
@@ -15,10 +15,10 @@ const Domains = () => {
const { projects } = useOutletContext<ProjectsOutletContext>();
const currProject = useMemo(() => {
return projects.find((data) => {
return Number(data?.id) === Number(id);
return projects.find((project) => {
return project.id === id;
});
}, [id]);
}, [id, projects]);
const linkedRepo = useMemo(() => {
return currProject?.repositories.find(
@@ -27,10 +27,10 @@ const Domains = () => {
}, [currProject]);
const domains = currProject?.deployments
.filter((deployment: any) => {
.filter((deployment) => {
return deployment.domain != null;
})
.map((deployment: any) => deployment.domain);
.map((deployment) => deployment.domain);
return (
<>
@@ -39,8 +39,10 @@ export const EnvironmentVariablesTabPanel = () => {
const { projects } = useOutletContext<ProjectsOutletContext>();
const currProject = useMemo(() => {
return projects.find((data) => Number(data.id) === Number(id));
}, [id]);
return projects.find((project) => {
return project.id === id;
});
}, [id, projects]);
const {
handleSubmit,
@@ -7,22 +7,17 @@ import HorizontalLine from '../../components/HorizontalLine';
import ProjectTabs from '../../components/projects/project/ProjectTabs';
import { ProjectsOutletContext } from '../../types/project';
const getProject = (projects: any, id: number) => {
return projects.find((project: any) => {
return Number(project.id) === id;
});
};
const Project = () => {
const { id } = useParams();
const navigate = useNavigate();
const { projects } = useOutletContext<ProjectsOutletContext>();
const project = useMemo(
() => getProject(projects, Number(id)),
[id, projects],
);
const project = useMemo(() => {
return projects.find((project) => {
return project.id === id;
});
}, [id, projects]);
return (
<div className="h-full">
+2 -1
View File
@@ -6,7 +6,7 @@ export interface ProjectDetails {
description: string;
url: string;
domain: string | null;
id: number;
id: string;
createdAt: string;
createdBy: string;
deployments: DeploymentDetails[];
@@ -31,6 +31,7 @@ export interface MemberPermission {
export interface DeploymentDetails {
title: string;
isProduction: boolean;
domain: DomainDetails;
status: Status;
branch: string;
environment: Environments;