summaryrefslogtreecommitdiffstats
path: root/ui/src/interfaces.ts
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2019-04-15 16:12:06 -0700
committerDessalines <tyhou13@gmx.com>2019-04-15 16:12:06 -0700
commite94885eb97b3240ed9cec7f97d0f405b2819e922 (patch)
treeb407f0b6ed9be27682e3767271e34933c947cb2a /ui/src/interfaces.ts
parent8590a612f633fe6ba8f8b18379a8a822a3b3019b (diff)
Commiting before I lose everything. I'll do this properly in a merge
Diffstat (limited to 'ui/src/interfaces.ts')
-rw-r--r--ui/src/interfaces.ts371
1 files changed, 268 insertions, 103 deletions
diff --git a/ui/src/interfaces.ts b/ui/src/interfaces.ts
index b6139134..d8a570d1 100644
--- a/ui/src/interfaces.ts
+++ b/ui/src/interfaces.ts
@@ -1,5 +1,17 @@
export enum UserOperation {
- Login, Register, CreateCommunity, CreatePost, ListCommunities, ListCategories, GetPost, GetCommunity, CreateComment, EditComment, CreateCommentLike, GetPosts, CreatePostLike, EditPost, EditCommunity, FollowCommunity, GetFollowedCommunities, GetUserDetails
+ Login, Register, CreateCommunity, CreatePost, ListCommunities, ListCategories, GetPost, GetCommunity, CreateComment, EditComment, CreateCommentLike, GetPosts, CreatePostLike, EditPost, EditCommunity, FollowCommunity, GetFollowedCommunities, GetUserDetails, GetModlog, BanFromCommunity, AddModToCommunity
+}
+
+export enum CommentSortType {
+ Hot, Top, New
+}
+
+export enum ListingType {
+ All, Subscribed, Community
+}
+
+export enum SortType {
+ Hot, New, TopDay, TopWeek, TopMonth, TopYear, TopAll
}
export interface User {
@@ -31,6 +43,8 @@ export interface CommunityUser {
export interface Community {
user_id?: number;
subscribed?: boolean;
+ am_mod?: boolean;
+ removed?: boolean;
id: number;
name: string;
title: string;
@@ -46,12 +60,258 @@ export interface Community {
updated?: string;
}
+export interface Post {
+ user_id?: number;
+ my_vote?: number;
+ am_mod?: boolean;
+ removed?: boolean;
+ locked?: boolean;
+ id: number;
+ name: string;
+ url?: string;
+ body?: string;
+ creator_id: number;
+ creator_name: string;
+ community_id: number;
+ community_name: string;
+ number_of_comments: number;
+ score: number;
+ upvotes: number;
+ downvotes: number;
+ hot_rank: number;
+ published: string;
+ updated?: string;
+}
+
+export interface Comment {
+ id: number;
+ content: string;
+ creator_id: number;
+ creator_name: string;
+ post_id: number,
+ community_id: number,
+ parent_id?: number;
+ published: string;
+ updated?: string;
+ score: number;
+ upvotes: number;
+ downvotes: number;
+ my_vote?: number;
+ am_mod?: boolean;
+ removed?: boolean;
+ banned?: boolean;
+}
+
+export interface Category {
+ id: number;
+ name: string;
+}
+
+export interface FollowCommunityForm {
+ community_id: number;
+ follow: boolean;
+ auth?: string;
+}
+
+export interface GetFollowedCommunitiesResponse {
+ op: string;
+ communities: Array<CommunityUser>;
+}
+
+export interface GetUserDetailsForm {
+ user_id: number;
+ sort: string; // TODO figure this one out
+ limit: number;
+ community_id?: number;
+ auth?: string;
+}
+
+export interface UserDetailsResponse {
+ op: string;
+ user: UserView;
+ follows: Array<CommunityUser>;
+ moderates: Array<CommunityUser>;
+ comments: Array<Comment>;
+ posts: Array<Post>;
+ saved?: Array<Post>;
+}
+
+export interface BanFromCommunityForm {
+ community_id: number;
+ user_id: number;
+ ban: boolean;
+ reason?: string,
+ expires?: number,
+ auth?: string;
+}
+
+export interface BanFromCommunityResponse {
+ op: string;
+ user: UserView,
+ banned: boolean,
+}
+
+export interface AddModToCommunityForm {
+ community_id: number;
+ user_id: number;
+ added: boolean;
+ auth?: string;
+}
+
+export interface AddModToCommunityResponse {
+ op: string;
+ moderators: Array<CommunityUser>;
+}
+
+export interface GetModlogForm {
+ mod_user_id?: number;
+ community_id?: number;
+ limit?: number;
+ page?: number;
+}
+
+export interface GetModlogResponse {
+ op: string;
+ removed_posts: Array<ModRemovePost>,
+ locked_posts: Array<ModLockPost>,
+ removed_comments: Array<ModRemoveComment>,
+ removed_communities: Array<ModRemoveCommunity>,
+ banned_from_community: Array<ModBanFromCommunity>,
+ banned: Array<ModBan>,
+ added_to_community: Array<ModAddCommunity>,
+ added: Array<ModAdd>,
+}
+
+export interface ModRemovePost {
+ id: number;
+ mod_user_id: number;
+ post_id: number;
+ reason?: string;
+ removed?: boolean;
+ when_: string
+ mod_user_name: string;
+ post_name: string;
+ community_id: number;
+ community_name: string;
+}
+
+export interface ModLockPost {
+ id: number,
+ mod_user_id: number,
+ post_id: number,
+ locked?: boolean,
+ when_: string,
+ mod_user_name: string,
+ post_name: string,
+ community_id: number,
+ community_name: string,
+}
+
+export interface ModRemoveComment {
+ id: number,
+ mod_user_id: number,
+ comment_id: number,
+ reason?: string,
+ removed?: boolean,
+ when_: string,
+ mod_user_name: string,
+ comment_user_id: number,
+ comment_user_name: string,
+ comment_content: string,
+ post_id: number,
+ post_name: string,
+ community_id: number,
+ community_name: string,
+}
+
+export interface ModRemoveCommunity {
+ id: number,
+ mod_user_id: number,
+ community_id: number,
+ reason?: string,
+ removed?: boolean,
+ expires?: number,
+ when_: string,
+ mod_user_name: string,
+ community_name: string,
+}
+
+export interface ModBanFromCommunity {
+ id: number,
+ mod_user_id: number,
+ other_user_id: number,
+ community_id: number,
+ reason?: string,
+ banned?: boolean,
+ expires?: number,
+ when_: string,
+ mod_user_name: string,
+ other_user_name: string,
+ community_name: string,
+}
+
+export interface ModBan {
+ id: number,
+ mod_user_id: number,
+ other_user_id: number,
+ reason?: string,
+ banned?: boolean,
+ expires?: number,
+ when_: string,
+ mod_user_name: string,
+ other_user_name: string,
+}
+
+export interface ModAddCommunity {
+ id: number,
+ mod_user_id: number,
+ other_user_id: number,
+ community_id: number,
+ removed?: boolean,
+ when_: string,
+ mod_user_name: string,
+ other_user_name: string,
+ community_name: string,
+}
+
+export interface ModAdd {
+ id: number,
+ mod_user_id: number,
+ other_user_id: number,
+ removed?: boolean,
+ when_: string,
+ mod_user_name: string,
+ other_user_name: string,
+}
+
+export interface LoginForm {
+ username_or_email: string;
+ password: string;
+}
+
+export interface RegisterForm {
+ username: string;
+ email?: string;
+ password: string;
+ password_verify: string;
+}
+
+export interface LoginResponse {
+ op: string;
+ jwt: string;
+}
+
+
+
export interface CommunityForm {
name: string;
title: string;
description?: string,
category_id: number,
edit_id?: number;
+ removed?: boolean;
+ reason?: string;
+ expires?: number;
auth?: string;
}
@@ -82,27 +342,6 @@ export interface ListCategoriesResponse {
op: string;
categories: Array<Category>;
}
-
-export interface Post {
- user_id?: number;
- my_vote?: number;
- id: number;
- name: string;
- url?: string;
- body?: string;
- creator_id: number;
- creator_name: string;
- community_id: number;
- community_name: string;
- number_of_comments: number;
- score: number;
- upvotes: number;
- downvotes: number;
- hot_rank: number;
- published: string;
- updated?: string;
-}
-
export interface PostForm {
name: string;
url?: string;
@@ -110,6 +349,10 @@ export interface PostForm {
community_id: number;
updated?: number;
edit_id?: number;
+ creator_id: number;
+ removed?: boolean;
+ reason?: string;
+ locked?: boolean;
auth: string;
}
@@ -126,26 +369,14 @@ export interface PostResponse {
post: Post;
}
-export interface Comment {
- id: number;
- content: string;
- creator_id: number;
- creator_name: string;
- post_id: number,
- parent_id?: number;
- published: string;
- updated?: string;
- score: number;
- upvotes: number;
- downvotes: number;
- my_vote?: number;
-}
-
export interface CommentForm {
content: string;
post_id: number;
parent_id?: number;
edit_id?: number;
+ creator_id: number;
+ removed?: boolean;
+ reason?: string;
auth: string;
}
@@ -190,70 +421,4 @@ export interface CreatePostLikeResponse {
post: Post;
}
-export interface Category {
- id: number;
- name: string;
-}
-
-export interface FollowCommunityForm {
- community_id: number;
- follow: boolean;
- auth?: string;
-}
-
-export interface GetFollowedCommunitiesResponse {
- op: string;
- communities: Array<CommunityUser>;
-}
-
-export interface GetUserDetailsForm {
- user_id: number;
- sort: string; // TODO figure this one out
- limit: number;
- community_id?: number;
- auth?: string;
-}
-
-
-
-export interface UserDetailsResponse {
- op: string;
- user: UserView;
- follows: Array<CommunityUser>;
- moderates: Array<CommunityUser>;
- comments: Array<Comment>;
- posts: Array<Post>;
- saved?: Array<Post>;
-}
-
-
-export interface LoginForm {
- username_or_email: string;
- password: string;
-}
-
-export interface RegisterForm {
- username: string;
- email?: string;
- password: string;
- password_verify: string;
-}
-
-
-export interface LoginResponse {
- op: string;
- jwt: string;
-}
-
-export enum CommentSortType {
- Hot, Top, New
-}
-
-export enum ListingType {
- All, Subscribed, Community
-}
-
-export enum SortType {
- Hot, New, TopDay, TopWeek, TopMonth, TopYear, TopAll
-}