Giter VIP home page Giter VIP logo

sns-api's Introduction

SNS-API

소셜 네트워킹 서비스(sns) API

목차

  1. 프로젝트 개요
  2. 개발 기간
  3. 프로젝트 기술 스택
  4. 요구사항 분석
  5. ERD
  6. API 명세
  7. 프로젝트 구조
  8. 프로젝트 시작 방법

프로젝트 개요

Django Rest Framework 를 이용한 REST API 서버로

  • 유저 회원가입, 로그인(토큰 인증 방식) 기능
  • 게시글 생성, 수정, 삭제, 조회 기능
  • 좋아요

위 기능을 제공합니다.


개발 기간

  • 2022/09/29~2022/10/03 (3일)

프로젝트 기술 스택

Backend

DB

Tools


과제 요구사항 분석

✅ 게시글 기능 : 로그인한 유저만 접근 가능합니다.

1. 유저 관련

  • 모델링 : django의 AbstractBaseUser를 상속 받아 이메일을 id로 하는 User 모델 구현

1-1) 유저 회원가입

1-2) 유저 로그인

  • simplejwt를 이용하여 토큰 인증 방식 로그인 구현

2. 게시글 관련

2-1) 게시글 생성

  • 게시글 생성시
    1. 제목(title), 내용(content), 태그(tags) 필요
    2. 태그는 '#태그' 형식이며 여러 개인 경우 '#태그1,#태그2' 와 같이 ','로 구분

2-2) 게시글 수정

  • 게시글 수정시
    1. 제목(title), 내용(content), 태그(tags) 필요

2-3) 게시글 조회

  • 게시글 전체 조회시

    1. 기본 정렬: 최신순(생성일자 기준)
    2. 정렬은 조회수(views), 좋아요 수(likes), 생성 일자(created_at) 기준으로 가능하며 오름차순, 내림차순 가능 url/?ordering=-views => 내림차순인 경우 필드명 앞에 '-'
    3. 검색이 가능하며 제목을 기준으로 검색 가능 url/?search=검색어
    4. 태그 필터링이 가능하며 여러 개인 경우 ','로 구분하고 해당 태그를 모두 포함한 게시글만 필터링 url/?tags=태그1,태그2
    5. 페이지 사이즈 지정 가능하며 페이지에 표현할 글의 최대 개수는 30개 기본은 10개 url/?page_size=20
  • 게시글 상세 조회시

    1. 날짜, 유저에 상관 없이 조회시 조회수 1 증가

2-4) 게시글 삭제

  • is_deleted 필드를 이용하여 soft delete 방식으로 구현
  • 삭제 게시글 복구 가능

2-5) 좋아요 기능

  • 유저는 한 게시글에 한번 좋아요를 할 수 있으며 좋아요가 되어있는 경우 다시 요청시 좋아요 취소

3. 테스트

  • 테스트 코드 구현 예정
  • rest_frameworkAPITestCase 이용

기능 목록

버전 기능 세부 기능 설명 상태
v1 유저 회원가입 회원가입
- - 로그인 jwt를 이용한 로그인
- 게시글 생성 게시글 생성
- - 조회 게시글 조회
- - 수정 게시글 수정
- - 삭제 게시글 삭제(soft-delete)
- - 조회 조회시 필터링, 페이지네이션, 정렬, 검색 기능
- - 좋아요 게시글 좋아요 기능
- 테스트 테스트 기능, 전체 테스트

🔥 추가 기능 구현시 업데이트 예정


ERD

image

  • User model
    • User 모델은 Django의 AbstractBaseUser를 overriding
  • Post model
    • USER ↔ POST (1:N)
    • POST ↔ HASHTAG (N:M)
    • POST ↔ USER (N:M) (좋아요 기능)
  • HashTag model

API 명세

POSTMAN API DOCS

프로젝트 구조

├── apps              
│   ├── account       
│   │   ├── admin.py  
│   │   ├── apps.py   
│   │   ├── forms.py  
│   │   ├── migrations
│   │   ├── models.py
│   │   ├── serializers.py
│   │   ├── tests.py
│   │   ├── urls.py
│   │   └── views.py
│   ├── post
│   │   ├── admin.py
│   │   ├── apps.py
│   │   ├── migrations
│   │   ├── models.py
│   │   ├── paginations.py
│   │   ├── permissions.py
│   │   ├── serializers.py
│   │   ├── tests.py
│   │   ├── urls.py
│   │   └── views.py
│   └── urls.py
├── config
│   ├── asgi.py
│   ├── settings
│   │   ├── base.py
│   │   ├── dev.py
│   │   ├── prod.py
│   │   └── test.py
│   ├── urls.py
│   └── wsgi.py
└── manage.py

프로젝트 시작 방법

  1. 로컬에서 실행할 경우
# 프로젝트 clone(로컬로 내려받기)
git clone -b develop --single-branch ${github 주소}
cd ${디렉터리 명}

# 가상환경 설정
python -m venv ${가상환경명}
source ${가상환경명}/bin/activate
# window (2 ways) 
# 1> ${가상환경명}/Scripts/activate
# 2> activate

# 라이브러리 설치
pip install -r requirements.txt
# 실행
python manage.py runserver

sns-api's People

Contributors

hyes-y avatar

Watchers

 avatar

sns-api's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.