express-api/src/routes/parcels.swagger.yaml

Summary

Maintainability
Test Coverage
### PATHS ###
paths:
  /parcels:
    get:
      security:
        - bearerAuth: []
      tags:
        - Parcels
      summary: Gets a paginated list of parcels based on supplied filter.
      parameters:
        - in: query
          name: pid
          schema: 
            type: integer
          description: Should not include leading 0s or hyphens.
        - in: query
          name: classificationId
          schema:
            type: integer
        - in: query
          name: agencyId 
          description: Can also be an array of integers
          schema: 
           type: integer
        - in: query
          name: administrativeAreaId 
          schema: 
            type: integer
        - in: query
          name: propertyTypeId 
          schema: 
            type: integer
        - in: query
          name: isSensitive
          schema:
            type: boolean
        - in: query
          name: page
          schema:
            type: integer
          description: Page number of requested results. Only necessary if quantity is specified.
        - in: query
          name: quantity
          schema:
            type: integer
          description: The column name on which the records will be sorted.
        - in: query
          name: sort
          schema:
            type: string
          description: Either DESC or ASC.
        - in: query
          name: includeRelations
          schema:
            type: boolean
          description: Flag to join and select foreign key records.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items: 
                  $ref: '#/components/schemas/Parcel'
        '400':
          description: Bad Request 
          content:
            text/plain:
              schema:
                type: string 
                example: Could not parse filter.
    post:
        security:
          - bearerAuth: []
        tags:
          - Parcels
        summary: Submits a new Parcel.
        requestBody:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ParcelPost'
        responses:
          '201':
            description: OK
            content:
              application/json:
                schema:
                  $ref: '#/components/schemas/Parcel'
          '400':
            description: Bad Request
            content:
              text/plain:
                schema: 
                  type: string
                  example: 'PID must be a number and in the format #########'
          '409':
            description: Conflict
            content:
              text/plain:
                schema: 
                  type: string
                  example: Parcel already exists.
  /parcels/{id}:
    get:  
      security:
        - bearerAuth: []
      tags:
        - Parcels
      summary: Gets a single Parcel that matches the Id.
      parameters:
        - in: path 
          name: id
          type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema: 
                $ref: '#/components/schemas/Parcel'
        '400':
          description: Bad Request
          content:
            text/plain:
              type: string
              example: Parcel ID was invalid. 
        '403': 
          description: Forbidden
          content:
            text/plain:
              type: string
              example: You are not authorized to view this parcel. 
        '404':
          description: Not Found
          content:
            text/plain:
              type: string
              example: Parcel matching this internal ID not found. 
    put: 
      security:
        - bearerAuth: []
      tags:
        - Parcels
      summary: Updates a single Parcel that matches the Id.
      parameters:
        - in: path 
          name: id
          type: integer
      responses:
        '200': 
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Parcel'
        '400':
          description: Bad Request
          content:
            text/plain:
              type: string
              example: Parcel ID was invalid or mismatched with body.
        '403':
          description: Forbidden
          content:
            text/plain:
              type: string
              example: This agency change is not permitted.
        '404':
          description: Not Found
          content:
            text/plain:
              type: string
              example: Parcel matching this internal ID not found. 
    delete: 
      security:
        - bearerAuth: []
      tags:
        - Parcels
      summary: Deletes a single Parcel that matches the Id.
      parameters:
        - in: path 
          name: id
          type: integer
      responses:
        '200':
          description: OK
        '400':
          description: Bad Request
          content:
            text/plain:
              schema:
                type: string
                example: Parcel ID was invalid.
        '403':
          description: Forbidden
          content:
            text/plain:
              schema:
                type: string
                example: Parcel is involved in one or more projects with ID(s) ...
        '404':
          description: Not Found
          content:
            text/plain:
              schema:
                type: string
                example: Parcel does not exist.

### SCHEMAS ### 
components:
  schemas:
    ParcelPost:
      type: object
      description: Object submitted in body of POST request. 
      properties:
        Name:
          type: string
          description: "Name of the property."
        Description:
          type: string
          description: "Description of the property."
        ClassificationId:
          type: integer
          format: int32
          description: "Identifier for the classification of the property."
        AgencyId:
          type: integer
          format: int32
          description: "Identifier for the agency associated with the property."
        AdministrativeAreaId:
          type: integer
          format: int32
          description: "Identifier for the administrative area."
        IsSensitive:
          type: boolean
          description: "Indicates whether the property is sensitive."
        IsVisibleToOtherAgencies:
          type: boolean
          description: "Indicates whether the property is visible to other agencies."
        Location:
          type: object
          properties:
            x:
              type: number
              format: float
              description: "X coordinate of the property's location."
            y:
              type: number
              format: float
              description: "Y coordinate of the property's location."
        PropertyTypeId:
          type: integer
          format: int32
          description: "Identifier for the type of the property."
        Address1:
          type: string
          description: "Primary address of the property."
        Postal:
          type: string
          description: "Postal code of the property."
        PID:
          type: integer
          format: int64
          description: "Parcel identifier for the property."
        PIN:
          type: string
          nullable: true
          description: "Parcel identification number for the property."
        LandArea:
          type: number
          format: float
          description: "Land area of the property in hectares."
        Evaluations:
          type: array
          items:
            $ref: '#/components/schemas/EvaluationPost'
        Fiscals:
          type: array
          items:
            $ref: '#/components/schemas/FiscalPost'
    Parcel: 
      allOf: 
        - $ref: '#/components/schemas/ParcelPost'
        - $ref: '#/components/schemas/CommonEntityProperties'
        - type: object
          properties:
            Id: 
              type: integer
              example: 300
            SiteId:
              type: string
              example: null
              description: >
                Site ID from BC Geocoder. Not currently in use.
            Evaluations:
              type: array
              items:
                $ref: '#/components/schemas/ParcelEvaluation'
            Fiscals:
              type: array
              items:
                $ref: '#/components/schemas/ParcelFiscal'
            Zoning:
              type: string
              nullable: true
              description: "Zoning information of the property."
            ZoningPotential:
              type: string
              nullable: true
              description: "Potential zoning information for the property."
            ParentParcelId:
              type: integer
              nullable: true
              description: "Identifier for the parent parcel, if applicable. Not used in current PIMS."