Esempio n. 1
0
def create_user():
    body = body_validator(UserSchema)

    user_name = body["name"]
    icon_color = body["icon_color"]

    user = UserService.add(user_name, icon_color)
    return user.to_dict()
    def post(self):
        body = json_body_validator(SignInSchema)

        username = body.get("username", "Guest")
        email = body["email"]

        if UserService.exists_by_email(email):
            user = UserService.get_by_email(email)
            session["id"] = user.id

            return {"data": user.to_dict()}

        user = UserService.add(username, email)
        session["id"] = user.id

        return {"data": user.to_dict()}