2019-11-21 17:06:50 +00:00
|
|
|
import { WelcomeController } from "./WelcomeController";
|
2019-11-22 07:50:15 +00:00
|
|
|
import { RequestHandler } from "../entities/RequestHandler";
|
|
|
|
import { AccountController } from "./AccountController";
|
2019-11-23 14:11:33 +00:00
|
|
|
import { UserController } from "./UserController";
|
2019-11-23 17:41:13 +00:00
|
|
|
import { ConversationsController } from "./ConversationsController";
|
2019-11-30 08:28:50 +00:00
|
|
|
import { SearchController } from "./SearchController";
|
2019-12-13 16:49:58 +00:00
|
|
|
import { GroupsController } from "./GroupsController";
|
2019-12-27 17:56:22 +00:00
|
|
|
import { NotificationsController } from "./NotificationsController";
|
2019-12-28 12:07:26 +00:00
|
|
|
import { VirtualDirectoryController } from "./VirtualDirectoryController";
|
2019-12-28 15:52:52 +00:00
|
|
|
import { WebAppControllers } from "./WebAppController";
|
2019-12-28 15:58:06 +00:00
|
|
|
import { CallsController } from "./CallsController";
|
2019-12-31 08:54:29 +00:00
|
|
|
import { FriendsController } from "./FriendsController";
|
2019-11-21 17:06:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Controllers routes
|
|
|
|
*
|
|
|
|
* @author Pierre Hubert
|
|
|
|
*/
|
|
|
|
|
|
|
|
export enum RouteType {
|
|
|
|
POST, // Default
|
|
|
|
GET
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Route {
|
|
|
|
type ?: RouteType,
|
|
|
|
path: string,
|
2019-11-23 12:24:24 +00:00
|
|
|
cb: (req : RequestHandler) => Promise<void> | void,
|
2019-11-23 12:47:06 +00:00
|
|
|
needLogin ?: boolean, // Default = true
|
2019-11-21 17:06:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const Routes : Route[] = [
|
|
|
|
|
|
|
|
// Welcome controller
|
2019-11-23 12:47:06 +00:00
|
|
|
{type: RouteType.GET, path: "/", cb: WelcomeController.HomeMessage, needLogin: false},
|
2019-11-21 17:06:50 +00:00
|
|
|
|
2019-11-22 07:50:15 +00:00
|
|
|
// Account controller
|
2019-12-30 12:44:54 +00:00
|
|
|
{path: "/account/create", cb: (h) => AccountController.Create(h), needLogin: false},
|
|
|
|
|
2019-11-23 14:23:48 +00: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 13:03:14 +00:00
|
|
|
|
2019-11-23 14:23:48 +00:00
|
|
|
{path: "/account/logout", cb: (h) => AccountController.LogoutUser(h)},
|
|
|
|
{path: "/user/disconnectUSER", cb: (h) => AccountController.LogoutUser(h)}, // Legacy
|
2019-11-23 12:48:16 +00:00
|
|
|
|
2019-11-23 14:23:48 +00:00
|
|
|
{path: "/account/id", cb: (h) => AccountController.CurrentUserID(h)},
|
|
|
|
{path: "/user/getCurrentUserID", cb: (h) => AccountController.CurrentUserID(h)}, // Legacy
|
2019-11-23 14:11:33 +00:00
|
|
|
|
2019-12-28 16:05:24 +00:00
|
|
|
{path: "/account/exists_email", cb: (h) => AccountController.ExistsMail(h), needLogin: false},
|
|
|
|
|
2019-12-29 18:40:35 +00:00
|
|
|
{path: "/account/has_security_questions", cb: (h) => AccountController.HasSecurityQuestions(h), needLogin: false},
|
|
|
|
|
2019-12-30 07:16:10 +00:00
|
|
|
{path: "/account/get_security_questions", cb: (h) => AccountController.GetSecurityQuestions(h), needLogin: false},
|
|
|
|
|
2019-12-30 07:36:55 +00:00
|
|
|
{path: "/account/check_security_answers", cb: (h) => AccountController.CheckSecurityAnswers(h), needLogin: false},
|
|
|
|
|
2019-12-30 11:11:33 +00:00
|
|
|
{path: "/account/check_password_reset_token", cb: (h) => AccountController.CheckPasswordResetToken(h), needLogin: false},
|
|
|
|
|
2019-12-30 12:20:24 +00:00
|
|
|
{path: "/account/reset_user_passwd", cb: (h) => AccountController.ResetUserPassword(h), needLogin: false},
|
|
|
|
|
2019-12-30 12:50:59 +00:00
|
|
|
{path: "/account/export_data", cb: (h) => AccountController.ExportData(h)},
|
|
|
|
|
|
|
|
{path: "/account/delete", cb: (h) => AccountController.DeleteAccount(h)},
|
|
|
|
|
2019-11-23 14:11:33 +00:00
|
|
|
|
|
|
|
// User controller
|
2019-11-23 14:23:48 +00: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 14:11:33 +00:00
|
|
|
|
2019-11-23 14:23:48 +00: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 17:41:13 +00:00
|
|
|
|
2019-12-28 12:38:17 +00: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 17:41:13 +00:00
|
|
|
|
2019-12-31 08:54:29 +00: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 09:08:04 +00:00
|
|
|
{path: "/friends/get_single_infos", cb: (h) => FriendsController.GetSingleFrienshipInfo(h)},
|
|
|
|
|
2019-12-31 08:54:29 +00:00
|
|
|
|
2019-11-23 17:41:13 +00:00
|
|
|
// Conversations controller
|
2019-11-30 09:11:51 +00:00
|
|
|
{path: "/conversations/create", cb: (h) => ConversationsController.CreateConversation(h)},
|
|
|
|
|
2019-11-23 17:41:13 +00:00
|
|
|
{path: "/conversations/getList", cb: (h) => ConversationsController.GetList(h)},
|
2019-11-23 19:53:13 +00:00
|
|
|
|
|
|
|
{path: "/conversations/getInfoOne", cb: (h) => ConversationsController.GetInfoSingle(h)},
|
|
|
|
{path: "/conversations/getInfosOne", cb: (h) => ConversationsController.GetInfoSingle(h)}, // Legacy
|
2019-11-30 08:28:50 +00:00
|
|
|
|
2019-11-30 11:24:19 +00:00
|
|
|
{path: "/conversations/updateSettings", cb: (h) => ConversationsController.UpdateSettings(h)},
|
2019-11-30 08:28:50 +00:00
|
|
|
|
2019-12-07 11:00:28 +00:00
|
|
|
{path: "/conversations/getPrivate", cb: (h) => ConversationsController.FindPrivate(h)},
|
|
|
|
|
2019-11-30 14:17:47 +00:00
|
|
|
{path: "/conversations/refresh", cb: (h) => ConversationsController.RefreshList(h)},
|
2019-11-30 15:44:27 +00:00
|
|
|
|
|
|
|
{path: "/conversations/refresh_single", cb: (h) => ConversationsController.RefreshSingleConversation(h)},
|
2019-11-30 16:13:36 +00:00
|
|
|
|
|
|
|
{path: "/conversations/sendMessage", cb: (h) => ConversationsController.SendMessage(h)},
|
2019-12-07 16:08:53 +00:00
|
|
|
|
|
|
|
{path: "/conversations/get_older_messages", cb: (h) => ConversationsController.GetOlderMessages(h)},
|
2019-12-07 16:15:33 +00:00
|
|
|
|
2019-12-07 16:35:14 +00:00
|
|
|
{path: "/conversations/get_number_unread", cb: (h) => ConversationsController.CountUnreadForUser(h)},
|
|
|
|
|
|
|
|
{path: "/conversations/get_list_unread", cb: (h) => ConversationsController.GetListUnread(h)},
|
2019-12-07 17:06:41 +00:00
|
|
|
|
|
|
|
{path: "/conversations/delete", cb: (h) => ConversationsController.DeleteConversation(h)},
|
2019-12-07 17:39:59 +00:00
|
|
|
|
|
|
|
{path: "/conversations/updateMessage", cb: (h) => ConversationsController.UpdateMessage(h)},
|
2019-12-07 17:52:20 +00:00
|
|
|
|
|
|
|
{path: "/conversations/deleteMessage", cb: (h) => ConversationsController.DeleteMessage(h)},
|
2019-11-30 14:17:47 +00:00
|
|
|
|
|
|
|
|
2019-11-30 08:28:50 +00:00
|
|
|
// Search controller
|
|
|
|
{path: "/search/user", cb: (h) => SearchController.SearchUser(h)},
|
|
|
|
{path: "/user/search", cb: (h) => SearchController.SearchUser(h)}, // Legacy
|
2019-12-13 16:49:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Groups controller
|
2019-12-24 17:47:55 +00:00
|
|
|
{path: "/groups/create", cb: (h) => GroupsController.Create(h)},
|
|
|
|
|
2019-12-13 16:49:58 +00:00
|
|
|
{path: "/groups/get_my_list", cb: (h) => GroupsController.GetListUser(h)},
|
2019-12-13 17:30:08 +00:00
|
|
|
|
|
|
|
{path: "/groups/get_info", cb: (h) => GroupsController.GetInfoSingle(h)},
|
2019-12-24 17:32:44 +00:00
|
|
|
|
|
|
|
{path: "/groups/get_multiple_info", cb: (h) => GroupsController.GetInfoMultiple(h)},
|
2019-12-24 18:10:45 +00:00
|
|
|
|
2019-12-25 14:37:09 +00:00
|
|
|
{path: "/groups/get_advanced_info", cb: (h) => GroupsController.GetAdvancedInfo(h), needLogin: false},
|
2019-12-25 14:43:43 +00:00
|
|
|
|
|
|
|
{path: "/groups/get_settings", cb: (h) => GroupsController.GetSettings(h)},
|
2019-12-26 12:49:17 +00:00
|
|
|
|
|
|
|
{path: "/groups/set_settings", cb: (h) => GroupsController.SetSettings(h)},
|
2019-12-26 12:56:28 +00:00
|
|
|
|
|
|
|
{path: "/groups/checkVirtualDirectory", cb: (h) => GroupsController.CheckVirtualDirectory(h)},
|
2019-12-26 13:14:42 +00:00
|
|
|
|
|
|
|
{path: "/groups/upload_logo", cb: (h) => GroupsController.UploadLogo(h)},
|
|
|
|
|
|
|
|
{path: "/groups/delete_logo", cb: (h) => GroupsController.DeleteLogo(h)},
|
2019-12-26 13:26:46 +00:00
|
|
|
|
|
|
|
{path: "/groups/get_members", cb: (h) => GroupsController.GetMembers(h)},
|
2019-12-26 16:55:29 +00:00
|
|
|
|
|
|
|
{path: "/groups/invite", cb: (h) => GroupsController.InviteUser(h)},
|
2019-12-26 17:16:44 +00:00
|
|
|
|
|
|
|
{path: "/groups/respond_invitation", cb: (h) => GroupsController.RespondInvitation(h)},
|
2019-12-27 08:57:28 +00:00
|
|
|
|
|
|
|
{path: "/groups/send_request", cb: (h) => GroupsController.SendRequest(h)},
|
2019-12-27 09:02:05 +00:00
|
|
|
|
|
|
|
{path: "/groups/cancel_request", cb: (h) => GroupsController.CancelRequest(h)},
|
2019-12-27 09:28:43 +00:00
|
|
|
|
|
|
|
{path: "/groups/delete_member", cb: (h) => GroupsController.DeleteMember(h)},
|
2019-12-27 09:52:59 +00:00
|
|
|
|
|
|
|
{path: "/groups/update_membership_level", cb: (h) => GroupsController.UpdateMembership(h)},
|
2019-12-27 10:04:49 +00:00
|
|
|
|
|
|
|
{path: "/groups/respond_request", cb: (h) => GroupsController.RespondRequest(h)},
|
2019-12-27 10:11:05 +00:00
|
|
|
|
|
|
|
{path: "/groups/get_membership", cb: (h) => GroupsController.GetMembership(h)},
|
2019-12-27 17:24:18 +00:00
|
|
|
|
|
|
|
{path: "/groups/cancel_invitation", cb: (h) => GroupsController.CancelInvitation(h)},
|
2019-12-27 17:31:31 +00:00
|
|
|
|
|
|
|
{path: "/groups/remove_membership", cb: (h) => GroupsController.RemoveMembership(h)},
|
2019-12-27 17:38:14 +00:00
|
|
|
|
|
|
|
{path: "/groups/set_following", cb: (h) => GroupsController.SetFollowing(h)},
|
2019-12-27 17:49:40 +00:00
|
|
|
|
|
|
|
{path: "/groups/delete", cb: (h) => GroupsController.DeleteGroup(h)},
|
2019-12-27 17:56:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Notifications controller
|
|
|
|
{path: "/notifications/count_unread", cb: (h) => NotificationsController.CountUnread(h)},
|
2019-12-27 18:05:29 +00:00
|
|
|
|
|
|
|
{path: "/notifications/count_all_news", cb: (h) => NotificationsController.CountAllNews(h)},
|
2019-12-28 11:57:55 +00:00
|
|
|
|
|
|
|
{path: "/notifications/get_list_unread", cb: (h) => NotificationsController.GetListUnread(h)},
|
2019-12-28 12:07:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Virtual directory controller
|
2019-12-28 13:34:42 +00:00
|
|
|
{path: "/user/findbyfolder", cb: (h) => VirtualDirectoryController.FindUser(h)},
|
|
|
|
|
2019-12-28 12:07:26 +00:00
|
|
|
{path: "/virtualDirectory/find", cb: (h) => VirtualDirectoryController.Find(h)},
|
2019-12-28 12:38:17 +00:00
|
|
|
|
2019-12-28 15:52:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Web app controller
|
|
|
|
{path: "/webApp/getMemberships", cb: (h) => WebAppControllers.GetMemberships(h)},
|
2019-12-28 15:58:06 +00:00
|
|
|
|
|
|
|
// Calls controller
|
|
|
|
{path: "/calls/config", cb: (h) => CallsController.GetConfig(h)},
|
2019-12-28 15:52:52 +00:00
|
|
|
|
2019-11-21 17:06:50 +00:00
|
|
|
]
|