Skip to content
Andrei Marin edited this page May 23, 2017 · 1 revision

1. Users

Types

In the app, you can create the following user types:

  • volunteer
    • can be associated with several camps
  • refugee
    • can only be associated with one camp
  • asylum seeker
    • can only be associated with one camp

There is one other user type that can be created from outside the app:

  • owner
    • can login in the app
    • may give admin rights to volunteers
    • can add/remove camps
    • [?] generally only has read writes and cannot
      • be found in camps/messenger/...
      • post in a camp/have access to messenger/...

Besides a type, a user can have additional roles:

  • camp admin
    • applies only to volunteers
    • 1:1 relation with a camp; a user can be camp admin for several camps; a camp can have several admins
    • can edit details about associated camps
    • can add/remove refugees/asylum seekers from a camp

Database structure

users => {
  'user_id_1' => {
    string id,
    bool pendingProfile, // if a profile exists for the current email/fb, but it hasn't been completed
    Enum type : {'refugee' / 'asylum_seeker' / 'volunteer' / 'owner'},
    Set<string> camp_admin : {'camp_1_id', 'camp_2_id', ...},
    Set<string> camps : {'camp_1_id', ...},
    string first_name,
    string last_name,
    << all other user data >>
  },
  'user_id_2',
  ...
}

owners => {
  'user_id_1' => {
    string first_name,
    string last_name,
  },
  'user_id_2',
  ...
}

refugees => {
  'camp_id_1' => {
    'user_id_1' => true,
    'user_id_2' => true,
    ...
  }, 
  'camp_id_2' => ...,
   ...
}

asylum_seekers => {
  'camp_id_1' => {
    'user_id_1' => true,
    'user_id_2' => true,
    ...
  }, 
  'camp_id_2' => ...,
   ...
}

volunteers => {
  'camp_id_1' => {
    'user_id_1' => true,
    'user_id_2' => true,
    ...
  }, 
  'camp_id_2' => ...,
   ...
}

2. Camps & Locations

Types

There is only one camp type, has location data and a list of users affiliated with it.

We also keep a table of countries and a list of known cities per country (just the cities that have camps for now).

Database structure

camps => {
  'camp_id_1' => {
    string id,
    string name : 'Camp 1',
    Set<string> admins => {'user_id_1', 'user_id_2', ...},
    string location : 'location_id_1',
    Set<string> campers => {'user_id_1', 'user_id_2', ...},
  },
  'camp_id_2',
  ...
}

camp_admins => {
  'camp_id_1' => {'user_id_1', 'user_id_2', ...},
  'camp_id_2' => {'user_id_1', 'user_id_2', ...},
   ... 
}

// [TODO] locations => {
  'location_id_1' => {
      string id,
      string name : 'Vama Veche',
      double latitude : 43.7529244,
      double longitude : 28.57254869999997,
      bool is_camp : true,
      bool is_city : true,
      string country_name : 'Romania',
      string address : 'nu vad prea bine',
  },
  'location_id_2',
   ...
}

// [TODO] countries => {
  'country_1' => {
    Set<string> locations : {'location_id_1', 'location_id_2', ...}
  },
  'country_2',
  ...
}

3. Posts

// TODO There are several types of posts:

  • text post
  • event post
  • comment to post

4. Tags

// TODO These are all tags associated to a user / post. Any user / post can have any tag.

5. Chats

// TODO These are all the inter-user chats.