GithubHelp home page GithubHelp logo

algosipdahack / anti-backend-newbie Goto Github PK

View Code? Open in Web Editor NEW

This project forked from antigravity-official/anti-backend-newbie

0.0 0.0 0.0 126 KB

안티그래비티 백엔드 주니어 기술과제

Java 100.00%

anti-backend-newbie's Introduction

안티그래비티 백엔드 주니어 기술과제

[피팅노트 서비스에 "찜 상품" 기능을 구현 해주세요!]

개요

  • '찜 상품'은 일종의 즐겨찾기로써 고객이 상품을 즐겨찾기 목록에 추가하고 언제든지 자신이 추가한 상품을 모아서 볼 수 있는 기능입니다.
  • 아래 요구사항에 맞춰서 찜 상품 등록, 찜 상품 조회 API와 추가로 필요한 테이블을 구현 해주세요.

배경

  • 고객(user)와 상품(products) 테이블의 스키마, 데이터가 제공됩니다.
  • API 요청에 커스텀 헤더가 있습니다.
    • X-USER-ID: Integer

요구사항

찜 상품 등록

  • [POST] /products/liked/{productId}
  • {user}가 {productId}를 찜 했다는 정보를 저장합니다.
  • {user}가 찜을 할 때마다 상품 조회 수도 1 증가합니다.
  • {user}가 존재하지 않거나 잘못된 {productId}로 요청을 했거나 이미 찜한 상품일 경우 400 Bad Request 로 응답합니다.
  • 정상적으로 등록이 완료되면 201 Created 로 응답하며, 응답 본문은 자유롭게 구현할 수 있습니다.

찜 상품 조회

  • [GET] /products?liked?liked={boolean}&page={integer}&size={integer}
  • 페이징 된 상품 목록을 조회합니다.
  • liked 파라미터가 없으면 모든 상품을 조회하되 {user}가 찜한 상품에 liked: true를 추가하고
  • liked=false 이면 찜하지 않은 상품만 조회
  • liked=true 이면 {user}가 찜한 상품만 조회합니다.
  • 잘못된 파라미터가 들어오면 400 Bad Request 로 응답합니다.
  • 정상인 경우 200 OK 로 응답하며, 응답 본문은 antigravity/product/web/dto 를 참고하여 작성합니다.
  • 한 상품의 응답 json 명세는 기본적으로 다음과 같습니다. 아래 명세를 바탕으로 페이징 된 전체 응답 객체를 구성 해주세요.
{
  "id": 1,
  "sku": "G2000000019",
  "name": "No1. 더핏세트",
  "price": 42800,
  "quantity": 10,
  "liked": true,
  "totalLiked": 2,
  "viewed": 40,
  "createdAt": "2021-11-01 12:31:19",
  "updatedAt": "2021-11-11 16:31:19"
}

기타 요구사항

  • 자유롭게 라이브러리를 추가하거나 소스 코드를 수정할 수 있습니다.
  • 기타 필요한 기능이 있다면 추가할 수 있습니다.
  • 트랜잭션과 대용량 트래픽 고려가 가능하다면 추가할 수 있습니다.
  • 중복 코드 최소화를 고려 해주세요.
  • 촘촘한 검증 코드를 넣어 주세요.

제출내용

  1. git 레포지토리를 fork 하여 작성한 후 PR을 보내세요
  2. 리팩토링 의도와 구조에 대한 간략한 설명을 PR 본문에 적어주세요

anti-backend-newbie's People

Contributors

algosipdahack avatar rogerantigravity 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.