Skip to content

[TM-3027] start up endpoint to send invitation to join organization u…#585

Open
cesarLima1 wants to merge 1 commit intorelease/youthful-yttrofluoritefrom
feat/TM-3027-organzation-user-invitation
Open

[TM-3027] start up endpoint to send invitation to join organization u…#585
cesarLima1 wants to merge 1 commit intorelease/youthful-yttrofluoritefrom
feat/TM-3027-organzation-user-invitation

Conversation

@cesarLima1
Copy link
Collaborator

@cesarLima1 cesarLima1 force-pushed the feat/TM-3027-organzation-user-invitation branch from 9c8a8ea to 2b096ae Compare February 27, 2026 21:35
) {
if (model !== "organisations") {
throw new BadRequestException("Invites are only supported for organisations");
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be enforced by the DTO - a new DTO should be created that only accepts orgs on this endpoint.


const document = buildJsonApi(OrganisationInviteDto);
document.addData(invite.uuid, new OrganisationInviteDto(invite));
return document;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎨 you can streamline this a little and just return the result of document.addData()

attributes: ["id"]
});
if (existingUser != null) {
throw new UnprocessableEntityException("User is already a part of this programme");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message is misleading - all you've determined here is that the user already exists.

import { User } from "./user.entity";

@Table({ tableName: "v2_organisation_invites", underscored: true })
export class OrganisationInvite extends Model<OrganisationInvite> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the last couple of months, we've been transitioning to using Model<InferAttributes<OrganisationInvite>, InferCreationAttributes<OrganisationInvite>> in place of this simpler form. It makes the semantics around creation a bit better typed. There are lots of examples in the codebase - please update this to match.

@roguenet roguenet changed the base branch from staging to release/youthful-yttrofluorite February 28, 2026 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants