Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

feat: add org details to project API (#11288)

Max Deichmanne10102eb0bb1
diff --git a/fern/apis/server/definition/projects.yml b/fern/apis/server/definition/projects.yml
index 10e1288055..c97badd593 100644
--- a/fern/apis/server/definition/projects.yml
+++ b/fern/apis/server/definition/projects.yml
@@ -102,10 +102,22 @@ types:
properties:
data: list<Project>
+ Organization:
+ properties:
+ id:
+ type: string
+ docs: The unique identifier of the organization
+ name:
+ type: string
+ docs: The name of the organization
+
Project:
properties:
id: string
name: string
+ organization:
+ type: Organization
+ docs: The organization this project belongs to
metadata:
type: map<string, unknown>
docs: Metadata for the project
diff --git a/web/src/__tests__/async/projects-api.servertest.ts b/web/src/__tests__/async/projects-api.servertest.ts
index f887bdcedc..0d15968ced 100644
--- a/web/src/__tests__/async/projects-api.servertest.ts
+++ b/web/src/__tests__/async/projects-api.servertest.ts
@@ -18,6 +18,10 @@ const ProjectResponseSchema = z.object({
z.object({
id: z.string(),
name: z.string(),
+ organization: z.object({
+ id: z.string(),
+ name: z.string(),
+ }),
metadata: z.object({}).optional(),
retentionDays: z.number().nullable().optional(),
}),
@@ -116,6 +120,10 @@ describe("Projects API", () => {
expect(response.body.data[0]).toMatchObject({
id: projectId,
name: projectName,
+ organization: {
+ id: expect.any(String),
+ name: expect.any(String),
+ },
metadata: {},
});
});
diff --git a/web/src/pages/api/public/projects/index.ts b/web/src/pages/api/public/projects/index.ts
index 79c29f5f0a..d74fe3ce6d 100644
--- a/web/src/pages/api/public/projects/index.ts
+++ b/web/src/pages/api/public/projects/index.ts
@@ -50,6 +50,12 @@ export default async function handler(
name: true,
retentionDays: true,
metadata: true,
+ organization: {
+ select: {
+ id: true,
+ name: true,
+ },
+ },
},
where: {
id: authCheck.scope.projectId,
@@ -61,6 +67,10 @@ export default async function handler(
data: projects.map((project) => ({
id: project.id,
name: project.name,
+ organization: {
+ id: project.organization.id,
+ name: project.organization.name,
+ },
metadata: project.metadata ?? {},
...(project.retentionDays // Do not add if null or 0
? { retentionDays: project.retentionDays }