Skip to content

matt-coles/uni-society-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uni-society-manager travisbadge Coverage Status dankmeme

Server for Integrated Project, powered by Express.js and Redis, listens for HTTPS requests on port 443 and HTTP requests on port 80 and port 3000. Certificate provided for free by the brilliant Lets Encrypt! project. Unit tests are run on each commit with Travis CI. Results of these tests can be viewed by clicking the build passing/failing badge. Unit tests exist for each route with a âś… by its name.

HTTPS Screenshot

Installation

Instructions are for OSX El Capitan at time of writing.

First install the Redis server:

brew install redis

Then clone this repository:

git clone https://github.com/Alpha-Atom/ip-project-server.git

And finally, install the dependencies

npm install

Running

To run, first start Redis:

redis-server

Then start the Express framework using:

node index.js

A production environment, using HTTPS can be started using:

node index.js -p

Do note that this requires both cert.pem and key.pem to be in the root directory of the project for SSL or it will not start.

Testing

To test, start a new Redis server somewhere other than the main database with:

redis-server

Then start up the Express framework using:

node index.js

You do not need to use the production environment for this.

Finally run the tests with:

npm test

DO NOT run npm test whilst the main database is running on localhost:6379/0. The testing command flushes that database at the end of the tests and this will occur regardless of test passes or failures.

API

/hello/:name/

Returns "Hello :name!" or simply "Hello World!" if no name is present. Useful for checking if the server is running :)

/user/register/

In order to register a new user account, a POST request should be sent, with the following data:

{
    "user": "FooBar", // Desired username goes here
    "password": "hunter2" // Desired password goes here
}

The server will then respond with a JSON object that looks something like this:

{
    "registered": 1, // Value is 1 or 0 based on whether registration was successful
    "auth-key": "$2a$10$.X9YrNyd2R7b2ycAumHn.ONiINs2bCkRDupugu6sjZkUkPmXSaSra", // Value is an authentication key to be used in API requests
    "error": 0 // Error code, if an error occured. 0 indicates no error.
}

The value of the error code will be 1 if the username already exists, and 2 if the request was malformed.

/user/auth/

In order to log into an account, or essentially request a new authentication token, a POST request should be sent with the following data:

{
    "user": "FooBar", // Username goes here
    "password": "hunter2", // Password goes here
}

Using this will then generate a new authentication key, invalidating any existing authentication key for that account. Note that you do not need to use /auth/ after registering as a new auth key is already generated.

{
    "logged_in": 1, // Value is 1 or 0 whether or not the login was successful
    "auth-key": "$2a$10$.X9YrNyd2R7b2ycAumHn.ONiINs2bCkRDupugu6sjZkUkPmXSaSra", // Only present if logged_in == 1, to be used in API requests
    "error": 0 // Error code, if an error occured. 0 indicates no error.
}

The error codes are as follows, 1 indicates the username or password was invalid and 2 indicates that the login request was malformed.

/user/view/

To view all the public information for all users at once, a GET request should be sent with no data, and the returned response will look like this:

{
    "users": [
        {
            "username": "test1",
            "societies": [
                "TestSociety2"
            ],
            "friends": [],
            "accepted_events": []
        },
        {
            "username": "test2",
            "societies": [
                "TestSociety2"
            ],
            "friends": [],
            "accepted_events": []
        },
        { ... } // More items here
    ]
}

There are no error codes for this route.

/user/view/:user

To view the public information for any given :user, a GET request should be sent with no data, and the returned response will look like this:

{
    "user": {
        "username": "test1",
        "societies": [
            "TestSociety2"
        ],
        "friends": [],
        "accepted_events": []
    },
    "error": 0
}

The error codes are as follows, 1 indicates that the user does not exist.

/society/create/

To create a new society, a POST request should be sent with the following data:

{
    "society": "FooBarSociety", // The name of the society to be created.
    "admins": ["FooBar", "BarFoo", "FarBoo"], // List of initial admins to be added, this list MUST include the user creating the society
    "description": "A description of the FooBarSociety society.",
    "auth": "$2a$10$.X9YrNyd2R7b2ycAumHn.ONiINs2bCkRDupugu6sjZkUkPmXSaSra",
    "image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4QA2RXhpZgAASUkqAAgAAAABADIBAgAUAAAAGgAAAAAAAAAyMDEwOjAyOjE4IDIyOjA0OjU1AP/bAEMABgQFBgUEBgYFBgcHBggKEAoKCQkKFA4PDBAXFBgYFxQWFhodJR8aGyMcFhYgLCAjJicpKikZHy0wLSgwJSgpKP/bAEMBBwcHCggKEwoKEygaFhooKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKP/CABEIAOw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4xB7QB1A7QjiAdcICB0rv8OPgxiSyXsv4nhge0B2h4wkpA7Qz1DOAgVKgSuh+jfSuitxl8JTtKzwj0hRmY7Qq4Q6nQ+O/lcucxjGVEiXAYFkqBmV8L+F/N+D0ejGMvo/Aw1+p//9k="
}

If the society does not already exist, the new values will be added to the database and a response will be sent looking like this:

{
    "success": 1, // Indicates if a society was successfully created.
    "society": {
        "name": "FooBarSociety",
        "admins": ["FooBar", "BarFoo", "FarBoo"],
        "description": "A description of the FooBarSociety society.",
        "users": ["FooBar", "BarFoo", "FarBoo"], // At this point the users will simply be the admin list
        "image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4QA2RXhpZgAASUkqAAgAAAABADIBAgAUAAAAGgAAAAAAAAAyMDEwOjAyOjE4IDIyOjA0OjU1AP/bAEMABgQFBgUEBgYFBgcHBggKEAoKCQkKFA4PDBAXFBgYFxQWFhodJR8aGyMcFhYgLCAjJicpKikZHy0wLSgwJSgpKP/bAEMBBwcHCggKEwoKEygaFhooKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKP/CABEIAOwA7AMBIgACEQEDEQH/xAAbAAEAAgMBAQAAAAAAAAAAAAAAAQQCAwUGB//EABkBAQADAQEAAAAAAAAAAAAAAAABAgMEBf/aAAwDAQACEAMQAAAB+mSAAAAAAAAAAAAAEJAAAAAkhIiQRIhIhMAAAAAACQAAAAAAAARIRIhMAACQAAAAAAAAAAAROEMmvYBKQAAAADRSd+HMr8O/W18unza9vRSwyt2rvktXRT2bi9n0eaUc+9bHN00OLf0HQ07u3CBeJAAAAxrc/h2tUFfyOvZpp9LDSh0a3OLVLTeXrXo58x0M+Llo9BHP0dfPdscb3vZjvI9DmEGQAHM6fI4Ns5oVeDe3Pn5xnp6MrXPvhWp6YujobJRzYqSynLZo2RRSuZ4ek2yt9dHu+bMRFolA2CQQVbWNJ5vnvS+Y83po17VfJa3c3rcu+NzPmc+u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w8hBJaJgbGK92EyoDi5UimGuPbAB2KrePzALqvL/AEWzSFKw7gANjoiF+PFegiIRWdQh8qGBaV5ouBpCsxVnLHapqF3b9tR1Ai9F2exsUqtW7hKlvcVkBAi6IqM92msQlwJZk5xGhqzuquViB3bt7wo7E8ivEti7LMr3WZ5sQ3b3lu5UpGL9eILQ0Qui/qGrJbRC4EoDHSMCB8blxr+IufEysI5UML8HvTBZBoCtTgIkWDaX0NamRetUmvbFaGeKN16grMVHEqzAIEsIbFra8SppMrW2GQK2hv14j9a0F33CcCNkbLI9kGDH8QwYldSvoB0Ot9Ll4ZVDvjQ08GyPiBmLqse9cfcVM2zYvBoiIkdURezLLb5QSZSieMMYGpW6AmdqYHaWFDXA2wseaht+u0e0yltS3KDKuBrFXEo46oHQ6vRixA9cJAGz5Bl9u5WTHN0ys0ehYfUFho6D+ICqytq4qJ1yaSZdaY4IY7VxhRUQdKIJWIZxKoUgdD4rFixR7im6BmXQJQKqaslxGsl7MyU6YZo7xE8l7YDse8oIqIDhBDBKZRKYED5sYosc29C0iW6mVqZL/iXIw938xRyMtkFWB9QCoqMQjiGcTxwkgJdQ6Hxeo2MRI1LCOwTLkg4xB7QB1A7QjiAdcICB0rv8OPgxiSyXsv4nhge0B2h4wkpA7Qz1DOAgVKgSuh+jfSuitxl8JTtKzwj0hRmY7Qq4Q6nQ+O/lcucxjGVEiXAYFkqBmV8L+F/N+D0ejGMvo/Aw1+p//9k="
    }, // An object representing the society
    "error": 0
}

The error codes are as follows, 1 indicates a malformed request, 2 indicates that a society with that name already exists, and 3 indicates that the user does not have authorisation to create that society. (Note that the admin list must contain the username that is creating it.)

/society/view/

To view a list of all the societies, a GET request should be sent with no data to this route with no parameter. The response will be formed as follows:

{
    "societies": [
        {
            "name": "TestSociety",
            "admins": [
                "test1",
                "test2"
            ],
            "description": "This is a test",
            "users": [
                "test1",
                "test2"
            ]
        },
        {
            "name": "TestSociety2",
            "admins": [
                "test1",
                "test2"
            ],
            "description": "This is a test",
            "users": [
                "test1",
                "test2"
            ]
        }
    ]
}

There are no error codes for this route.

/society/view/:society_name

To view a created society, :society_name, a GET request should be sent with no data. The response will then be formed as follows:

{
    "society": { // Society object containing information about the society
        "name": "FooBarSociety",
        "admins": ["FooBar", "BarFoo", "FarBoo"],
        "description": "A description of the FooBarSociety society.",
        "users": ["FooBar", "BarFoo", "FarBoo"]
    },
    "error": 0 // Error code if an error occured, 0 indicates no error.
}

The error codes are as follows, 1 indicates that the society does not exist.

/society/view/:society_name/events

To view all the events for a society, :society_name, a GET request should be sent with the following data:

{
  "auth": "$2a$10$ruuu6QfYLjW1QKOwONVvkelXuh8EVFyug/kJvfaTNL0aXNGyODZ9K"
}

Then the server will respond like this:

{
  "events": [
    {
      "name": "Super Mario Kart Party",
      "location": "Marioland",
      "society": "TestSociety",
      "start": "14605026110490",
      "end": "14605026110500",
      "details": "Play some Mario Kart with us",
      "organiser": "test1"
    },
    {
      "name": "Super Mario Kart Party 2",
      "location": "Marioland",
      "society": "TestSociety",
      "start": "14605026110490",
      "end": "14605026110500",
      "details": "Play some Mario Kart with us",
      "organiser": "test1"
    },
    { ... },
    { ... },
    { ... },
    { ... }
  ],
  "error": 0
}

The error codes are as follows, 1 indicates an invalid authentication key and 2 indicates a malformed request.

/society/join/

To join a society, a POST request should be sent with the following data:

{
    "society": "TestSociety", // Society name here
    "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2" // Auth key here
}

The response is then formed as follows:

{
    "success": 1, // Indicates successfulness
    "error": 0
}

The error codes are as follows, 1 indicates that the user is already a member of that society and 2 indicates a malformed request.

/society/leave/

To leave a society, a POST request should be sent with the following data:

{
    "society": "TestSociety", // Society name here
    "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2" // Auth key here
}

The response is then formed as follows:

{
    "success": 1, // Indicates successfulness
    "error": 0
}

The error codes are as follows, 1 indicates that the user isn't a member of that society and 2 indicates a malformed request.

/society/promote/

To promote a user within a society, a POST request should be sent with the following data:

{
    "user": "Test1",
    "society": "TestSociety",
    "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
}

The response will then be formed as follows:

{
    "success": 1,
    "error": 0
}

The error codes are as follows, 1 indicates that the auth key is invalid, 2 indicates that the user does not belong to the society, 3 indicates that the user is already an admin and 4 indicates a malformed request.

/society/kick/

To kick a user from a society, a POST request should be sent with the following data:

{
    "user": "Test3",
    "society": "TestSociety",
    "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
}

The response will then be formed as follows:

{
    "success": 1,
    "error": 0
}

The error codes are as follows, 1 indicates that the auth key is invalid, 2 indicates that the user does not belong to the society, 3 indicates that the user is an admin therefore cannot be kicked and 4 indicates a malformed request.

/events/create/

To create a new event, a POST request should be sent with the following data:

{
    "society": "TestSociety",
    "name": "Test Event",
    "location": "Test Location",
    "start": "1460552065702",
    "end": "1460552065734",
    "details": "Some details about the test event",
    "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
}

Note that the end time of the event must be greater than the start time and the start time must be greater than Date.now(). Perhaps some client side verification that ensures, for example, the time of the event is the next day. The response will look like this:

{
    "success": 1,
    "event": {
        "id": "101898721",
        "name": "Super Mario Kart Party",
        "organiser": "test1",
        "attendees": [],
        "location": "Marioland",
        "society": "TestSociety",
        "start": "14605026110490",
        "end": "14605026110500",
        "details": "Play some Mario Kart with us"
    },
    "error": 0
}

The error codes are as follows, 1 indicates that the user is not an admin of the society, 2 indicates that the event times are in some way invalid and 3 indicates that the request was malformed.

/events/view/:eventid

To view any individual event, a GET request should be sent with the following data:

{
    "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
}

The response will then look like this:

{
    "event": {
        "name": "Super Mario Kart Party",
        "location": "Marioland",
        "society": "TestSociety",
        "start": "14605026110490",
        "end": "14605026110500",
        "details": "Play some Mario Kart with us",
        "organiser": "test1",
        "attendees": [
            "test1",
            "test2"
        ],
        "id": "101898721"
    },
    "error": 0
}

The error codes are as follows, 1 indicates that the event does not exist, and 2 indicates a malformed request.

/events/edit/:eventid

To create a new event, a PUT request should be sent with the following data - all fields except auth are optional:

{
    "name": "Test Event",
    "location": "Test Location",
    "start": "1460552065702",
    "end": "1460552065734",
    "details": "Some details about the test event",
    "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
}

Note that the end time of the event must be greater than the start time and the start time must be greater than Date.now().

{
    "success": 1,
    "error": 0
}

The error codes are as follows, 1 indicates that the user is not an admin of the society, 2 indicates that the event could not be found, 3 indicates that the start or end times were in some way invalid and 4 indicates a malformed request.

/events/pending/

To get a users pending events, a GET request should be sent with the following data:

{
    "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
}

The response will then look like this:

{
    "pending_events": [
        {
            "name": "Super Mario Kart Party 5",
            "location": "Marioland",
            "society": "testsociety",
            "start": "14605026110490",
            "end": "14605026110500",
            "details": "Play some Mario Kart with us",
            "organiser": "test1",
            "attendees": [
                "test1",
                "test2"
            ],
            "id": "851133039"
        },
        {
            "name": "Super Mario Kart Party 6",
            "location": "Marioland",
            "society": "testsociety",
            "start": "14605026110490",
            "end": "14605026110500",
            "details": "Play some Mario Kart with us",
            "organiser": "test1",
            "attendees": [
                "test1",
                "test2"
            ],
            "id": "838450388"
        },
        { ... }
    ],
    "error": 0
}

The error codes are as follows, 1 indicates an invalid auth code and 2 indicates a malformed request.

/events/accepted/

To get a users accepted events, a GET request should be sent with the following data:

{
    "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
}

The response will then look like this:

{
    "accepted_events": [
        {
            "name": "Super Mario Kart Party 5",
            "location": "Marioland",
            "society": "testsociety",
            "start": "14605026110490",
            "end": "14605026110500",
            "details": "Play some Mario Kart with us",
            "organiser": "test1",
            "attendees": [
                "test1",
                "test2"
            ],
            "id": "851133039"
        },
        {
            "name": "Super Mario Kart Party 6",
            "location": "Marioland",
            "society": "testsociety",
            "start": "14605026110490",
            "end": "14605026110500",
            "details": "Play some Mario Kart with us",
            "organiser": "test1",
            "attendees": [
                "test1",
                "test2"
            ],
            "id": "838450388"
        },
        { ... }
    ],
    "error": 0
}

The error codes are as follows, 1 indicates an invalid auth code and 2 indicates a malformed request.

/events/declined/

To get a users declined events, a GET request should be sent with the following data:

{
    "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
}

The response will then look like this:

{
    "declined_events": [
        {
            "name": "Super Mario Kart Party 5",
            "location": "Marioland",
            "society": "testsociety",
            "start": "14605026110490",
            "end": "14605026110500",
            "details": "Play some Mario Kart with us",
            "organiser": "test1",
            "attendees": [
                "test1",
                "test2"
            ],
            "id": "851133039"
        },
        {
            "name": "Super Mario Kart Party 6",
            "location": "Marioland",
            "society": "testsociety",
            "start": "14605026110490",
            "end": "14605026110500",
            "details": "Play some Mario Kart with us",
            "organiser": "test1",
            "attendees": [
                "test1",
                "test2"
            ],
            "id": "838450388"
        },
        { ... }
    ],
    "error": 0
}

The error codes are as follows, 1 indicates an invalid auth code and 2 indicates a malformed request.

/events/accept/:eventid

To accept an event, a POST request should be sent with the following data:

{
    "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
}

The response will then look like this:

{
    "success": 1,
    "error": 0
}

The error codes are as follows, 1 indicates an invalid auth code, 2 indicates the event could not be found and 3 indicates a malformed request.

/events/decline/:eventid

To decline an event, a POST request should be sent with the following data:

{
    "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
}

The response will then look like this:

{
    "success": 1,
    "error": 0
}

The error codes are as follows, 1 indicates an invalid auth code, 2 indicates the event could not be found and 3 indicates a malformed request.

/events/cancel/:eventid

To cancel an event, a POST request should be sent with the following data:

{
    "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
}

The response will then look like this:

{
    "success": 1,
    "error": 0
}

The error codes are as follows, 1 indicates an invalid auth code, 2 indicates the event could not be found and 3 indicates a malformed request.

/friends/add/

To add a new friend, a POST request should be sent with the following data:

{
    "friend": "MyFriend",
    "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
}

The response will then look like this:

{
    "success": 1,
    "error": 0
}

The error codes are as follows, 1 indicates an invalid auth code, 2 indicates that the user is already a friend, 3 indicates that the user you are trying to add does not exist, 4 indicates that you are trying to add yourself and 5 indicates a malformed request.

/friends/remove/

To remove a friend from the friends list, a POST request should be sent with the following data:

{
    "friend": "MyFriend",
    "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
}

The response will then look like this:

{
    "success": 1,
    "error": 0
}

The error codes are as follows, 1 indicates an invalid auth code, 2 indicates that the user you are trying to remove is not an existing friend and 3 indicates a malformed request.

About

Public API for a society manager application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published