ERD 수정

(일단 별점으로만 상품 추천을 측정하고자 함.
추후 AI 과정을 배우고 여력이 된다면 추천 컬럼들을 더 추가할 예정.)

API 디자인 수정

코드

(저는 이제 main.py 틀 잡기 시작 ㅠㅠ;;
아직 껍데기 밖에 없습니다..
코드는 수업 이후 더 보완해서 깃허브에 올릴 예정입니다.)

from ctypes import Union
from typing import Annotated

from fastapi import Depends, FastAPI, HTTPException, status
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
from fastapi import Body

from pydantic import BaseModel
from datetime import date, datetime, time, timedelta

import logging
import sys

from jose import JWTError, jwt
from passlib.context import CryptContext

mylogger = logging.getLogger("mylogger")

formatter = logging.Formatter('[%(levelname)s] %(message)s')

handler = logging.StreamHandler(stream=sys.stdout)
handler.setFormatter(formatter)
handler.setLevel(logging.DEBUG)

mylogger.addHandler(handler)
mylogger.setLevel(logging.DEBUG)

class User(BaseModel):
    user_id: int
    name: str
    email: str
    email_auth: str
    password: str
    phone: str
    created_at :datetime

class Product(BaseModel):
    product_id : int
    name: str
    category: str
    image: str
    info: str
    price: str
    brand: str
    use: str
    is_domestic: bool

class Recomendation(BaseModel):
    user_id: int
    product_id: int
    rating: int

class Post(BaseModel):
    post_id: int
    title: str
    content: str
    created_at: datetime
    modified_at: datetime
    user_id: int

class Comment(BaseModel):
    comment_id : int
    title: str
    created_at: datetime
    modified_at: datetime
    post_id: int
    user_id: int

app = FastAPI()

@app.get("/")
async def home():
    return {}

@app.get("/signup")
async def signup():
    return {}

@app.post("/login")
async def login():
    return {}

@app.post("/users/email_auth")
async def email_auth():
    return {}

@app.post("/logout")
async def logout():
    return {}

@app.put("/users/{user_id}")
async def user_info_modify():
    return {}

@app.delete("/users/{user_id}")
async def user_delete():
    return {}

@app.get("/products")
async def product_total():
    return {}

@app.get("/products/{product_id}")
async def product_one():
    return {}

@app.get("/recommendations/{user_id}")
async def user_recommendation_total():
    return {}

@app.get("/recommendations/{user_id}}/{product_id}")
async def user_recommendation_one():
    return {}

@app.post("/recommendations/{user_id}}/{product_id}/rating")
async def user_recommendation_rating():
    return {}

@app.post("/posts")
async def post_total():
    return {}

@app.put("/posts/{post_id}")
async def post_modify():
    return {}

@app.get("/posts")
async def post_total():
    return {}

@app.get("/posts/{post_id}")
async def post_one():
    return {}

@app.delete("/posts/{post_id}")
async def post_delete():
    return {}

본 후기는 정보통신산업진흥원(NIPA)에서 주관하는 <AI 서비스 완성! AI+웹개발 취업캠프 - 프론트엔드&백엔드> 과정 학습/프로젝트/과제 기록으로 작성 되었습니다.

profile
유후랄라 개발일기

1개의 댓글

comment-user-thumbnail
2023년 8월 18일

정보 감사합니다.

답글 달기