Skip to content

Commit df79bdc

Browse files
committed
add more endpoints
1 parent 56b0ae7 commit df79bdc

File tree

30 files changed

+1073
-365
lines changed

30 files changed

+1073
-365
lines changed

apps/api/package.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,23 @@
66
"build": "tsc && tsc-alias",
77
"clean": "rm -rf .turbo node_modules",
88
"dev": "pnpm with-env tsx watch --clear-screen=false src/index.ts",
9-
"lint": "eslint",
10-
"generate": "jsonnet openapi/main.jsonnet > openapi/openapi.json && pnpm generate:types",
11-
"generate:types": "openapi-typescript openapi/openapi.json -o src/types/openapi.ts",
129
"format": "prettier --check . --ignore-path ../../.gitignore && jsonnetfmt -i ./**/*.jsonnet",
1310
"format:fix": "prettier --write . --ignore-path ../../.gitignore && jsonnetfmt -i ./**/*.jsonnet",
14-
"with-env": "dotenv -e ../../.env --",
15-
"start": "node dist/index.js"
11+
"generate": "jsonnet openapi/main.jsonnet > openapi/openapi.json && pnpm generate:types",
12+
"generate:types": "openapi-typescript openapi/openapi.json -o src/types/openapi.ts",
13+
"lint": "eslint",
14+
"start": "node dist/index.js",
15+
"with-env": "dotenv -e ../../.env --"
1616
},
1717
"dependencies": {
1818
"@auth/express": "^0.12.0",
1919
"@ctrlplane/auth": "workspace:*",
20+
"@ctrlplane/db": "workspace:*",
21+
"@ctrlplane/events": "workspace:*",
22+
"@ctrlplane/logger": "workspace:*",
2023
"@ctrlplane/trpc": "workspace:*",
24+
"@ctrlplane/validators": "workspace:*",
25+
"@ctrlplane/workspace-engine-sdk": "workspace:*",
2126
"@t3-oss/env-core": "catalog:",
2227
"@trpc/server": "11.0.0-rc.364",
2328
"bcryptjs": "^2.4.3",

apps/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"class-variance-authority": "^0.7.1",
4545
"clsx": "^2.1.1",
4646
"cmdk": "^1.1.1",
47-
"date-fns": "catalog:",
47+
"date-fns": "^4.1.0",
4848
"isbot": "^5.1.31",
4949
"lucide-react": "^0.441.0",
5050
"next-themes": "^0.3.0",

apps/workspace-engine/oapi/openapi.json

Lines changed: 237 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,108 @@
12941294
"summary": "Get deployment version jobs list"
12951295
}
12961296
},
1297+
"/v1/workspaces/{workspaceId}/deployments": {
1298+
"get": {
1299+
"description": "Returns a paginated list of deployments for a workspace.",
1300+
"operationId": "listDeployments",
1301+
"parameters": [
1302+
{
1303+
"description": "ID of the workspace",
1304+
"in": "path",
1305+
"name": "workspaceId",
1306+
"required": true,
1307+
"schema": {
1308+
"type": "string"
1309+
}
1310+
},
1311+
{
1312+
"description": "Maximum number of items to return",
1313+
"in": "query",
1314+
"name": "limit",
1315+
"required": false,
1316+
"schema": {
1317+
"default": 50,
1318+
"maximum": 1000,
1319+
"minimum": 1,
1320+
"type": "integer"
1321+
}
1322+
},
1323+
{
1324+
"description": "Number of items to skip",
1325+
"in": "query",
1326+
"name": "offset",
1327+
"required": false,
1328+
"schema": {
1329+
"default": 0,
1330+
"minimum": 0,
1331+
"type": "integer"
1332+
}
1333+
}
1334+
],
1335+
"responses": {
1336+
"200": {
1337+
"content": {
1338+
"application/json": {
1339+
"schema": {
1340+
"properties": {
1341+
"items": {
1342+
"items": {
1343+
"items": {
1344+
"$ref": "#/components/schemas/Deployment"
1345+
},
1346+
"type": "array"
1347+
},
1348+
"type": "array"
1349+
},
1350+
"limit": {
1351+
"description": "Maximum number of items returned",
1352+
"type": "integer"
1353+
},
1354+
"offset": {
1355+
"description": "Number of items skipped",
1356+
"type": "integer"
1357+
},
1358+
"total": {
1359+
"description": "Total number of items available",
1360+
"type": "integer"
1361+
}
1362+
},
1363+
"required": [
1364+
"items",
1365+
"total",
1366+
"limit",
1367+
"offset"
1368+
],
1369+
"type": "object"
1370+
}
1371+
}
1372+
},
1373+
"description": "Paginated list of items"
1374+
},
1375+
"400": {
1376+
"content": {
1377+
"application/json": {
1378+
"schema": {
1379+
"$ref": "#/components/schemas/ErrorResponse"
1380+
}
1381+
}
1382+
},
1383+
"description": "Invalid request"
1384+
},
1385+
"404": {
1386+
"content": {
1387+
"application/json": {
1388+
"schema": {
1389+
"$ref": "#/components/schemas/ErrorResponse"
1390+
}
1391+
}
1392+
},
1393+
"description": "Resource not found"
1394+
}
1395+
},
1396+
"summary": "List deployments"
1397+
}
1398+
},
12971399
"/v1/workspaces/{workspaceId}/deployments/{deploymentId}": {
12981400
"get": {
12991401
"description": "Returns a specific deployment by ID.",
@@ -1323,7 +1425,33 @@
13231425
"content": {
13241426
"application/json": {
13251427
"schema": {
1326-
"$ref": "#/components/schemas/Deployment"
1428+
"properties": {
1429+
"items": {
1430+
"items": {
1431+
"$ref": "#/components/schemas/Deployment"
1432+
},
1433+
"type": "array"
1434+
},
1435+
"limit": {
1436+
"description": "Maximum number of items returned",
1437+
"type": "integer"
1438+
},
1439+
"offset": {
1440+
"description": "Number of items skipped",
1441+
"type": "integer"
1442+
},
1443+
"total": {
1444+
"description": "Total number of items available",
1445+
"type": "integer"
1446+
}
1447+
},
1448+
"required": [
1449+
"items",
1450+
"total",
1451+
"limit",
1452+
"offset"
1453+
],
1454+
"type": "object"
13271455
}
13281456
}
13291457
},
@@ -1353,6 +1481,114 @@
13531481
"summary": "Get deployment"
13541482
}
13551483
},
1484+
"/v1/workspaces/{workspaceId}/deployments/{deploymentId}/release-targets": {
1485+
"get": {
1486+
"description": "Returns a list of release targets for a deployment.",
1487+
"operationId": "getReleaseTargetsForDeployment",
1488+
"parameters": [
1489+
{
1490+
"description": "ID of the workspace",
1491+
"in": "path",
1492+
"name": "workspaceId",
1493+
"required": true,
1494+
"schema": {
1495+
"type": "string"
1496+
}
1497+
},
1498+
{
1499+
"description": "ID of the deployment",
1500+
"in": "path",
1501+
"name": "deploymentId",
1502+
"required": true,
1503+
"schema": {
1504+
"type": "string"
1505+
}
1506+
},
1507+
{
1508+
"description": "Maximum number of items to return",
1509+
"in": "query",
1510+
"name": "limit",
1511+
"required": false,
1512+
"schema": {
1513+
"default": 50,
1514+
"maximum": 1000,
1515+
"minimum": 1,
1516+
"type": "integer"
1517+
}
1518+
},
1519+
{
1520+
"description": "Number of items to skip",
1521+
"in": "query",
1522+
"name": "offset",
1523+
"required": false,
1524+
"schema": {
1525+
"default": 0,
1526+
"minimum": 0,
1527+
"type": "integer"
1528+
}
1529+
}
1530+
],
1531+
"responses": {
1532+
"200": {
1533+
"content": {
1534+
"application/json": {
1535+
"schema": {
1536+
"properties": {
1537+
"items": {
1538+
"items": {
1539+
"$ref": "#/components/schemas/ReleaseTarget"
1540+
},
1541+
"type": "array"
1542+
},
1543+
"limit": {
1544+
"description": "Maximum number of items returned",
1545+
"type": "integer"
1546+
},
1547+
"offset": {
1548+
"description": "Number of items skipped",
1549+
"type": "integer"
1550+
},
1551+
"total": {
1552+
"description": "Total number of items available",
1553+
"type": "integer"
1554+
}
1555+
},
1556+
"required": [
1557+
"items",
1558+
"total",
1559+
"limit",
1560+
"offset"
1561+
],
1562+
"type": "object"
1563+
}
1564+
}
1565+
},
1566+
"description": "Paginated list of items"
1567+
},
1568+
"400": {
1569+
"content": {
1570+
"application/json": {
1571+
"schema": {
1572+
"$ref": "#/components/schemas/ErrorResponse"
1573+
}
1574+
}
1575+
},
1576+
"description": "Invalid request"
1577+
},
1578+
"404": {
1579+
"content": {
1580+
"application/json": {
1581+
"schema": {
1582+
"$ref": "#/components/schemas/ErrorResponse"
1583+
}
1584+
}
1585+
},
1586+
"description": "Resource not found"
1587+
}
1588+
},
1589+
"summary": "Get release targets for a deployment"
1590+
}
1591+
},
13561592
"/v1/workspaces/{workspaceId}/deployments/{deploymentId}/resources": {
13571593
"get": {
13581594
"description": "Returns a paginated list of resources for deployment {deploymentId}.",

apps/workspace-engine/oapi/spec/lib/openapi.libsonnet

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
{ '$ref': '#/components/schemas/' + name }
6666
),
6767

68-
okResponse(description, schema):: {
68+
okResponse(schema, description = "OK response"):: {
6969
'200': {
7070
description: description,
7171
content: {
@@ -84,7 +84,10 @@
8484
schema: {
8585
type: 'object',
8686
properties: {
87-
items: itemsSchema,
87+
items: {
88+
type: 'array',
89+
items: itemsSchema,
90+
},
8891
total: {
8992
type: 'integer',
9093
description: 'Total number of items available',

apps/workspace-engine/oapi/spec/paths/deployment-version.jsonnet

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ local openapi = import '../lib/openapi.libsonnet';
1717
},
1818
],
1919
responses: openapi.okResponse(
20-
'Jobs list grouped by environment and release target',
2120
{
2221
type: 'array',
2322
items: {
@@ -63,7 +62,8 @@ local openapi = import '../lib/openapi.libsonnet';
6362
},
6463
},
6564
},
66-
}
65+
},
66+
'Jobs list grouped by environment and release target',
6767
) + openapi.notFoundResponse() + openapi.badRequestResponse(),
6868
},
6969
},

0 commit comments

Comments
 (0)