Skip to content

Object Data Model

Joanna Yao edited this page May 2, 2023 · 14 revisions
  • All fields are required unless marked otherwise.
  • Important detail regarding timestamp: JavaScript's Data object doesn't contain information about timezone by itself (it stores Epoch/Unix time), so timestamp should always be initialized with either an epoch in millisecond (e.g. new Date(1645542480000)), or a string containing a timezone offset (e.g. new Date("2022-02-22T10:08:00.000-05:00")).
    • If initializing without the offset, e.g. new Date("2022-02-22T10:08:00.000"), the local timezone will be applied to adjust the timestamp, which may not be the desired behavior. See link for more.

Record:

  id:          String      // unique (PK), only alphanumeric or underscore
  latitude:    Number      // between -90 and +90 (inclusive)
  longitude:   Number      // between -180 and +180 (inclusive)
  timestamp:   Date
  driver_id:   String      // reference to Driver
  slip_score:  Number      // between 0 and 100 (inclusive)

Manager:

  id:          String      // unique (PK), only alphanumeric or underscore
  password:    String      // only non-space characters, length between 8 and 16
  name:        String
  company_id:  String      // reference to Company

Driver:

  id:          String      // unique (PK), only alphanumeric or underscore
  password:    String      // only non-space characters, length between 8 and 16
  name:        String
  company_id:  String      // reference to Company

Company:

  id:          String      // unique (PK), only alphanumeric or underscore
  name:        String
Clone this wiki locally