Commit b047a0d7 authored by Michal Pavlík's avatar Michal Pavlík

project base

parent 76322b89
Pipeline #21746 failed with stages
__pycache__
venv
# lh-flask-project
## Unix
run bash unix.sh
## Windows
run windows.cmd
\ No newline at end of file
import connexion
cnx = connexion.App(__name__, specification_dir='./')
cnx.add_api('swagger.yml')
if __name__ == '__main__':
cnx.run(debug=True, port=8080)
def post():
pass
def all():
pass
def get(id):
pass
def delete(id):
pass
attrs==19.3.0
bcrypt==3.1.7
certifi==2019.11.28
cffi==1.14.0
chardet==3.0.4
Click==7.0
clickclick==1.2.2
connexion==2.6.0
Flask==1.1.1
Flask-SQLAlchemy==2.4.1
idna==2.8
importlib-metadata==1.5.0
inflection==0.3.1
itsdangerous==1.1.0
Jinja2==2.11.1
jsonschema==3.2.0
MarkupSafe==1.1.1
openapi-spec-validator==0.2.8
pycparser==2.19
pyrsistent==0.15.7
PyYAML==5.3
requests==2.22.0
six==1.14.0
SQLAlchemy==1.3.13
swagger-ui-bundle==0.0.6
urllib3==1.25.8
Werkzeug==1.0.0
zipp==2.2.0
openapi: 3.0.2
info:
version: 1.0.0
title: 'Chytro'
description: 'Aplikácia pre nástenku'
servers:
- url: 'http://localhost:8080/'
- url: 'https://localhost:8080/'
security:
- BasicAuth: []
- OAuth2:
- read
- write
paths:
/user/avatar:
put:
description: 'Upload an user image as avatar.'
operationId: users.upload_avatar
tags:
- Users
requestBody:
content:
image/png:
schema:
type: string
format: binary
image/jpg:
schema:
type: string
format: binary
responses:
200:
description: 'Image uploaded successfully'
413:
description: 'Payload too large'
/user:
post:
description: 'Regsiter a new user'
operationId: users.register
tags:
- Users
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RegisterUser'
responses:
201:
description: 'Register a new user.'
content:
application/json:
schema:
$ref: '#/components/schemas/User'
422:
description: 'Unprocessable entity'
/user/{id}:
get:
description: 'Get a single user from the database by his ID.'
operationId: users.get
tags:
- Users
parameters:
- $ref: '#/components/parameters/id'
responses:
200:
description: 'Correctly found a user by ID'
content:
application/json:
schema:
$ref: '#/components/schemas/User'
404:
description: "User with this ID doesn't exist"
/post/{id}:
get:
description: 'Get post detail'
operationId: posts.get
tags:
- Posts
parameters:
- $ref: '#/components/parameters/id'
responses:
200:
$ref: '#/components/responses/PostDetail'
404:
description: 'Post not found'
delete:
description: 'Remove Posts'
operationId: posts.delete
tags:
- Posts
parameters:
- $ref: '#/components/parameters/id'
responses:
204:
description: 'Success'
404:
description: 'Post not found'
/board:
get:
description: 'Get all posts paged'
operationId: boards.all
tags:
- Boards
security: []
parameters:
- $ref: '#/components/parameters/PageNumber'
- $ref: '#/components/parameters/PageSize'
responses:
200:
description: 'Paged responses here...'
content:
application/json:
schema:
$ref: '#/components/schemas/PostPage'
post:
description: 'Post a new Post'
operationId: boards.post
tags:
- Boards
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
message:
type: string
responses:
201:
$ref: '#/components/responses/PostDetail'
400:
description: 'Bad Request'
422:
description: 'Unprocessable Entity'
components:
securitySchemes:
BasicAuth:
type: http
scheme: basic
OAuth2:
type: oauth2
flows:
password:
tokenUrl: 'http://localhost:8091/auth/token'
scopes:
read: Grants read
write: Grants write
schemas:
Post:
type: object
properties:
message:
type: string
author:
type: string
created:
type: string
format: date-time
RegisterUser:
type: object
properties:
username:
type: string
password:
type: string
User:
type: object
properties:
username:
type: string
created:
type: string
format: date-time
avatarUrl:
type: string
PostPage:
type: object
properties:
content:
type: array
items:
$ref: '#/components/schemas/Post'
page:
type: integer
size:
type: integer
totalPages:
type: integer
parameters:
id:
name: id
in: path
required: true
schema:
type: integer
PageNumber:
name: page
in: query
required: false
schema:
type: integer
PageSize:
name: size
in: query
required: false
schema:
type: integer
responses:
PostDetail:
description: 'Returns a complete detail of a Post object.'
content:
application/json:
schema:
$ref: '#/components/schemas/Post'
#!/bin/bash
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python3 app.py
def get(id):
pass
def upload_avatar():
pass
def register():
pass
python -m venv venv
CALL venv\Scripts\activate
pip install -r requirements.txt
python app.py
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment