Skip to content

Open source spatial and geographic platform to create and show the last severe alerts based on CAP (Common Alert Protocol). Front-end (Twitter Bootstrap, Javascript, JQuery) and Back-end (Php, Yii2, Postgres, Postgis, Restful, Api, Json). This platform have been created to help the meteorologic agencies to predict severe events and create CAP.

License

Notifications You must be signed in to change notification settings

victorfleite/wwalerts-backend

Repository files navigation

WWALERTS

This project is a platform + api to create alerts of severe events of meteorology. Its also creates the CAP (v1.2) files (Common Alert Protocol)

INSTALLATION

Create a new repository

1. $ git clone git@github.com:victorfleite/wwalerts-backend.git wwalert

Install Composer. For more.

2. $ curl -sS https://getcomposer.org/installer | php
3. $ sudo mv composer.phar /usr/local/bin/composer
4. $ sudo chown -fR yourUser:root /usr/local/bin/composer
5. $ sudo composer global require "fxp/composer-asset-plugin:^1.3.1"

Update Composer

6. $ cd yourFolderName
7. $ composer update
8. Create your local database
9. Set the database configuration on common/config/main-local.php
<?php
return [
    'components' => [
        'db' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'pgsql:host=localhost;dbname=databasename',
            'username' => 'postgres',
            'password' => 'postgres',
            'charset' => 'utf8',
        ],
        ...
    ],
];
10. $ sudo chmod 777 /var/www/html/yourFolderName/backend/web/assets

USAGE

Access you application on http://localhost/wwalert

Insert the username: victor.leite

Insert the password: mypassword

Login into the system (You have the administrator role) :-)

EXEMPLE API CALLS


1. Token access required
curl -i -H "Accept:application/json" -H "Content-Type:application/json" "http://localhost/yourFolderName/service/api/www/index.php/oauth2/token" -XPOST \
-d '{"grant_type":"password","username":"victor.leite@gmail.com","password":"mypassword","client_id":"myclientId","client_secret":"mySecretPassword"}'

2. Token access required with scope
curl -i -H "Accept:application/json" -H "Content-Type:application/json" "http://localhost/yourFolderName/service/api/www/index.php/oauth2/token" -XPOST \
-d '{"grant_type":"password","username":"victor.leite@gmail.com","password":"mypassword","client_id":"myclientId","client_secret":"mySecretPassword","scope":"custom"}'

3 - User data required
curl -i -H "Accept:application/json" -H "Content-Type:application/json" "http://localhost/yourFolderName/service/api/www/index.php/v1/user/get-user?access_token={TOKEN_GERADO_NA_AUTENTICACAO}"

CONTRIBUTION

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

HISTORY

I decided to create this project to help people to accelerate the proccess to create application and services/api rest in the same project.

CREDITS

mdmsoft/yii2-admin

filsh/yii2-oauth2-server

mootensai/yii2-enhanced-gii

LICENCE

The MIT License

===============================

DIRECTORY STRUCTURE


backend
    assets/              contains application assets such as JavaScript and CSS
    config/              contains backend configurations
    controllers/         contains Web controller classes
    models/              contains backend-specific model classes
    runtime/             contains files generated during runtime
    tests/               contains tests for backend application    
    views/               contains view files for the Web application
    web/                 contains the entry script and Web resources
    widgets/             contains widgets for the Web application
common
    config/              contains shared configurations
    mail/                contains view files for e-mails
    models/              contains model classes used in both backend and frontend
    tests/               contains tests for common classes    
console
    config/              contains console configurations
    controllers/         contains console controllers (commands)
    migrations/          contains database migrations
    models/              contains console-specific model classes
    runtime/             contains files generated during runtime
service    
    api/common/		 contains controllers or models commons for api application
    api/components/	 contains components that could be inherited by classes and controllers in each version (ex: versions/v1)
    api/config/		 contains shared configurations
    api/versions/	 versions of application
    api/www/		 initial folder for application
vendor/              contains dependent 3rd-party packages

===============================

About

Open source spatial and geographic platform to create and show the last severe alerts based on CAP (Common Alert Protocol). Front-end (Twitter Bootstrap, Javascript, JQuery) and Back-end (Php, Yii2, Postgres, Postgis, Restful, Api, Json). This platform have been created to help the meteorologic agencies to predict severe events and create CAP.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages