import { Attr } from 'ts-framework' import { OrganizationTeamMemberStatuses } from '../constants/organization-team-member-statuses' import { OrganizationResponseDTO } from './organization' import { PaginationRequestDTO } from './pagination' import { UserResponseDTO } from './user' import { UserOrganizationRoleDTO, UserRoleDTO } from './user-role' export class TeamMemberFiltersDTO { @Attr({ type: String, optional: true }) orgId?: string @Attr({ type: String, optional: true }) userId?: string @Attr({ type: Number, optional: true }) skip?: number @Attr({ type: Number, optional: true }) take?: number @Attr({ type: String, optional: true }) status?: string @Attr({ type: Boolean, optional: true }) isArchived?: boolean @Attr({ type: String, optional: true }) search?: string @Attr({ type: String, optional: true }) sortBy?: string[] @Attr({ type: String, optional: true }) roleIds?: string[] } export class CreateOrganizationTeamMemberDTO { @Attr({ type: String }) userId: string @Attr({ type: String }) organizationId: string @Attr({ type: Object }) roles: UserRoleDTO[] } export class InviteOrganizationTeamMemberDTO { @Attr({ type: String, optional: true }) id: string @Attr({ type: String }) username: string @Attr({ type: String, optional: true }) email: string @Attr({ type: String }) firstName: string @Attr({ type: String }) lastName: string @Attr({ type: String }) phoneNumber: string @Attr({ type: String }) countryCode: string @Attr({ type: String }) organizationId: string @Attr({ type: String }) roles: string[] } export class FindOrganizationTeamMembersDTO implements PaginationRequestDTO { @Attr({ type: String }) organizationId: string @Attr({ type: String, optional: true, resolver: { type: 'enum', params: OrganizationTeamMemberStatuses } }) statuses?: string[] @Attr({ type: Number, optional: true }) page?: number; @Attr({ type: Number, optional: true }) recordsPerPage?: number; } export class RemoveOrganizationTeamMemberDTO { @Attr({ type: String }) userId: string @Attr({ type: String }) organizationId: string } export class OrganizationTeamMemberDTO { userId: string organizationId: string role: UserRoleDTO[] } export class OrganizationTeamMemberJwtDTO { roles: UserOrganizationRoleDTO[] organizationId: string } export class FindOrganizationTeamMemberWithUserResponseDTO { items: OrganizationTeamMemberWithUserResponseDTO[] total: number } export class OrganizationTeamMemberWithUserResponseDTO { id: string userId: string organizationId: string status: string isArchived: boolean archiveDate?: string user: UserResponseDTO roles: UserRoleDTO[] organization: OrganizationResponseDTO constructor(model: OrganizationTeamMemberWithUserResponseDTO) { this.id = model.id this.userId = model.userId this.organizationId = model.organizationId this.status = model.status this.isArchived = model.isArchived this.archiveDate = model.archiveDate this.roles = model.roles this.organization = model.organization this.user = model.user } static of(model: OrganizationTeamMemberWithUserResponseDTO): OrganizationTeamMemberWithUserResponseDTO { return new OrganizationTeamMemberWithUserResponseDTO(model) } } export class OrganizationTeamMemberResponseDTO { userId: string roles: UserRoleDTO[] organization: OrganizationResponseDTO constructor(model: OrganizationTeamMemberResponseDTO) { this.userId = model.userId this.roles = model.roles this.organization = model.organization } static of(model: OrganizationTeamMemberResponseDTO): OrganizationTeamMemberResponseDTO { return new OrganizationTeamMemberResponseDTO(model) } }