Giter Site home page Giter Site logo

hhplus-tdd-1's Introduction

hhplus-tdd-1

항해 플러스 1주차

❓ [과제] point 패키지의 TODO 와 테스트코드를 작성해주세요.

요구 사항

  • PATCH /point/{id}/charge : 포인트를 충전한다.
  • PATCH /point/{id}/use : 포인트를 사용한다.
  • GET /point/{id} : 포인트를 조회한다.
  • GET /point/{id}/histories : 포인트 내역을 조회한다.
  • 잔고가 부족할 경우, 포인트 사용은 실패하여야 합니다.
  • 동시에 여러 건의 포인트 충전, 이용 요청이 들어올 경우 순차적으로 처리되어야 합니다. (동시성)

제공 구조

  • UserPoint
    • id
    • point : 포인트 정보
    • updateMillis : 변경 시간
  • PointHistory
    • id
    • userId : UserPoint Id
    • amount : 포인트 차감 값(충전시 +, 사용시 -)
    • type : 포인트 충전/사용 유무(CHARGE/USE)
    • updateMillis : 변경시간

image

  • API
    • PATCH /point/{id}/charge : 포인트를 충전한다.
    • PATCH /point/{id}/use : 포인트를 사용한다.
      • userId, isSuccess
    • GET /point/{id} : 포인트를 조회한다.
      • userId, point
    • GET /point/{id}/histories : 포인트 내역을 조회한다.
      • userId, list<pointhistory>, list.size(), pageable(시간 나면 추가)

예상 문제 사항

  1. 공통
    • 존재 X userId
  2. 충전 상황
    • 0 or 음수 값 충전 시도
    • integer 이외 값
  3. 사용 상황
    • 0 or 음수 or 보유 포인트 초과 사용 시도
    • integer 이외 값
  4. 포인트 조회
  5. 포인트 내역 조회
    • 내역 없을 때

hhplus-tdd-1's People

Contributors

faulty337 avatar

Watchers

 avatar

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.