Skip to content

partio-scout/fj16-roihuapp-backend

Repository files navigation

Mobile application backend

Finnjamboree 2016 mobile application backend. All content types support unlimited amount of different language versions.

Development

Prequisities

Node.JS and PostgreSQL

Installation

Clone this repository.

Make sure your postgreSQL instance is running and make sure that you have a postgreSQL user and database for that user.

Set database settings as environment variable:

For running the app normally
`export DATABASE_URL=postgres://username:password@host:port/databasename`

For running tests for the app
`export TEST_DATABASE_URL=postgres://username:password@host:port/databasename`

Install all dependencies: npm install

Create tables: npm run seed-database

Create sample data: npm run create-fixtures. Sample data is based on real data at Roihu2016 finnjamboree.

User login with only email

Define your email send settings in mailsettings.js file. Set APP_URL environment variable to application url, so that link in email is correct.

Running the app

Start server with npm start

You can enable dev settings and api explorer with NODE_ENV=dev npm start

Valid endpoints

All GET requests should use lang parameter like LocationCategories/translations?lang=FI

Achievements

  • User completed achievements -> GET api/ApiUsers/{id}/completedAchievements
  • Mark achievement completed -> PUT api/ApiUsers/{id}/achievements/rel/{fk}
  • Mark achievement un-completed -> DELETE api/ApiUsers/{id}/achievements/rel/{fk}
  • All achievements -> GET api/AchievementCategories/translations

Locations

  • All Locations -> GET api/LocationCategories/translations
    • use param afterDate with javascript ISO formatted date to get articles after that date. There is five minute "safezone" before that. (Date format: 2016-05-23T13:10:08.553Z)

Instructions

  • All instructions -> GET api/InstructionCategories/translations
    • use param afterDate with javascript ISO formatted date to get articles after that date. There is five minute "safezone" before that. (Date format: 2016-05-23T13:10:08.553Z)

Calendar and events

  • Events search -> GET api/CalendarEvents/translations
  • Users calendar -> GET api/ApiUsers/{id}/calendar
  • Add event to calendar -> PUT api/ApiUsers/{id}/calendarEvents/rel/{fk}
  • remove event from calendar -> DELETE api/ApiUsers/{id}/calendarEvents/rel/{fk}
  • Submit new event -> POST api/CalendarEvents

Users

  • Login -> POST api/ApiUsers/login
  • Logout -> POST api/ApiUsers/logout
  • Email login -> POST api/ApiUsers/emailLogin
  • Saml login -> POST saml/login

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published