Skip to content

[BE-15] Team / company accounts: backend #1178

Description

@yusuftomilola

Overview

Every member currently pays individually. Companies and teams that want to book multiple seats under a single billing account — a standard enterprise coworking requirement — have no way to do so. A team accounts module enables B2B sales.

Context

  • User entity: backend/src/users/entities/user.entity.ts
  • Booking entity: backend/src/bookings/entities/booking.entity.ts
  • InvoicesModule: backend/src/invoices/ — team invoices should be addressed to the team's billing email
  • EmailModule: backend/src/email/ — for team invitations

Tasks

  • Create Team entity: id, name, ownerId (FK to User), seatLimit (int), billingEmail, isActive, createdAt, updatedAt
  • Create TeamMember entity: id, teamId, userId, role (OWNER / MEMBER), joinedAt; unique constraint on (teamId, userId)
  • POST /teams — create a team (any authenticated user becomes owner)
  • PATCH /teams/:id — update team name, seat limit, billing email (owner only)
  • POST /teams/:id/invite — send invitation email to a user by email address (owner only)
  • POST /teams/join/:inviteToken — accept invite, add to team as MEMBER
  • DELETE /teams/:id/members/:userId — remove member from team (owner only, cannot remove self)
  • GET /teams/me — get the team the current user belongs to (returns null if not in a team)
  • GET /teams/:id — team details with member list (owner only)
  • GET /teams/:id/invoices — consolidated invoice history for the team (owner only)

Files to Modify / Create

  • New: backend/src/teams/ (module, entities, controller, service, providers)
  • backend/src/app.module.ts

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions