cf2021.d.ts 3.00 KiB
declare namespace CF2021 {
interface ProgramScheduleEntry {
id: string;
title: string;
expectedStartAt: Date;
expectedFinishAt: Date;
}
export interface ProgramStorePayload {
current: ProgramScheduleEntry & {
discussionOpened: boolean;
}
schedule: ProgramScheduleEntry[];
}
interface GroupMapping {
id: number;
code: string;
name: string;
}
export interface AnonymousAuthStorePayload {
isAuthenticated: false;
groupMappings: GroupMapping[];
}
export interface UserAuthStorePayload extends AnonymousAuthStorePayload {
isAuthenticated: true;
user: {
name: string;
groups: string[];
accessToken: string;
};
}
export type AuthStorePayload =
| AnonymousAuthStorePayload
| UserAuthStorePayload;
export type AnnouncementType =
| "rejected-procedure-proposal"
| "accepted-procedure-proposal"
| "suggested-procedure-proposal"
| "voting"
| "announcement"
| "user-ban";
export interface Announcement {
id: string;
datetime: Date;
type: AnnouncementType;
content: string;
link?: string;
relatedPostId: string;
seen: boolean;
}
export interface AnnouncementStorePayload {
items: Announcement[];
}
export type PostType = "post" | "procedure-proposal";
export interface AbstractPost {
id: string;
datetime: Date;
author: {
name: string;
group: string;
};
type: PostType;
content: string;
ranking: {
score: number;
likes: number;
dislikes: number;
myVote: "like" | "dislike" | "none";
};
historyLog: {
attribute: string;
newValue: string;
datetime: Date;
originator: "self" | "chairman";
}[];
archived: boolean;
hidden: boolean;
seen: boolean;
}
export interface DiscussionPost extends AbstractPost {
type: "post";
}
export interface ProposalPost extends AbstractPost {
type: "procedure-proposal";
state:
| "pending"
| "announced"
| "accepted"
| "rejected"
| "rejected-by-chairman";
}
export type Post = ProposalPost | DiscussionPost;
export interface PostStoreItems {
[key: string]: Post;
}
export interface PostStoreFilters {
flags: "all" | "active" | "archived";
sort: "byDate" | "byScore";
type: "all" | "proposalsOnly" | "discussionOnly";
}
export interface PostStorePayload {
items: PostStoreItems;
itemCount: number;
window: {
items: string[];
itemCount: number;
page: number;
perPage: number;
};
filters: PostStoreFilters;
}
}