Skip to content

web-backend


Class: InviteService ​

Defined in: packages/web-backend/src/invite/invite.service.ts:14

Service for managing user invitations. Persists invites, verifies validity, and supports CRUD.

Constructors ​

Constructor ​

new InviteService(invitedUserModel): InviteService

Defined in: packages/web-backend/src/invite/invite.service.ts:20

Instantiate the invite service.

Parameters ​

invitedUserModel ​

Model<InvitedUserDocument>

Mongoose model for InvitedUser documents.

Returns ​

InviteService

Methods ​

deleteInviteById() ​

deleteInviteById(id): Promise<boolean>

Defined in: packages/web-backend/src/invite/invite.service.ts:103

Delete a user invite by id

Parameters ​

id ​

string

Id of the invited user

Returns ​

Promise<boolean>


generateUserInvite() ​

generateUserInvite(body): Promise<InvitedUser>

Defined in: packages/web-backend/src/invite/invite.service.ts:36

This function will generate a new user invite and save in database

Parameters ​

body ​

InvitedUserDto

InvitedUserDto object

Returns ​

Promise<InvitedUser>

Example ​

ts
- InvitedUserDto object:
{
  firstname: "xyzabc",
  lastname: "lkjhg",
  username: "sampleusername",
  email: "sampleemail@gmail.com",
}

getAllInvitedUsers() ​

getAllInvitedUsers(): Promise<InvitedUserDetailsDto[]>

Defined in: packages/web-backend/src/invite/invite.service.ts:85

This function will return all invited users

Returns ​

Promise<InvitedUserDetailsDto[]>


getInviteById() ​

getInviteById(id): Promise<InvitedUserDetailsDto>

Defined in: packages/web-backend/src/invite/invite.service.ts:116

Get a user invite by id

Parameters ​

id ​

string

Id of the invited user

Returns ​

Promise<InvitedUserDetailsDto>


updateInvite() ​

updateInvite(user): Promise<InvitedUser>

Defined in: packages/web-backend/src/invite/invite.service.ts:69

A function to decrement invite count and return the invited user

Parameters ​

user ​

InvitedUserDetailsDto

The InvitedUserDetailsDto object for update

Returns ​

Promise<InvitedUser>


verifyUserInvite() ​

verifyUserInvite(guid): Promise<InvitedUser>

Defined in: packages/web-backend/src/invite/invite.service.ts:53

This function will check if an invited user is valid or not

Parameters ​

guid ​

string

The guid of the invited user

Returns ​

Promise<InvitedUser>

InvitedUser | null - If the guid is valid and not expired will return InvitedUser object else returns null