Exemplo n.º 1
0
def main():
    db = DbService()

    user_repo = UserRepository(db)
    profile_repo = ProfileRepository(db)
    post_repo = PostRepository(db)

    user_controller = UserController(user_repo)
    profile_controller = ProfileController(profile_repo)
    post_controller = PostController(post_repo)

    app = StartMenu(user_controller, profile_controller, post_controller)

    try:
        app.display()
    except UserExitException:
        print(
            '\n\n=================================================\nExiting the programm; closing connection with database.\nThank you for using this software and goodbye!'
        )
        db = DbService()
        db.close()
Exemplo n.º 2
0
def main():
    db = DbService()

    user_repo = UserRepository(db)
    profile_repo = ProfileRepository(db)
    post_repo = PostRepository(db)

    user_controller = UserController(user_repo)
    profile_controller = ProfileController(profile_repo)
    post_controller = PostController(post_repo)

    app = StartMenu(user_controller, profile_controller, post_controller)
    app.show()
Exemplo n.º 3
0
#!/usr/bin/env python
import json
from pymongo import MongoClient
import db
from server_exceptions import PermissionDeniedException, WebException
from server_infrastructure import *
from wol import app

__author__ = 'archeg'

from flask import request, jsonify
from db import DbService
import requests

db = DbService(MongoClient()["WOL"])

# TODO: Make it REST


@app.route("/")
def hello_world():
    return 'Hello World'


web_path = "/wol/api/v1.0/"


@app.route(web_path + "auth", methods=['POST'])
def auth():
    login, pwd, device_id = check_json_for_keys(["login", "pwd", "device_id"])
    token = db.authenticate(login, pwd, device_id)
Exemplo n.º 4
0
    user_repo = UserRepository(db)
    profile_repo = ProfileRepository(db)
    post_repo = PostRepository(db)

    user_controller = UserController(user_repo)
    profile_controller = ProfileController(profile_repo)
    post_controller = PostController(post_repo)

    app = StartMenu(user_controller, profile_controller, post_controller)

    try:
        app.display()
    except UserExitException:
        print(
            '\n\n=================================================\nExiting the programm; closing connection with database.\nThank you for using this software and goodbye!'
        )
        db = DbService()
        db.close()


if __name__ == '__main__':
    try:
        main()
    except KeyboardInterrupt:
        print(
            '\n\n=================================================\nForced programm shutdown; closing connection with database.\nThank you for using this software and goodbye!'
        )
        db = DbService()
        db.close()