git clone https://github.com/WhySoBad/tria-backend.gitcd tria-backendnpm installnpm run start:devAPI is available on localhost at port 443
npm run startAPI is available on localhost at port 443
Endpoint to validate an user auth token
Authorization header required
GET /auth/validateBoolean whether the token is valid or not
400 No Token ProvidedEndpoint to log an user in using its credentials
POST /auth/login{
username: string,
password: string,
}User auth token as string
404 User Not Found400 Invalid CredentialsEndpoint to create a new private chat with another user
Authorization header required
POST /chat/create/private{
user: string,
}Chat uuid as string
404 User Not Found404 Participant Not Found400 Private Chat Already ExistsEndpoint to create a new group chat
Authorization header required
POST /chat/create/group{
name: string,
tag: string,
type: ChatType,
description: string,
members: Array<{ uuid: string; role: GroupRole; }>,
}Chat uuid as string
404 User Not Found400 Group Tag Has To Be UniqueEndpoint to check whether a given group tag does already exist
GET /chat/check/tag/[tag]Boolean whether the tag already exists or not
Endpoint to join an existing group
Authorization header required
POST /chat/[uuid]/joinVoid
404 Group Not Found400 Chat Has To Be Group403 User Is Banned400 User Is Already Joined404 User Not FoundEndpoint to leave an existing group
Authorization header required
POST /chat/[uuid]/leaveVoid
404 Group Not Found400 Chat Has To Be Group404 User Not Found400 Owner Can't Leave The GroupEndpoint to delete an existing chat
Authorization header required
DELETE /chat/[uuid]/deleteVoid
404 Chat Not Found404 User Not Found401 Only Owner Can Delete A GroupEndpoint to ban a member in a group
Admin role with ban permission or owner role required
Authorization header required
POST /chat/[uuid]/admin/ban{
uuid: string,
}Void
404 Chat Not Found400 Chat Has To Be Group400 User Is Already Banned404 User Not Found401 Owner Can't Be BannedEndpoint to unban a banned member in a group
Admin role with unban permission or owner role required
Authorization header required
POST /chat/[uuid]/admin/unban{
uuid: string,
}Void
404 Chat Not Found400 Chat Has To Be Group404 User Isn't Banned404 User Not FoundEndpoint to kick a member in a group
Admin role with kick permission or owner role required
Authorization header required
POST /chat/[uuid]/admin/kick{
uuid: string,
}Void
404 Chat Not Found400 Chat Has To Be Group404 User Not Found401 Owner Can't Be KickedEndpoint to get a preview of a chat
GET /chat/[uuid]/preview{
uuid: string,
type: ChatType,
description: string,
name: string,
tag: string,
size: number,
online: number,
avatar: string | null,
}404 Chat Not Found400 Can't Get Preview Of Private Group400 Can't Get Preview Of Private ChatEndpoint to get a specific amount of messages older than a given timestamp
User has to be a member of the chat
Authorization header required
GET /chat/[uuid]/messages/get/[timestamp]/[amount]{
messages: Array<{
uuid: string,
sender: string,
chat: string,
createdAt: Date,
editedAt: Date | null,
edited: number,
text: string,
}>,
log: Array<{
user: string,
chat: string,
timestamp: Date,
joined: boolean,
}>,
last: boolean,
}404 Chat Not FoundEndpoint to mark messages after a given timestamp as read
User has to be a member of the chat
Authorization header required
GET /chat/[uuid]/messages/read/[timestamp]Void
400 Timestamp Can't Be In The Future404 User Not Found400 User Has Already Read FurtherEndpoint to get all informations about a chat
User has to be a member of the chat
Authorization header required
GET /chat/[uuid]{
uuid: string,
type: ChatType,
name: string | null,
tag: string | null,
description: string | null,
createdAt: Date,
lastRead: Date,
members: Array<{
joinedAt: Date,
role: GroupRole,
user: {
uuid: string,
createdAt: Date,
lastSeen: Date,
name: string,
tag: string,
description: string,
avatar: string | null,
locale: Locale,
online: boolean,
},
promotedAt: Date, //only when member is admin
permissions: Array<Permission>, //only when member is admin
}>,
messages: Array<{
uuid: string,
sender: string,
chat: string,
createdAt: Date,
editedAt: Date | null,
edited: number,
text: string,
}>,
banned: Array<{
bannedAt: Date,
user: {
uuid: string,
createdAt: Date,
name: string,
tag: string,
description: string,
avatar: string | null,
},
}>,
memberLog: Array<{
user: string,
chat: string,
timestamp: Date,
joined: boolean,
}>,
}404 Chat Not FoundEndpoint to get the avatar of a group
GET /chat/[uuid]/avatarThe avatar of the chat as a .jpeg file
404 Avatar Not FoundEndpoint to upload an avatar for a group
Admin role with chat edit permission or owner role required
Authorization header required
POST /chat/[uuid]/avatar/uploadFormData with the name "avatar" and an avatar image in the .jpeg format
Void
400 Maximum File Size Is 100'000 Bytes400 File Has To Be Of Type JPEG400 Invalid File404 Chat Not FoundEndpoint to delete an avatar of a group
Admin role with chat edit permission or owner role required
Authorization header required
DELETE /chat/[uuid]/avatar/deleteVoid
404 Chat Not Found400 Chat Has To Be Of Type Group404 User Not Found404 Avatar Not FoundEndpoint to search new groups and user
Authorization header required
POST /search{
text: string,
checkUser?: boolean,
checkChat?: boolean,
checkUuid?: boolean,
checkTag?: boolean,
checkName?: boolean,
}Array with UserPreview and ChatPreview objects
404 User Not FoundEndpoint to register a new user
POST /user/register{
mail: string,
password: string,
}Void
400 Mail Has To Be UniqueEndpoint to validate whether a register token is valid or not
GET /user/register/validate/[token]Boolean whether the token is valid or not
Endpoint to finish the registration of an user
POST /user/register/verify{
token: string,
name: string,
tag: string,
description: string,
locale: Locale,
}Void
400 Invalid Registration Token404 User Not Found400 Tag Has To Be UniqueEndpoint to check whether a tag does already exist
GET /user/check/tag/[tag]Boolean whether the tag does already exist or not
Endpoint to check whether a mail is already used
GET /user/check/mail/[mail]Boolean whether the mail is already used or not
Endpoint to edit an user
Authorization header required
PUT /user/edit{
name?: string,
tag?: string,
description?: string,
locale?: Locale,
}Void
404 User Not Found400 Tag Has To Be UniqueEndpoint to change the password using the old password
Authorization header required
PUT /user/password/change{
old: string,
new: string,
}Void
404 User Not Found400 Invalid PasswordEndpoint to request a mail to reset the password
POST /user/password/reset{
mail: string,
}Void
404 Mail Not Found503 Failed To Send MailEndpoint to validate whether a password reset token is valid
GET /user/password/reset/validate/[token]Boolean whether a password reset token is valid or not
Endpoint to confirm a password reset and to set a new password
POST /user/password/reset/confirm{
token: string,
password: string,
}Void
400 Invalid Reset Token404 User Not FoundEndpoint to delete an user
Authorization header required
DELETE /user/deleteVoid
404 User Not FoundEndpoint to get all information about an user
Authorization header required
GET /user/current{
uuid: string,
name: string,
tag: string,
avatar: string | null,
description: string,
mail: string,
locale: Locale,
online: boolean,
createdAt: Date,
lastSeen: Date,
chats: Array<string>,
}404 User Not FoundEndpoint to get a preview of an user
GET /user/[uuid]{
uuid: string,
name: string,
tag: string,
avatar: string | null,
description: string,
}404 User Not FoundEndpoint to get the avatar of an user
GET /user/[uuid]/avatarThe avatar of the chat as a .jpeg file
404 Avatar Not FoundEndpoint to upload an avatar for an user
Authorization header required
POST /user/avatar/uploadFormData with the name "avatar" and an avatar image in the .jpeg format
Void
400 Maximum File Size Is 100'000 Bytes400 File Has To Be Of Type JPEG400 Invalid File404 User Not FoundEndpoint to delete an avatar of an user
Authorization header required
DELETE /user/avatar/deleteVoid
404 User Not Found404 Avatar Not FoundAGPL © WhySoBad
