Skip to content

elhardoum/agadir-moi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Admin install

# clone the repo
git clone https://github.com/elhardoum/agadir-moi && cd agadir-moi

# setup environment variables
cp .env.sample .env && $EDITOR $_

# regenerate JWT signing keys
cd admin/src/pem && rm *
ssh-keygen # make sure the filename is auth_rsa

# convert the pub key to pem format
ssh-keygen -f auth_rsa.pub -e -m pem > auth_rsa.pem.pub && mv auth_rsa.pem.pub auth_rsa.pub

# to setup the database, run the docker containers
docker-compose up -d

# ssh into postgres container
docker-compose exec postgres sh

# switch user
su -u postgres 

# create db/user
createuser agadirmoi; createdb agadirmoi

# log into psql interactive shell
psql -U postgres

# setup user and privileges
grant all privileges on database agadirmoi to agadirmoi
alter user agadirmoi with encrypted password 'agadirmoi'

# now exit psql, login again as agadirmoi user
psql -U agadirmoi

# setup tables: execute the content of `admin/db.sql`
# ..

# reboot containers
docker-compose down; docker-compose up -d

Mobile app development

cd mobile

# setup env
cp env.sample.json env.json && $EDITOR $_

# install dependencies
npm install

# setup android project
react-native eject

# link dependencies
react-native link

# start the app
react-native run-android

Todo

Backend - administration UI

  • Docker dev structure
  • Auth via JWT or cookie/crypt based login
  • postgres for admin relational db needs
  • user roles: super admin, admin, moderator
  • post attachments to firebase
  • moderators can approve/dismiss complaints
  • super admin has caps of normal admins, plus managing all user roles
  • notifications preference for mods
  • Safari auth issue
  • news CRUD
  • events CRUD
  • users CRUD
  • important phone numbers CRUD
  • migrate some configs to dotenv
  • migrate firebase URIs to dotenv
  • posts - persist ids raw list in memory for NoSQL pagination

Android

  • firebase data store and sync (advertises real time syncing for connected devices)
  • push notifications or sms for opted collectors
  • data sync - preload everything on start, store data locally, compare timestamps to fetch new updates
  • news index and details
  • events index and details
  • phones list and native linking
  • weather screen + use central server to bypass free-package limitations, update data each 3 hours, push to firebase
  • complaints
  • encombrants
  • localize everything to baguette
  • remove unused assets

Optional - if time allows

  • onscroll expand/collapse toolbar on news/events by reducing vertical padding gradually.
  • data sync is done on boot - if user reaches screens before data is initially fetched then abort XHRs and make subsequent ones
  • news/events single view: queue below index and show/hide elements to preserve browsing state for better reading experience