2019-11-21 18:06:50 +01:00
|
|
|
import { WelcomeController } from "./WelcomeController";
|
2019-11-22 08:50:15 +01:00
|
|
|
import { RequestHandler } from "../entities/RequestHandler";
|
|
|
|
import { AccountController } from "./AccountController";
|
2019-11-23 15:11:33 +01:00
|
|
|
import { UserController } from "./UserController";
|
2019-11-23 18:41:13 +01:00
|
|
|
import { ConversationsController } from "./ConversationsController";
|
2019-11-30 09:28:50 +01:00
|
|
|
import { SearchController } from "./SearchController";
|
2019-12-13 17:49:58 +01:00
|
|
|
import { GroupsController } from "./GroupsController";
|
2019-12-27 18:56:22 +01:00
|
|
|
import { NotificationsController } from "./NotificationsController";
|
2019-12-28 13:07:26 +01:00
|
|
|
import { VirtualDirectoryController } from "./VirtualDirectoryController";
|
2019-12-28 16:52:52 +01:00
|
|
|
import { WebAppControllers } from "./WebAppController";
|
2019-12-28 16:58:06 +01:00
|
|
|
import { CallsController } from "./CallsController";
|
2019-12-31 09:54:29 +01:00
|
|
|
import { FriendsController } from "./FriendsController";
|
2020-01-03 08:39:59 +01:00
|
|
|
import { MoviesController } from "./MoviesController";
|
2020-01-03 10:17:34 +01:00
|
|
|
import { PostsController } from "./PostsController";
|
2020-03-21 09:20:34 +01:00
|
|
|
import { CommentsController } from "./CommentsController";
|
2020-03-21 12:07:52 +01:00
|
|
|
import { LikesController } from "./LikesController";
|
2020-03-21 16:34:20 +01:00
|
|
|
import { SurveyController } from "./SurveyController";
|
2020-03-21 17:16:30 +01:00
|
|
|
import { SettingsController } from "./SettingsController";
|
2019-11-21 18:06:50 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Controllers routes
|
|
|
|
*
|
|
|
|
* @author Pierre Hubert
|
|
|
|
*/
|
|
|
|
|
|
|
|
export enum RouteType {
|
|
|
|
POST, // Default
|
|
|
|
GET
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Route {
|
|
|
|
type ?: RouteType,
|
|
|
|
path: string,
|
2019-11-23 13:24:24 +01:00
|
|
|
cb: (req : RequestHandler) => Promise<void> | void,
|
2019-11-23 13:47:06 +01:00
|
|
|
needLogin ?: boolean, // Default = true
|
2019-11-21 18:06:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export const Routes : Route[] = [
|
|
|
|
|
|
|
|
// Welcome controller
|
2019-11-23 13:47:06 +01:00
|
|
|
{type: RouteType.GET, path: "/", cb: WelcomeController.HomeMessage, needLogin: false},
|
2019-11-21 18:06:50 +01:00
|
|
|
|
2019-11-22 08:50:15 +01:00
|
|
|
// Account controller
|
2019-12-30 13:44:54 +01:00
|
|
|
{path: "/account/create", cb: (h) => AccountController.Create(h), needLogin: false},
|
|
|
|
|
2019-11-23 15:23:48 +01:00
|
|
|
{path: "/account/login", cb: (h) => AccountController.LoginUser(h), needLogin: false},
|
|
|
|
{path: "/user/connectUSER", cb: (h) => AccountController.LoginUser(h), needLogin: false}, // Legacy
|
2019-11-23 14:03:14 +01:00
|
|
|
|
2019-11-23 15:23:48 +01:00
|
|
|
{path: "/account/logout", cb: (h) => AccountController.LogoutUser(h)},
|
|
|
|
{path: "/user/disconnectUSER", cb: (h) => AccountController.LogoutUser(h)}, // Legacy
|
2019-11-23 13:48:16 +01:00
|
|
|
|
2019-11-23 15:23:48 +01:00
|
|
|
{path: "/account/id", cb: (h) => AccountController.CurrentUserID(h)},
|
|
|
|
{path: "/user/getCurrentUserID", cb: (h) => AccountController.CurrentUserID(h)}, // Legacy
|
2019-11-23 15:11:33 +01:00
|
|
|
|
2019-12-28 17:05:24 +01:00
|
|
|
{path: "/account/exists_email", cb: (h) => AccountController.ExistsMail(h), needLogin: false},
|
|
|
|
|
2019-12-29 19:40:35 +01:00
|
|
|
{path: "/account/has_security_questions", cb: (h) => AccountController.HasSecurityQuestions(h), needLogin: false},
|
|
|
|
|
2019-12-30 08:16:10 +01:00
|
|
|
{path: "/account/get_security_questions", cb: (h) => AccountController.GetSecurityQuestions(h), needLogin: false},
|
|
|
|
|
2019-12-30 08:36:55 +01:00
|
|
|
{path: "/account/check_security_answers", cb: (h) => AccountController.CheckSecurityAnswers(h), needLogin: false},
|
|
|
|
|
2019-12-30 12:11:33 +01:00
|
|
|
{path: "/account/check_password_reset_token", cb: (h) => AccountController.CheckPasswordResetToken(h), needLogin: false},
|
|
|
|
|
2019-12-30 13:20:24 +01:00
|
|
|
{path: "/account/reset_user_passwd", cb: (h) => AccountController.ResetUserPassword(h), needLogin: false},
|
|
|
|
|
2019-12-30 13:50:59 +01:00
|
|
|
{path: "/account/export_data", cb: (h) => AccountController.ExportData(h)},
|
|
|
|
|
|
|
|
{path: "/account/delete", cb: (h) => AccountController.DeleteAccount(h)},
|
|
|
|
|
2019-11-23 15:11:33 +01:00
|
|
|
|
|
|
|
// User controller
|
2019-11-23 15:23:48 +01:00
|
|
|
{path: "/user/getInfo", cb: (h) => UserController.GetSingle(h), needLogin: false},
|
|
|
|
{path: "/user/getInfos", cb: (h) => UserController.GetSingle(h), needLogin: false}, // Legacy
|
2019-11-23 15:11:33 +01:00
|
|
|
|
2019-11-23 15:23:48 +01:00
|
|
|
{path: "/user/getInfoMultiple", cb: (h) => UserController.GetMultiple(h), needLogin: false},
|
|
|
|
{path: "/user/getInfosMultiple", cb: (h) => UserController.GetMultiple(h), needLogin: false}, // Legacy
|
2019-11-23 18:41:13 +01:00
|
|
|
|
2019-12-28 13:38:17 +01:00
|
|
|
{path: "/user/getAdvancedUserInfo", cb: (h) => UserController.GetAdvancedInfo(h), needLogin: false},
|
|
|
|
{path: "/user/getAdvancedUserInfos", cb: (h) => UserController.GetAdvancedInfo(h), needLogin: false}, // Legacy
|
|
|
|
|
2019-11-23 18:41:13 +01:00
|
|
|
|
2020-03-21 17:16:30 +01:00
|
|
|
// Settings controller
|
|
|
|
{path: "/settings/get_general", cb: (h) => SettingsController.GetGeneral(h)},
|
2020-03-21 18:05:17 +01:00
|
|
|
|
|
|
|
{path: "/settings/set_general", cb: (h) => SettingsController.SetGeneral(h)},
|
|
|
|
|
2020-03-21 18:09:47 +01:00
|
|
|
{path: "/settings/check_user_directory_availability", cb: (h) => SettingsController.CheckDirectoryAvailability(h)},
|
|
|
|
|
2020-03-21 18:45:45 +01:00
|
|
|
{path: "/settings/get_language", cb: (h) => SettingsController.GetLanguage(h)},
|
|
|
|
|
2020-03-21 18:54:30 +01:00
|
|
|
{path: "/settings/set_language", cb: (h) => SettingsController.SetLanguage(h)},
|
|
|
|
|
2020-03-21 19:00:08 +01:00
|
|
|
{path: "/settings/get_security", cb: (h) => SettingsController.GetSecurity(h)},
|
|
|
|
|
2020-03-22 14:18:59 +01:00
|
|
|
{path: "/settings/set_security", cb: (h) => SettingsController.SetSecurity(h)},
|
|
|
|
|
2020-03-22 14:26:11 +01:00
|
|
|
{path: "/settings/update_password", cb: (h) => SettingsController.UpdatePassword(h)},
|
|
|
|
|
2020-03-22 14:36:44 +01:00
|
|
|
{path: "/settings/get_account_image", cb: (h) => SettingsController.GetAccountImageSettings(h)},
|
|
|
|
|
2020-03-22 15:00:08 +01:00
|
|
|
{path: "/settings/upload_account_image", cb: (h) => SettingsController.UploadAccountImage(h)},
|
|
|
|
|
2020-03-22 15:05:05 +01:00
|
|
|
{path: "/settings/delete_account_image", cb: (h) => SettingsController.DeleteAccountImage(h)},
|
|
|
|
|
2020-03-22 15:15:12 +01:00
|
|
|
{path: "/settings/set_account_image_visibility", cb: (h) => SettingsController.SetAccountImageVisibility(h)},
|
|
|
|
|
2020-03-21 17:16:30 +01:00
|
|
|
|
2019-12-31 09:54:29 +01:00
|
|
|
// Friends controller
|
|
|
|
{path: "/friends/getList", cb: (h) => FriendsController.GetList(h)},
|
|
|
|
|
|
|
|
{path: "/friends/get_user_list", cb: (h) => FriendsController.GetOtherUserList(h), needLogin: false},
|
|
|
|
|
2019-12-31 10:08:04 +01:00
|
|
|
{path: "/friends/get_single_infos", cb: (h) => FriendsController.GetSingleFrienshipInfo(h)},
|
|
|
|
|
2019-12-31 10:33:38 +01:00
|
|
|
{path: "/friends/getStatus", cb: (h) => FriendsController.GetStatus(h)},
|
|
|
|
|
2019-12-31 10:47:55 +01:00
|
|
|
{path: "/friends/sendRequest", cb: (h) => FriendsController.SendRequest(h)},
|
|
|
|
|
2020-01-01 11:52:34 +01:00
|
|
|
{path: "/friends/removeRequest", cb: (h) => FriendsController.CancelRequest(h)},
|
|
|
|
|
2020-01-01 12:07:26 +01:00
|
|
|
{path: "/friends/respondRequest", cb: (h) => FriendsController.RespondRequest(h)},
|
|
|
|
|
2020-01-01 12:17:24 +01:00
|
|
|
{path: "/friends/remove", cb: (h) => FriendsController.RemoveFriend(h)},
|
|
|
|
|
2020-01-01 14:58:31 +01:00
|
|
|
{path: "/friends/setFollowing", cb: (h) => FriendsController.SetFollowing(h)},
|
|
|
|
|
2020-01-01 15:08:15 +01:00
|
|
|
{path: "/friends/set_can_post_texts", cb: (h) => FriendsController.SetCanPostTexts(h)},
|
|
|
|
|
2019-12-31 09:54:29 +01:00
|
|
|
|
2019-11-23 18:41:13 +01:00
|
|
|
// Conversations controller
|
2019-11-30 10:11:51 +01:00
|
|
|
{path: "/conversations/create", cb: (h) => ConversationsController.CreateConversation(h)},
|
|
|
|
|
2019-11-23 18:41:13 +01:00
|
|
|
{path: "/conversations/getList", cb: (h) => ConversationsController.GetList(h)},
|
2019-11-23 20:53:13 +01:00
|
|
|
|
|
|
|
{path: "/conversations/getInfoOne", cb: (h) => ConversationsController.GetInfoSingle(h)},
|
|
|
|
{path: "/conversations/getInfosOne", cb: (h) => ConversationsController.GetInfoSingle(h)}, // Legacy
|
2019-11-30 09:28:50 +01:00
|
|
|
|
2019-11-30 12:24:19 +01:00
|
|
|
{path: "/conversations/updateSettings", cb: (h) => ConversationsController.UpdateSettings(h)},
|
2019-11-30 09:28:50 +01:00
|
|
|
|
2019-12-07 12:00:28 +01:00
|
|
|
{path: "/conversations/getPrivate", cb: (h) => ConversationsController.FindPrivate(h)},
|
|
|
|
|
2019-11-30 15:17:47 +01:00
|
|
|
{path: "/conversations/refresh", cb: (h) => ConversationsController.RefreshList(h)},
|
2019-11-30 16:44:27 +01:00
|
|
|
|
|
|
|
{path: "/conversations/refresh_single", cb: (h) => ConversationsController.RefreshSingleConversation(h)},
|
2019-11-30 17:13:36 +01:00
|
|
|
|
|
|
|
{path: "/conversations/sendMessage", cb: (h) => ConversationsController.SendMessage(h)},
|
2019-12-07 17:08:53 +01:00
|
|
|
|
|
|
|
{path: "/conversations/get_older_messages", cb: (h) => ConversationsController.GetOlderMessages(h)},
|
2019-12-07 17:15:33 +01:00
|
|
|
|
2019-12-07 17:35:14 +01:00
|
|
|
{path: "/conversations/get_number_unread", cb: (h) => ConversationsController.CountUnreadForUser(h)},
|
|
|
|
|
|
|
|
{path: "/conversations/get_list_unread", cb: (h) => ConversationsController.GetListUnread(h)},
|
2019-12-07 18:06:41 +01:00
|
|
|
|
|
|
|
{path: "/conversations/delete", cb: (h) => ConversationsController.DeleteConversation(h)},
|
2019-12-07 18:39:59 +01:00
|
|
|
|
|
|
|
{path: "/conversations/updateMessage", cb: (h) => ConversationsController.UpdateMessage(h)},
|
2019-12-07 18:52:20 +01:00
|
|
|
|
|
|
|
{path: "/conversations/deleteMessage", cb: (h) => ConversationsController.DeleteMessage(h)},
|
2019-11-30 15:17:47 +01:00
|
|
|
|
|
|
|
|
2019-11-30 09:28:50 +01:00
|
|
|
// Search controller
|
|
|
|
{path: "/search/user", cb: (h) => SearchController.SearchUser(h)},
|
|
|
|
{path: "/user/search", cb: (h) => SearchController.SearchUser(h)}, // Legacy
|
2019-12-13 17:49:58 +01:00
|
|
|
|
2020-03-21 15:00:46 +01:00
|
|
|
{path: "/search/global", cb: (h) => SearchController.SearchGlobal(h)},
|
|
|
|
|
2019-12-13 17:49:58 +01:00
|
|
|
|
|
|
|
// Groups controller
|
2019-12-24 18:47:55 +01:00
|
|
|
{path: "/groups/create", cb: (h) => GroupsController.Create(h)},
|
|
|
|
|
2019-12-13 17:49:58 +01:00
|
|
|
{path: "/groups/get_my_list", cb: (h) => GroupsController.GetListUser(h)},
|
2019-12-13 18:30:08 +01:00
|
|
|
|
|
|
|
{path: "/groups/get_info", cb: (h) => GroupsController.GetInfoSingle(h)},
|
2019-12-24 18:32:44 +01:00
|
|
|
|
|
|
|
{path: "/groups/get_multiple_info", cb: (h) => GroupsController.GetInfoMultiple(h)},
|
2019-12-24 19:10:45 +01:00
|
|
|
|
2019-12-25 15:37:09 +01:00
|
|
|
{path: "/groups/get_advanced_info", cb: (h) => GroupsController.GetAdvancedInfo(h), needLogin: false},
|
2019-12-25 15:43:43 +01:00
|
|
|
|
|
|
|
{path: "/groups/get_settings", cb: (h) => GroupsController.GetSettings(h)},
|
2019-12-26 13:49:17 +01:00
|
|
|
|
|
|
|
{path: "/groups/set_settings", cb: (h) => GroupsController.SetSettings(h)},
|
2019-12-26 13:56:28 +01:00
|
|
|
|
|
|
|
{path: "/groups/checkVirtualDirectory", cb: (h) => GroupsController.CheckVirtualDirectory(h)},
|
2019-12-26 14:14:42 +01:00
|
|
|
|
|
|
|
{path: "/groups/upload_logo", cb: (h) => GroupsController.UploadLogo(h)},
|
|
|
|
|
|
|
|
{path: "/groups/delete_logo", cb: (h) => GroupsController.DeleteLogo(h)},
|
2019-12-26 14:26:46 +01:00
|
|
|
|
|
|
|
{path: "/groups/get_members", cb: (h) => GroupsController.GetMembers(h)},
|
2019-12-26 17:55:29 +01:00
|
|
|
|
|
|
|
{path: "/groups/invite", cb: (h) => GroupsController.InviteUser(h)},
|
2019-12-26 18:16:44 +01:00
|
|
|
|
|
|
|
{path: "/groups/respond_invitation", cb: (h) => GroupsController.RespondInvitation(h)},
|
2019-12-27 09:57:28 +01:00
|
|
|
|
|
|
|
{path: "/groups/send_request", cb: (h) => GroupsController.SendRequest(h)},
|
2019-12-27 10:02:05 +01:00
|
|
|
|
|
|
|
{path: "/groups/cancel_request", cb: (h) => GroupsController.CancelRequest(h)},
|
2019-12-27 10:28:43 +01:00
|
|
|
|
|
|
|
{path: "/groups/delete_member", cb: (h) => GroupsController.DeleteMember(h)},
|
2019-12-27 10:52:59 +01:00
|
|
|
|
|
|
|
{path: "/groups/update_membership_level", cb: (h) => GroupsController.UpdateMembership(h)},
|
2019-12-27 11:04:49 +01:00
|
|
|
|
|
|
|
{path: "/groups/respond_request", cb: (h) => GroupsController.RespondRequest(h)},
|
2019-12-27 11:11:05 +01:00
|
|
|
|
|
|
|
{path: "/groups/get_membership", cb: (h) => GroupsController.GetMembership(h)},
|
2019-12-27 18:24:18 +01:00
|
|
|
|
|
|
|
{path: "/groups/cancel_invitation", cb: (h) => GroupsController.CancelInvitation(h)},
|
2019-12-27 18:31:31 +01:00
|
|
|
|
|
|
|
{path: "/groups/remove_membership", cb: (h) => GroupsController.RemoveMembership(h)},
|
2019-12-27 18:38:14 +01:00
|
|
|
|
|
|
|
{path: "/groups/set_following", cb: (h) => GroupsController.SetFollowing(h)},
|
2019-12-27 18:49:40 +01:00
|
|
|
|
|
|
|
{path: "/groups/delete", cb: (h) => GroupsController.DeleteGroup(h)},
|
2019-12-27 18:56:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2020-01-03 10:17:34 +01:00
|
|
|
// Posts controller
|
|
|
|
{path: "/posts/get_user", cb: (h) => PostsController.GetListUser(h), needLogin: false},
|
|
|
|
|
2020-01-04 10:27:54 +01:00
|
|
|
{path: "/posts/get_group", cb: (h) => PostsController.GetListGroup(h), needLogin: false},
|
|
|
|
|
2020-01-04 11:30:33 +01:00
|
|
|
{path: "/posts/get_latest", cb: (h) => PostsController.GetLatest(h)},
|
|
|
|
|
2020-01-04 12:04:14 +01:00
|
|
|
{path: "/posts/get_single", cb: (h) => PostsController.GetSingle(h), needLogin: false},
|
|
|
|
|
2020-01-04 15:07:24 +01:00
|
|
|
{path: "/posts/create", cb: (h) => PostsController.CreatePost(h)},
|
|
|
|
|
2020-03-20 13:41:50 +01:00
|
|
|
{path: "/posts/set_visibility_level", cb: (h) => PostsController.SetVisibilityLevel(h)},
|
|
|
|
|
2020-03-20 18:41:32 +01:00
|
|
|
{path: "/posts/update_content", cb: (h) => PostsController.UpdateContent(h)},
|
|
|
|
|
2020-03-20 18:47:28 +01:00
|
|
|
{path: "/posts/delete", cb: (h) => PostsController.DeletePost(h)},
|
|
|
|
|
2020-03-21 09:15:21 +01:00
|
|
|
{path: "/posts/getAvailableTargets", cb: (h) => PostsController.GetTargets(h)},
|
|
|
|
|
2020-01-03 10:17:34 +01:00
|
|
|
|
2020-03-21 09:20:34 +01:00
|
|
|
// Comments controller
|
|
|
|
{path: "/comments/create", cb: (h) => CommentsController.Create(h)},
|
|
|
|
|
2020-03-21 11:49:52 +01:00
|
|
|
{path: "/comments/get_single", cb: (h) => CommentsController.GetSingle(h)},
|
|
|
|
|
2020-03-21 12:01:42 +01:00
|
|
|
{path: "/comments/edit", cb: (h) => CommentsController.Edit(h)},
|
|
|
|
|
2020-03-21 12:04:04 +01:00
|
|
|
{path: "/comments/delete", cb: (h) => CommentsController.Delete(h)},
|
|
|
|
|
2020-01-03 10:17:34 +01:00
|
|
|
|
2020-03-21 12:07:52 +01:00
|
|
|
// Likes controller
|
|
|
|
{path: "/likes/update", cb: (h) => LikesController.Update(h)},
|
|
|
|
|
|
|
|
|
2020-03-21 16:34:20 +01:00
|
|
|
// Surveys controller
|
|
|
|
{path: "/surveys/send_response", cb: (h) => SurveyController.SendResponse(h)},
|
|
|
|
|
2020-03-21 16:36:46 +01:00
|
|
|
{path: "/surveys/cancel_response", cb: (h) => SurveyController.CancelResponse(h)},
|
|
|
|
|
2020-03-21 16:34:20 +01:00
|
|
|
|
2019-12-27 18:56:22 +01:00
|
|
|
// Notifications controller
|
|
|
|
{path: "/notifications/count_unread", cb: (h) => NotificationsController.CountUnread(h)},
|
2019-12-27 19:05:29 +01:00
|
|
|
|
|
|
|
{path: "/notifications/count_all_news", cb: (h) => NotificationsController.CountAllNews(h)},
|
2019-12-28 12:57:55 +01:00
|
|
|
|
|
|
|
{path: "/notifications/get_list_unread", cb: (h) => NotificationsController.GetListUnread(h)},
|
2019-12-28 13:07:26 +01:00
|
|
|
|
2020-03-25 08:23:09 +01:00
|
|
|
{path: "/notifications/mark_seen", cb: (h) => NotificationsController.MarkSeen(h)},
|
|
|
|
|
2020-03-25 08:30:19 +01:00
|
|
|
{path: "/notifications/delete_all", cb: (h) => NotificationsController.DeleteAll(h)},
|
|
|
|
|
2019-12-28 13:07:26 +01:00
|
|
|
|
|
|
|
|
2020-01-03 08:39:59 +01:00
|
|
|
// Movies controller
|
|
|
|
{path: "/movies/get_list", cb: (h) => MoviesController.GetList(h)},
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-12-28 13:07:26 +01:00
|
|
|
// Virtual directory controller
|
2019-12-28 14:34:42 +01:00
|
|
|
{path: "/user/findbyfolder", cb: (h) => VirtualDirectoryController.FindUser(h)},
|
|
|
|
|
2019-12-28 13:07:26 +01:00
|
|
|
{path: "/virtualDirectory/find", cb: (h) => VirtualDirectoryController.Find(h)},
|
2019-12-28 13:38:17 +01:00
|
|
|
|
2019-12-28 16:52:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
// Web app controller
|
|
|
|
{path: "/webApp/getMemberships", cb: (h) => WebAppControllers.GetMemberships(h)},
|
2019-12-28 16:58:06 +01:00
|
|
|
|
|
|
|
// Calls controller
|
|
|
|
{path: "/calls/config", cb: (h) => CallsController.GetConfig(h)},
|
2019-12-28 16:52:52 +01:00
|
|
|
|
2019-11-21 18:06:50 +01:00
|
|
|
]
|