Skip to content

Commit 496f06c

Browse files
authored
chore: remove deprecated API endpoints (CLI < v2.0.0) (#232)
1 parent 119f1f2 commit 496f06c

File tree

10 files changed

+42
-625
lines changed

10 files changed

+42
-625
lines changed

apps/service/src/consts/schemas.ts

Lines changed: 2 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -21,60 +21,6 @@ export const BaseGetRequestSchema = {
2121
additionalProperties: false,
2222
};
2323

24-
export const ProjectAuthHeaders = {
25-
$id: '#/definitions/ProjectAuthHeaders',
26-
type: 'object',
27-
properties: {
28-
'x-api-key': {
29-
type: 'string',
30-
minLength: 1,
31-
},
32-
},
33-
required: ['x-api-key'],
34-
additionalProperties: false,
35-
};
36-
37-
export const GithubActionsAuthHeaders = {
38-
$id: '#/definitions/GithubActionsAuthHeaders',
39-
type: 'object',
40-
properties: {
41-
'bundlemon-auth-type': {
42-
type: 'string',
43-
const: 'GITHUB_ACTION',
44-
},
45-
'github-owner': {
46-
type: 'string',
47-
minLength: 1,
48-
},
49-
'github-repo': {
50-
type: 'string',
51-
minLength: 1,
52-
},
53-
'github-run-id': {
54-
type: 'string',
55-
minLength: 1,
56-
pattern: '^\\d+$',
57-
},
58-
},
59-
required: ['bundlemon-auth-type', 'github-owner', 'github-repo', 'github-run-id'],
60-
additionalProperties: false,
61-
};
62-
63-
export const AuthHeaders = {
64-
$id: '#/definitions/AuthHeaders',
65-
anyOf: [
66-
{
67-
type: 'object',
68-
},
69-
{
70-
$ref: '#/definitions/ProjectAuthHeaders',
71-
},
72-
{
73-
$ref: '#/definitions/GithubActionsAuthHeaders',
74-
},
75-
],
76-
};
77-
7824
export const ProjectIdParams = {
7925
$id: '#/definitions/ProjectIdParams',
8026
type: 'object',
@@ -177,11 +123,9 @@ export const CreateCommitRecordRequestSchema = {
177123
params: {
178124
$ref: '#/definitions/ProjectIdParams',
179125
},
180-
headers: {
181-
$ref: '#/definitions/AuthHeaders',
182-
},
126+
headers: {},
183127
},
184-
required: ['body', 'params', 'query', 'headers'],
128+
required: ['body', 'params', 'query'],
185129
additionalProperties: false,
186130
};
187131

@@ -941,74 +885,6 @@ export const PostGithubPRCommentRequestSchema = {
941885
additionalProperties: false,
942886
};
943887

944-
export const LegacyGithubOutputRequestSchema = {
945-
$id: '#/definitions/LegacyGithubOutputRequestSchema',
946-
type: 'object',
947-
properties: {
948-
body: {
949-
type: 'object',
950-
properties: {
951-
report: {
952-
$ref: '#/definitions/Report',
953-
},
954-
git: {
955-
type: 'object',
956-
properties: {
957-
owner: {
958-
type: 'string',
959-
},
960-
repo: {
961-
type: 'string',
962-
},
963-
commitSha: {
964-
type: 'string',
965-
},
966-
prNumber: {
967-
type: 'string',
968-
},
969-
},
970-
required: ['owner', 'repo', 'commitSha'],
971-
additionalProperties: false,
972-
},
973-
output: {
974-
type: 'object',
975-
properties: {
976-
checkRun: {
977-
type: 'boolean',
978-
},
979-
commitStatus: {
980-
type: 'boolean',
981-
},
982-
prComment: {
983-
type: 'boolean',
984-
},
985-
},
986-
additionalProperties: false,
987-
},
988-
},
989-
required: ['report', 'git', 'output'],
990-
additionalProperties: false,
991-
},
992-
query: {},
993-
params: {
994-
type: 'object',
995-
properties: {
996-
projectId: {
997-
type: 'string',
998-
pattern: '^[0-9a-fA-F]{24}$',
999-
},
1000-
},
1001-
required: ['projectId'],
1002-
additionalProperties: false,
1003-
},
1004-
headers: {
1005-
$ref: '#/definitions/AuthHeaders',
1006-
},
1007-
},
1008-
required: ['body', 'params', 'headers'],
1009-
additionalProperties: false,
1010-
};
1011-
1012888
export const GithubOutputRequestSchema = {
1013889
$id: '#/definitions/GithubOutputRequestSchema',
1014890
type: 'object',

apps/service/src/controllers/commitRecordsController.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ export const createCommitRecordController: FastifyValidatedRoute<CreateCommitRec
4141
params: { projectId },
4242
body,
4343
query,
44-
headers,
4544
} = req;
46-
const authResult = await checkAuth(projectId, headers, query, body.commitSha, req.log);
45+
const authResult = await checkAuth(projectId, query, body.commitSha, req.log);
4746

4847
if (!authResult.authenticated) {
4948
res.status(403).send({ message: authResult.error, extraData: authResult.extraData });

apps/service/src/controllers/githubController.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import type { Octokit } from '@octokit/rest';
1616
import type { FastifyValidatedRoute, GithubOutputRequestSchema } from '@/types/schemas';
1717
import type { FastifyReply } from 'fastify';
1818

19-
// bundlemon > v2.0.0
2019
export const githubOutputController: FastifyValidatedRoute<GithubOutputRequestSchema> = async (req, res) => {
2120
try {
2221
const {

apps/service/src/controllers/legacyGithubController.ts

Lines changed: 0 additions & 227 deletions
This file was deleted.

0 commit comments

Comments
 (0)