Asymmetrik/node-rest-starter

View on GitHub
src/app/core/teams/team.components.yml

Summary

Maintainability
Test Coverage
components:
  schemas:
    NewTeam:
      type: object
      properties:
        description:
          type: string
          description: The longer description of the team, as provided by team admins
        implicitMembers:
          type: boolean
          description: If true, automatically adds members to this team based on their roles
        name:
          type: string
          description: Shorter name for the team
        requiresExternalRoles:
          type: array
          items:
            type: string
            description: External roles that are required for a user to access this team
        requiresExternalTeams:
          type: array
          items:
            type: string
            description: External teams that are required for a user to access this team
    Team:
      allOf:
        - $ref: '#/components/schemas/NewTeam'
        - type: object
          properties:
            _id:
              type: string
              description: Unique ID of the Team
            ancestors:
              type: array
              description: Nested teams provide access to resources in a top-down manner (i.e. members of a parent team have the same accesses to resources owned by any child teams).
              items:
                type: string
                description: Team IDs
            created:
              type: number
              description: Timestamp of when the team was created, in milliseconds since the unix epoch.
            creator:
              type: string
              description: Unique ID of the user who created the team
            creatorName:
              type: string
              description: Full display name of the user who created the team
            isMember:
              type: boolean
              description: Whether the user making the request is a member of the team or not
    TeamMember:
      type: object
      properties:
        _id:
          type: string
          description: Unique ID of the Team Member, matching their unique User ID
        name:
          type: string
          description: Full name of the Team Member
        username:
          type: string
          description: Unique name for the User that can be shared across systems and/or used to login.
        teams:
          type: array
          items:
            type: object
            properties:
              _id:
                type: string
                description: Unique ID of the Team
              role:
                type: string
                enum: [requester, member, editor, admin]
                description: The role that this member has on this team
  parameters:
    teamIdParam:
      in: path
      name: teamId
      required: true
      schema:
        type: string
      description: the unique id of the team
    memberIdParam:
      in: path
      name: memberId
      required: true
      schema:
        type: string
      description: the unique id of the member
  requestBodies:
    CreateTeam:
      description: Values used to create a new team
      content:
        application/json:
          schema:
            type: object
            properties:
              firstAdmin:
                type: string
                description: User ID of the first Team Admin who can grant access to other members
              team:
                $ref: '#/components/schemas/NewTeam'
    UpdateTeam:
      description: Values used to update an existing team
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NewTeam'
    RequestNewTeam:
      description: Request a new team
      content:
        application/json:
          schema:
            type: object
            properties:
              org:
                type: string
                description: The team organization
              aoi:
                type: string
                description: The team AOI
              description:
                type: string
                description: The description of the request
    UpdateMemberRole:
      description: Update a member's role
      content:
        application/json:
          schema:
            type: object
            properties:
              role:
                type: string
                enum: [requester, member, editor, admin]
                description: The role to give to this new member in the team
    GetAncestorTeams:
      description: From a set of Team IDs, requests a list of Ancestor Team IDs
      content:
        application/json:
          schema:
            type: object
            properties:
              teamIds:
                type: array
                description: Listing of Team IDs whose Ancestor Teams are requested
                items:
                  type: string
                  description: Unique Team ID
    SearchTeamMembers:
      description: Searches for team members
      content:
        application/json:
          schema:
            type: object
            properties:
              teamIds:
                type: array
                description: Listing of user IDs who should be added to the team
                items:
                  type: string
                  description: Unique User ID
    AddTeamMembers:
      description: Adds members to a Team by their user IDs
      content:
        application/json:
          schema:
            type: object
            properties:
              newMembers:
                type: array
                description: The members to add
                items:
                  type: object
                  properties:
                    _id:
                      type: string
                      description: Unique user ID of the member to add
                    role:
                      type: string
                      enum: [requester, member, editor, admin]
                      description: The role to give to this new member in the team
    AddTeamMember:
      description: Adds a member to a Team
      content:
        application/json:
          schema:
            type: object
            properties:
              role:
                type: string
                enum: [requester, member, editor, admin]
                description: The role to give to this new member in the team
  responses:
    CreatedTeam:
      description: Team was created
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Team'
    GetTeam:
      description: Returns the details of the Team
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Team'
    UpdateTeam:
      description: The details of the Team that was updated
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Team'
    DeleteTeam:
      description: The details of the Team that was deleted
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Team'
    RequestTeamAccess:
      description: The request to join a team was submitted
    RequestNewTeam:
      description: The request for a new team was successfully submitted
    TeamIds:
      description: List of unique Team IDs
      content:
        application/json:
          schema:
            type: array
            description: List of unique Team IDs
            items:
              type: string
              description: Unique Team ID
    AddedTeamMembers:
      description: The members were successfully added to the team
    AddedTeamMember:
      description: The new member was successfully added to the team
    RemovedTeamMember:
      description: A member was successfully removed from the team
    UpdatedTeamMemberRole:
      description: The member's role in the team has been successfully updated
    TeamListing:
      description: The Teams that match the search criteria
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/ResultsPage'
              - type: object
                properties:
                  elements:
                    type: array
                    items:
                      $ref: '#/components/schemas/Team'
    TeamMembers:
      description: The Team Members that match the search criteria
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/ResultsPage'
              - type: object
                properties:
                  elements:
                    type: array
                    items:
                      $ref: '#/components/schemas/TeamMember'