Skip to content

SOPT-29th-Joint-Seminar-10/socar-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

socar-backend

πŸš— μ˜μΉ΄μ•„μ•„μ•„μ•…ν‰· πŸš™


λ‹΄λ‹Ήμž

HTTP METHOD API λ‹΄λ‹Ήμž path μ™„λ£Œ
GET [μ°¨λŸ‰ ν”Œλžœ] λ‚˜μ˜ μ˜ˆμ•½ 이닀은 /my/rent βœ…
GET [μ°¨λŸ‰ ν”Œλžœ] μΆ”μ²œ μ°¨λŸ‰ 이닀은 /my/recommend βœ…
GET [μ°¨λŸ‰ μ˜ˆμ•½] μ°¨λŸ‰ ν•„ν„° 리슀트 λ°•λ‚˜ν¬ /reserve βœ…
PUT [μ°¨λŸ‰ μ˜ˆμ•½] ν•˜νŠΈ λ²„νŠΌ 클릭 이닀은 /my/favorite βœ…

폴더링

 ── socar-backend
    β”œβ”€β”€ firebase.json
    β”œβ”€β”€ functions
    β”‚Β Β  β”œβ”€β”€ api
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ index.js
    β”‚Β Β  β”‚Β Β  └── routes
    β”‚Β Β  β”‚Β Β      β”œβ”€β”€ index.js
    β”‚Β Β  β”‚Β Β      β”œβ”€β”€ my
    β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ favoritePOST.js
    β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ index.js
    β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ recommendGET.js
    β”‚Β Β  β”‚Β Β      β”‚Β Β  └── rentGET.js
    β”‚Β Β  β”‚Β Β      └── reserve
    β”‚Β Β  β”‚Β Β          β”œβ”€β”€ index.js
    β”‚Β Β  β”‚Β Β          └── reserveGET.js
    β”‚Β Β  β”œβ”€β”€ config
    β”‚Β Β  β”‚Β Β  └── dbConfig.js
    β”‚Β Β  β”œβ”€β”€ constants
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ responseMessage.js
    β”‚Β Β  β”‚Β Β  └── statusCode.js
    β”‚Β Β  β”œβ”€β”€ db
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ db.js
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ index.js
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ my.js
    β”‚Β Β  β”‚Β Β  └── reserve.js
    β”‚Β Β  β”œβ”€β”€ index.js
    β”‚Β Β  β”œβ”€β”€ lib
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ convertDate.js
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ convertSnakeToCamel.js
    β”‚Β Β  β”‚Β Β  └── util.js
    β”‚Β Β  └── package.json
    β”œβ”€β”€ package-lock.json
    └── package.json

git μ „λž΅

image


API Docs

Base URL: https://asia-northeast3-socar-server-814e9.cloudfunctions.net/api

`GET` [μ°¨λŸ‰ ν”Œλžœ] λ‚˜μ˜ μ˜ˆμ•½

path: /my/rent

REQUEST HEADER

{
	userId: int
}

EX)
{
	userId: 3
}

RESPONSE BODY

{
    "status": 200,
    "success": true,
    "message": "λ‚˜μ˜ μ˜ˆμ•½ 쑰회 성곡",
    "data": [
        {
            "date": "02 sat",
            "location": "μ‹ λΌμŠ€ν…Œμ΄ μ‚Όμ„±",
            "address": "μ„œμšΈνŠΉλ³„μ‹œ 강남ꡬ μ˜λ™λŒ€λ‘œ 506"
        },
        {
            "date": "12 tue",
            "location": "μ‹ λ¦Όν˜„λŒ€μ•„νŒŒνŠΈ μ£Όμ°¨μž₯",
            "address": "μ„œμšΈνŠΉλ³„μ‹œ 관악ꡬ μ‹ λ¦Όλ‘œ 29κΈΈ 8"
        },
        {
            "date": "21 thu",
            "location": "μ‹ λ¦Ό 포도λͺ° μ£Όμ°¨μž₯",
            "address": "μ„œμšΈνŠΉλ³„μ‹œ 관악ꡬ μ‹ λ¦Όλ‘œ 330"
        }
    ]
}
`GET` [μ°¨λŸ‰ ν”Œλžœ] μΆ”μ²œ μ°¨λŸ‰

path: /my/recommend

REQUEST HEADER

{
	userId: int,
}

EX)
{
	userId: 4,
}

RESPONSE BODY

{
    "status": 200,
    "success": true,
    "message": "μΆ”μ²œ μ°¨λŸ‰ 쑰회 성곡",
    "data": [
        {
            "carName": "νˆ¬μ‹Ό(경유)",
            "priceUnit": "μ›”",
            "price": 503000,
            "discountRate": 26,
            "imageUrl": "https://firebasestorage.googleapis.com/v0/b/socar-server-814e9.appspot.com/o/car%2Ftosan.png?alt=media"
        },
        {
            "carName": "μΉ΄λ‹ˆλ°œ 11인승",
            "priceUnit": "μ›”",
            "price": 653000,
            "discountRate": 16,
            "imageUrl": "https://firebasestorage.googleapis.com/v0/b/socar-server-814e9.appspot.com/o/car%2Fcarnival11.png?alt=media"
        },
        {
            "carName": "μ˜¬λ‰΄λͺ¨λ‹",
            "priceUnit": "μ›”",
            "price": 454000,
            "discountRate": 15,
            "imageUrl": "https://firebasestorage.googleapis.com/v0/b/socar-server-814e9.appspot.com/o/car%2Fallnewmorning.png?alt=media"
        },
        {
            "carName": "λ”λ‰΄μ•„λ°˜λ–Ό",
            "priceUnit": "μ›”",
            "price": 385000,
            "discountRate": 37,
            "imageUrl": "https://firebasestorage.googleapis.com/v0/b/socar-server-814e9.appspot.com/o/car%2Fthenewavante.png?alt=media"
        }
    ]
}
`GET` [μ°¨λŸ‰ μ˜ˆμ•½] μ°¨λŸ‰ ν•„ν„° 리슀트
  • 쿼리 λ³΄λ‚΄λŠ” ν˜•μ‹ (ν•„ν„°κ°€ μ•ˆ κ±Έλ €μžˆλŠ” 쿼리 값은 보내지 μ•ŠμœΌμ…”λ„ λ©λ‹ˆλ‹€.)
/reserve?start=20211113&end=20211115&type=μ€€μ€‘ν˜•&location=μ„œμšΈ/κ²½κΈ°/인천&price=desc&trend=true
  • μ˜ˆμ‹œ
/reserve?start=202111118&end=20211128&type=μ€€μ€‘ν˜•&location=μ„œμšΈ/κ²½κΈ°/인천&price=desc

REQUEST HEADER

REQUEST HEADER
{
	userId: int,
}

RESPONSE BODY

  • 쑰회 성곡
{
    "status": 200,
    "success": true,
    "message": "μ˜ˆμ•½ κ°€λŠ₯ν•œ μ°¨λŸ‰ 리슀트 쑰회 성곡",
    "data": [
        {
            "carId": 2,
            "carName": "λ”λ‰΄μ•„λ°˜λ–Ό",
            "modelYear": "2018λ…„~2019λ…„",
            "priceUnit": "μ›”",
            "price": 385000,
            "discountRate": 37,
            "currentLocation": "μ‹ λ¦Ό 포도λͺ° μ£Όμ°¨μž₯",
            "imageUrl": "https://firebasestorage.googleapis.com/v0/b/socar-server-814e9.appspot.com/o/car%2Fthenewavante.png?alt=media",
            "isLiked": false
        },
        {
            "carId": 1,
            "carName": "νˆ¬μ‹Ό(경유)",
            "modelYear": "2016λ…„~2017λ…„",
            "priceUnit": "μ›”",
            "price": 503000,
            "discountRate": 26,
            "currentLocation": "μ‹ λ¦Όν˜„λŒ€μ•„νŒŒνŠΈ μ£Όμ°¨μž₯",
            "imageUrl": "https://firebasestorage.googleapis.com/v0/b/socar-server-814e9.appspot.com/o/car%2Ftosan.png?alt=media",
            "isLiked": false
        },
        {
            "carId": 5,
            "carName": "μ˜¬λ‰΄K3",
            "modelYear": "2018λ…„~2019λ…„",
            "priceUnit": "μ›”",
            "price": 542000,
            "discountRate": 16,
            "currentLocation": "μ‹ λ¦Όν˜„λŒ€μ•„νŒŒνŠΈ μ£Όμ°¨μž₯",
            "imageUrl": "https://firebasestorage.googleapis.com/v0/b/socar-server-814e9.appspot.com/o/car%2Fallnewk3.png?alt=media",
            "isLiked": false
        },
        {
            "carId": 4,
            "carName": "μ½”λ‚˜",
            "modelYear": "2018λ…„~2019λ…„",
            "priceUnit": "μ›”",
            "price": 579000,
            "discountRate": 14,
            "currentLocation": "μ‹ λΌμŠ€ν…Œμ΄ μ‚Όμ„±",
            "imageUrl": "https://firebasestorage.googleapis.com/v0/b/socar-server-814e9.appspot.com/o/car%2Fcona.png?alt=media",
            "isLiked": false
        }
    ]
}
  • start와 end λ‘˜ 쀑 ν•˜λ‚˜λ§Œ μž‘μ„±ν•œ 경우 / userId μ—†λŠ” 경우
{
    "status": 400,
    "success": false,
    "message": "ν•„μš”ν•œ 값이 μ—†μŠ΅λ‹ˆλ‹€"
}
`PUT` [μ°¨λŸ‰ μ˜ˆμ•½] ν•˜νŠΈ λ²„νŠΌ 클릭

path: /my/favorite

REQUEST BODY

{
	userId: int,
	carId: int,
	isLiked: boolean,
}

EX)
{
    "userId": 1,
    "carId": 2,
    "isLiked": false
}

RESPONSE BODY

{
    "status": 200,
    "success": true,
    "message": "μ’‹μ•„μš” μƒνƒœ λ³€κ²½ 성곡",
    "data": {
        "carId": 2,
        "isLiked": false
    }
}

ERD

image

About

πŸš— μ˜μΉ΄μ•„μ•„μ•„μ•…ν‰· πŸš™

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published