Dough Git

clove/isATracker

src/lib/server/types.ts

back to src/lib/server

/* src/lib/server/types.ts
 * MIT — (c) Doughmination System®
 */

export type RuleId =
	| 'nsRecords'
	| 'unsupportedCname'
	| 'cnameUrl'
	| 'unsupportedUrlTld'
	| 'ownerUsernameMismatch'
	| 'noReplyEmail'
	| 'vercelLogin'
	| 'vercelFileName'
	| 'vercelTxtRecord';

export type ActionType = 'closePr' | 'requestChanges' | 'ignore';

export type ActionSource = 'discord' | 'dashboard';

export type ActionStatus = 'success' | 'failure' | 'skipped' | 'dryRun';

export type FindingStatus = 'pending' | 'acting' | 'actioned' | 'ignored' | 'resolved' | 'prClosed';

export interface PullRequestSummary {
	// owner/name
	repo: string;
	number: number;
	title: string;
	author: string;
	authorAssociation: string;
	url: string;
	state: 'open' | 'closed';
	headSha: string;
	updatedAt: string;
	// The PR description; not stored in the database
	body: string;
}

export interface PullRequestRow extends Omit<PullRequestSummary, 'body'> {
	scannedSha: string | null;
	scannedAt: string | null;
}

export interface FindingRow {
	id: number;
	repo: string;
	prNumber: number;
	ruleId: RuleId;
	filePath: string;
	headSha: string;
	reason: string;
	status: FindingStatus;
	lastOutcome: string | null;
	commentId: number | null;
	discordChannelId: string | null;
	discordMessageId: string | null;
	createdAt: string;
	updatedAt: string;
}

export interface FindingWithPullRequest extends FindingRow {
	title: string;
	author: string;
	url: string;
}

export interface ActionRow {
	id: number;
	findingId: number | null;
	repo: string;
	prNumber: number;
	contributor: string;
	ruleId: RuleId;
	actionType: ActionType;
	source: ActionSource;
	status: ActionStatus;
	detail: string;
	githubUrl: string | null;
	createdAt: string;
}

export interface ActionOutcome {
	status: ActionStatus;
	summary: string;
	githubUrl?: string;
}