Skip to content

Collections: Users and Locations

Mounir Ghlaiel edited this page Apr 11, 2022 · 1 revision

Users

The User class represents any human interacting with the system via web and/or mobile clients.

User roles

A user may have one of the following roles:

  • Customer: Default role - hardcoded into the web client and customer's mobile client - can be overridden by the admin
  • Collector: hardcoded into collectors mobile client
  • Admin: Initially Hardcoded in the DB
  • A collector may sign-up via a mobile client dedicated to collectors and not published on an app store, or sign-up as a customer via the web client and wait to be nominated as a Collector by an admin.

  • Admin is allowed to edit user roles to nominate or delete collectors and other admins as well.

Components:

schemas:
  user:
  type: object
    properties:
      id:
        type: string
        format: uuid
      name:
        type: string
      email:
        type: string
        format: email
        nullable: true
      role:     
        type: string
        enum: [customer,collector,admin]
      avatar:
        type: string
        nullable: true

The 'username' is useful when displaying user ranks without using the real names:

      username:  
        type: string
        nullable: true

At least one phone number is required to contact the customer upon pick-up. The phone number remains a primary search key when no username is set

      phone1:       
        type: string
      phone2:
        type: string
        nullable: true  

A user may own and/or manage 2 locations at most (Max=2). They can also be authenticated (existing user) and have no locations (Min=0)

      ownedLocations:
        type: array
        minItems: 0
        maxItems: 2
        items: 
          $ref: '#/components/schemas/location.locationID'

Required fields

    required:
      - id
      - phone
      - name
      - role        // Defaults to customer

Locations

[New]:

  • The Address object is removed. All previous address fields are now under the location object
  • The field location.Managers is also removed. locationId is now associated with user.ownedLocations

Coverage/Eligibility check

Upon adding a new or editing an existing location, a validation of the location takes place by serving users a map with a pin on the entered address. If the user confirms that the address shown on the served map is correct, then the LongLat value is filled automatically along with the entered streetNumber and streetName. Customers could enter a wrongly typed address, or Google Maps may not find the address, Thus returning a wrong pin position. In such cases, customers will be served a map and asked to position a pin on their location to get the LongLat value and omitting the streetNumber and streetName. In both cases, City and State values are manually input by the customer, from a drop-down list.

Components:

schemas:
  location:
    type: object
    properties:
      id: 
        type: string
        format: uuid
      longLat: 
        type: array
        items:
          type: number
          format: float64
      streetNumber:
        type: number
        format: int16
        nullable: true    //street number may not be found and can be omitted in favor of 'LongLat'
      streetName:
        type: string
        nullable: true    //street number may not be found and can be omitted in favor of 'LongLat'
      state:
        type: string
        enum: [states]
      city:               //required for eligibility check
        type: string
        enum: [cities]

Location type allows filtering locations by type for insights and analytics */

      LocationType:
        type: string
        enum: [professional, residential]

Based on the locations type, the customer may precise further;

  • Professional:
  • Front street (store)
  • Office/Floor
  • Buiding
  • Residential:
  • Apartment
  • House
  • Residential compound (can be an entire residential compound managed by the syndic as one location)
      addressType:
        type: string
        enum: [Appartment/Office_Floor, compound/building, store_front/House]

Location name allows customers to give labels to the locations they manage. e.g.: "my home", "my office", etc.

      name:     
        type: string
        nullable: true

Required fields

    required:
      - id
      - LongLat
      - city
      - State        
      - locationType
Clone this wiki locally