29 lines
693 B
Python
29 lines
693 B
Python
from fastapi import FastAPI, Request
|
|
|
|
from app.constants import logger
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/")
|
|
def read_root():
|
|
return {"Hello": "World"}
|
|
|
|
|
|
@app.post("/integration")
|
|
async def intgr(request: Request):
|
|
body = await request.json()
|
|
ref = body["ref"]
|
|
branch = ref.split('/')[-1]
|
|
[tag, number, *args] = branch.split('-')
|
|
logger.info(f"tag {tag} number {number} args {args}")
|
|
|
|
if number == 'test':
|
|
number = 423
|
|
|
|
request.get(
|
|
"https://crm.svs-tech.pro/rest/38/7ufrqnfpncmt279p/task.commentitem.add.json?"
|
|
f"taskId={number}&fields[POST_MESSAGE]=f'{body['commits'][0]['message']}'"
|
|
)
|
|
return {"status": "success"}
|