Skip to content

Commit 509ab62

Browse files
committed
factor out types
1 parent ccaad74 commit 509ab62

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

app.ts

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {Octokit} from "@octokit/core";
22
import express, {NextFunction, Request, Response} from "express";
33
import {Webhook, WebhookUnbrandedRequiredHeaders, WebhookVerificationError} from "standardwebhooks"
4+
import {RenderDeploy, RenderService, WebhookPayload} from "./render";
45

56
const app = express();
67
const port = process.env.PORT || 3001;
@@ -20,34 +21,6 @@ const octokit = new Octokit({
2021
auth: githubAPIToken
2122
})
2223

23-
interface WebhookData {
24-
id: string
25-
serviceId: string
26-
}
27-
28-
interface WebhookPayload {
29-
type: string
30-
timestamp: Date
31-
data: WebhookData
32-
}
33-
34-
interface RenderService {
35-
id: string
36-
name: string
37-
repo: string
38-
branch: string
39-
}
40-
41-
interface RenderDeploy {
42-
id: string
43-
commit?: Commit
44-
}
45-
46-
interface Commit {
47-
id: string
48-
message: string
49-
}
50-
5124
app.post("/webhook", express.raw({type: 'application/json'}), (req: Request, res: Response, next: NextFunction) => {
5225
try {
5326
validateWebhook(req);

render.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
interface WebhookData {
2+
id: string
3+
serviceId: string
4+
}
5+
6+
export interface WebhookPayload {
7+
type: string
8+
timestamp: Date
9+
data: WebhookData
10+
}
11+
12+
export interface RenderService {
13+
id: string
14+
name: string
15+
repo: string
16+
branch: string
17+
}
18+
19+
interface Commit {
20+
id: string
21+
message: string
22+
}
23+
24+
export interface RenderDeploy {
25+
id: string
26+
commit?: Commit
27+
}

0 commit comments

Comments
 (0)