diff --git a/packages/backend/src/resolvers.ts b/packages/backend/src/resolvers.ts index 3fe9a9be..e20b7e0c 100644 --- a/packages/backend/src/resolvers.ts +++ b/packages/backend/src/resolvers.ts @@ -22,8 +22,8 @@ export const createResolvers = async (service: Service): Promise => { return service.getOrganizationsByUserId(context.user); }, - project: async (_: any, { projectId }: { projectId: string }) => { - return service.getProjectById(projectId); + project: async (_: any, { projectId }: { projectId: string }, context: any) => { + return service.getProjectById(context.user, projectId); }, projectsInOrganization: async ( diff --git a/packages/backend/src/service.ts b/packages/backend/src/service.ts index b142ad67..5da16954 100644 --- a/packages/backend/src/service.ts +++ b/packages/backend/src/service.ts @@ -407,8 +407,13 @@ export class Service { return dbOrganizations; } - async getProjectById(projectId: string): Promise { + async getProjectById(user: User, projectId: string): Promise { const dbProject = await this.db.getProjectById(projectId); + + if (dbProject && dbProject.owner.id !== user.id) { + return null; + } + return dbProject; } diff --git a/packages/backend/test/fixtures/organizations.json b/packages/backend/test/fixtures/organizations.json index ace516d3..19735cca 100644 --- a/packages/backend/test/fixtures/organizations.json +++ b/packages/backend/test/fixtures/organizations.json @@ -1,8 +1,8 @@ [ { "id": "2379cf1f-a232-4ad2-ae14-4d881131cc26", - "name": "Snowball Tools", - "slug": "snowball-tools-1" + "name": "Deploy Tools", + "slug": "deploy-tools" }, { "id": "7eb9b3eb-eb74-4b53-b59a-69884c82a7fb", diff --git a/packages/frontend/src/components/projects/create/Configure.tsx b/packages/frontend/src/components/projects/create/Configure.tsx index 9dca4915..64c9c24b 100644 --- a/packages/frontend/src/components/projects/create/Configure.tsx +++ b/packages/frontend/src/components/projects/create/Configure.tsx @@ -515,7 +515,7 @@ const Configure = () => { - + {(project.deployments.length > 0) && + + + + } diff --git a/packages/frontend/src/pages/org-slug/projects/id/Overview.tsx b/packages/frontend/src/pages/org-slug/projects/id/Overview.tsx index 8e840bb3..ab78cc11 100644 --- a/packages/frontend/src/pages/org-slug/projects/id/Overview.tsx +++ b/packages/frontend/src/pages/org-slug/projects/id/Overview.tsx @@ -180,14 +180,18 @@ const OverviewTabPanel = () => { {/* DEPLOYMENT */} }> + {project.deployments && + project.deployments.length > 0 && + project.deployments.map((deployment) => (
- + - {liveDomain?.name}{' '} + {`https://${project.name.toLowerCase()}.${deployment.deployer.baseDomain}`}
+ ))}
{/* DEPLOYMENT DATE */} diff --git a/packages/frontend/src/stories/Project/Settings/AddEnvironmentVariableRow.stories.tsx b/packages/frontend/src/stories/Project/Settings/AddEnvironmentVariableRow.stories.tsx index 458bfa70..81d48009 100644 --- a/packages/frontend/src/stories/Project/Settings/AddEnvironmentVariableRow.stories.tsx +++ b/packages/frontend/src/stories/Project/Settings/AddEnvironmentVariableRow.stories.tsx @@ -17,7 +17,7 @@ const meta: Meta = { pathParams: { userId: 'me' }, }, routing: { - path: '/snowball-tools-1/projects/6bb3bec2-d71b-4fc0-9e32-4767f68668f4/settings', + path: '/deploy-tools/projects/6bb3bec2-d71b-4fc0-9e32-4767f68668f4/settings', }, }), }, diff --git a/packages/frontend/src/stories/Project/Settings/Config.stories.tsx b/packages/frontend/src/stories/Project/Settings/Config.stories.tsx index de831625..a028ada2 100644 --- a/packages/frontend/src/stories/Project/Settings/Config.stories.tsx +++ b/packages/frontend/src/stories/Project/Settings/Config.stories.tsx @@ -17,7 +17,7 @@ const meta: Meta = { pathParams: { userId: 'me' }, }, routing: { - path: '/snowball-tools-1/projects/6bb3bec2-d71b-4fc0-9e32-4767f68668f4/settings/domains/add/config', + path: '/deploy-tools/projects/6bb3bec2-d71b-4fc0-9e32-4767f68668f4/settings/domains/add/config', }, }), }, diff --git a/packages/frontend/src/stories/Project/Settings/DeleteProjectDialog.stories.tsx b/packages/frontend/src/stories/Project/Settings/DeleteProjectDialog.stories.tsx index e3fe7f7e..3c370411 100644 --- a/packages/frontend/src/stories/Project/Settings/DeleteProjectDialog.stories.tsx +++ b/packages/frontend/src/stories/Project/Settings/DeleteProjectDialog.stories.tsx @@ -18,7 +18,7 @@ const meta: Meta = { pathParams: { userId: 'me' }, }, routing: { - path: '/snowball-tools-1/projects/6bb3bec2-d71b-4fc0-9e32-4767f68668f4/settings', + path: '/deploy-tools/projects/6bb3bec2-d71b-4fc0-9e32-4767f68668f4/settings', }, }), }, diff --git a/packages/frontend/src/stories/Project/Settings/SetupDomains.stories.tsx b/packages/frontend/src/stories/Project/Settings/SetupDomains.stories.tsx index 7c416099..d77a5c6c 100644 --- a/packages/frontend/src/stories/Project/Settings/SetupDomains.stories.tsx +++ b/packages/frontend/src/stories/Project/Settings/SetupDomains.stories.tsx @@ -17,7 +17,7 @@ const meta: Meta = { pathParams: { userId: 'me' }, }, routing: { - path: '/snowball-tools-1/projects/6bb3bec2-d71b-4fc0-9e32-4767f68668f4/settings/domains', + path: '/deploy-tools/projects/6bb3bec2-d71b-4fc0-9e32-4767f68668f4/settings/domains', }, }), },