save 15-8-2022

This commit is contained in:
2022-08-15 10:53:52 +07:00
parent d21fdea082
commit a027c72910
6 changed files with 121 additions and 22 deletions

View File

@@ -23,7 +23,7 @@ from ..dependecies import (
create_access_token,
get_password_hash
)
from ..settings import db, ACCESS_TOKEN_EXPIRE_MINUTES
from ..settings import *
import json
from typing import List
from datetime import datetime, timedelta
@@ -43,7 +43,7 @@ post_save = APIRouter()
@post_save.post("/save_post", response_description="save new post", response_model=SavePostModel)
async def create_post(post_save: SavePost):
try:
url = "https://sandboxapi.ebacsi.com.vn/auth/oauth/check_token"
url = URL_OAUTH2_GET_CHECK_TOKEN
payload = {'token': post_save.token}
headers = {
'Authorization': 'Basic RGljdGlvbmFyeU1lZGlob21lOlJ4aXR6ZnZvaWFmZmNtb2l0ZW0='
@@ -75,7 +75,7 @@ async def create_post(post_save: SavePost):
"/list_save_post_by_user", response_description="List save posts", response_model=SavePostModel
)
async def list_post(post_save: SavePost):
url = "https://sandboxapi.ebacsi.com.vn/auth/oauth/check_token"
url = URL_OAUTH2_GET_CHECK_TOKEN
payload = {'token': post_save.token}
headers = {
'Authorization': 'Basic RGljdGlvbmFyeU1lZGlob21lOlJ4aXR6ZnZvaWFmZmNtb2l0ZW0='
@@ -94,7 +94,7 @@ async def list_post(post_save: SavePost):
async def delete_save_post(post_id: str, token: str):
# delete_result = await db["post_save"].delete_one({"_id": user_id})
try:
url = "https://sandboxapi.ebacsi.com.vn/auth/oauth/check_token"
url = URL_OAUTH2_GET_CHECK_TOKEN
payload = {'token': token}
headers = {
'Authorization': 'Basic RGljdGlvbmFyeU1lZGlob21lOlJ4aXR6ZnZvaWFmZmNtb2l0ZW0='