Introduced typing for the buildJob and cleaned up common.ts

This commit is contained in:
dominicbachmann
2022-04-05 20:11:19 +02:00
parent 3ef093c7e6
commit e08ec12d26
4 changed files with 111 additions and 48 deletions

View File

@@ -0,0 +1,51 @@
import type { DestinationDocker, GithubApp, GitlabApp, GitSource, Secret } from '@prisma/client';
export type BuilderJob = {
build_id: string;
type: BuildType;
id: string;
name: string;
fqdn: string;
repository: string;
configHash: unknown;
branch: string;
buildPack: BuildPackName;
projectId: number;
port: number;
installCommand: string;
buildCommand?: string;
startCommand?: string;
baseDirectory: string;
publishDirectory: string;
phpModules: unknown; // probably an array of some type;
pythonWSGI: unknown; // probably a string?;
pythonModule: unknown; // probably a string?;
pythonVariable: unknown; // probably a string?;
createdAt: string;
updatedAt: string;
destinationDockerId: string;
destinationDocker: DestinationDocker;
gitSource: GitSource & { githubApp?: GithubApp; gitlabApp?: GitlabApp };
settings: BuilderJobSettings;
secrets: Secret[];
persistentStorage: { path: string }[];
pullmergeRequestId?: unknown;
sourceBranch?: string;
};
// TODO: Add the other build types
export type BuildType = 'manual';
// TODO: Add the other buildpack names
export type BuildPackName = 'node' | 'docker';
export type BuilderJobSettings = {
id: string;
applicationId: string;
dualCerts: boolean;
debug: boolean;
previews: boolean;
autodeploy: boolean;
createdAt: string;
updatedAt: string;
};