mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 00:52:55 +00:00
feat: add enums for stricter types
This commit is contained in:
71
src/types.ts
71
src/types.ts
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 StApps
|
* Copyright (C) 2018, 2019 StApps
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
* Software Foundation, version 3.
|
* Software Foundation, version 3.
|
||||||
@@ -12,6 +12,65 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scope of membership
|
||||||
|
*/
|
||||||
|
export enum MembershipScope {
|
||||||
|
GROUPS = 'groups',
|
||||||
|
PROJECTS = 'projects',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scope
|
||||||
|
*/
|
||||||
|
export enum Scope {
|
||||||
|
ISSUES = 'issues',
|
||||||
|
MERGE_REQUESTS = 'merge_requests',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merge request state
|
||||||
|
*/
|
||||||
|
export enum MergeRequestState {
|
||||||
|
CLOSED = 'closed',
|
||||||
|
LOCKED = 'locked',
|
||||||
|
MERGED = 'merged',
|
||||||
|
OPENED = 'opened',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Issue state
|
||||||
|
*/
|
||||||
|
export enum IssueState {
|
||||||
|
CLOSED = 'closed',
|
||||||
|
OPENED = 'opened',
|
||||||
|
REOPENED = 'reopened',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Milestone state
|
||||||
|
*/
|
||||||
|
export enum MilestoneState {
|
||||||
|
ACTIVE = 'active',
|
||||||
|
CLOSED = 'closed',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User state
|
||||||
|
*/
|
||||||
|
export enum UserState {
|
||||||
|
ACTIVE = 'active',
|
||||||
|
BLOCKED = 'blocked',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merge request merge status
|
||||||
|
*/
|
||||||
|
export enum MergeRequestMergeStatus {
|
||||||
|
CAN_BE_MERGED = 'can_be_merged',
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GitLab label
|
* GitLab label
|
||||||
*/
|
*/
|
||||||
@@ -138,7 +197,7 @@ export interface Milestone {
|
|||||||
iid: number;
|
iid: number;
|
||||||
project_id: number;
|
project_id: number;
|
||||||
start_date: string;
|
start_date: string;
|
||||||
state: string;
|
state: MilestoneState;
|
||||||
title: string;
|
title: string;
|
||||||
updated_at: string;
|
updated_at: string;
|
||||||
}
|
}
|
||||||
@@ -162,7 +221,7 @@ export interface User {
|
|||||||
avatar_url: string;
|
avatar_url: string;
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
state: string;
|
state: UserState;
|
||||||
username: string;
|
username: string;
|
||||||
web_url: string;
|
web_url: string;
|
||||||
}
|
}
|
||||||
@@ -186,7 +245,7 @@ export interface Issue extends ThingWithTimeStats {
|
|||||||
labels: string[];
|
labels: string[];
|
||||||
milestone: Milestone | null;
|
milestone: Milestone | null;
|
||||||
project_id: number;
|
project_id: number;
|
||||||
state: string;
|
state: IssueState;
|
||||||
title: string;
|
title: string;
|
||||||
updated_at: string;
|
updated_at: string;
|
||||||
upvotes: number;
|
upvotes: number;
|
||||||
@@ -209,7 +268,7 @@ export interface MergeRequest extends ThingWithTimeStats {
|
|||||||
iid: number;
|
iid: number;
|
||||||
labels: Label[];
|
labels: Label[];
|
||||||
merge_commit_sha: string;
|
merge_commit_sha: string;
|
||||||
merge_status: string;
|
merge_status: MergeRequestMergeStatus;
|
||||||
merge_when_pipeline_succeeds: boolean;
|
merge_when_pipeline_succeeds: boolean;
|
||||||
milestone: Milestone;
|
milestone: Milestone;
|
||||||
project_id: number;
|
project_id: number;
|
||||||
@@ -217,7 +276,7 @@ export interface MergeRequest extends ThingWithTimeStats {
|
|||||||
should_remove_source_branch: boolean;
|
should_remove_source_branch: boolean;
|
||||||
source_branch: string;
|
source_branch: string;
|
||||||
source_project_id: number;
|
source_project_id: number;
|
||||||
state: string;
|
state: MergeRequestState;
|
||||||
target_branch: string;
|
target_branch: string;
|
||||||
target_project_id: number;
|
target_project_id: number;
|
||||||
title: string;
|
title: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user