Promotions API - ahoo-studio/queq-doc GitHub Wiki

2. Promotion

[x] 2.1 Get Promotion list

GET /api/v2/promotion/list

Description:

ดึงข้อมูลรายการโปรโมชั่นแบบเป็นกลุ่มที่มีสถานะ Active

Returns:

{
    "data": {
        "promotion": [
            {
                "_id": "5c4ed9fa4ffb940f167a1416",
                "created_at": "2019-01-28T10:31:22Z",
                "filenameImage1": "5c5a60b8ab78f.png",
                "filenameImage2": "5c666a1558342.jpg",
                "isHighlight": true,
                "isNearBy": true,
                "isReachDateTime": false,
                "location": {
                    "coordinates": [
                        100.54061250272,
                        13.745278364543
                    ],
                    "type": "Point"
                },
                "mainTypes": [
                    "Shopping"
                ],
                "mallFloor": {
                    "_id": "5bbdde075ae58727a4006313",
                    "created_at": "2018-10-08T11:01:46Z",
                    "mallFloorDetail": {
                        "chi1": "Gaysorn Village, Floor G",
                        "chi2": "Gaysorn Village, Floor G",
                        "eng": "Gaysorn Village, Floor G",
                        "thai": "ศูนย์การค้าเกษร ชั้น G"
                    },
                    "mallFloorName": {
                        "chi1": "Gaysorn Village, Floor G",
                        "chi2": "Gaysorn Village, Floor G",
                        "eng": "Gaysorn Village, Floor G",
                        "thai": "ศูนย์การค้าเกษร ชั้น G"
                    },
                    "mallId": "5bcf5fb7fe135920500046f2",
                    "mapIndoorFloorData": "2",
                    "mapIndoorFloorKey": "Gaysorn Village, Floor G",
                    "updated_at": "2019-06-25T06:53:43Z"
                },
                "newsActive": true,
                "newsDetail": {
                    "chi1": "",
                    "chi2": "",
                    "eng": "Sale up to 40%",
                    "thai": "Sale สูงสุด 40%"
                },
                "newsName": {
                    "chi1": "Sale!!",
                    "chi2": "Sale!!",
                    "eng": "Sale!!",
                    "thai": "Sale!!"
                },
                "newsType": {
                    "_id": "5b8dd237aaea3c3fa4560211",
                    "created_at": "2018-09-04T00:30:47.736Z",
                    "newsTypeDetail": {
                        "chi1": "Promotion",
                        "chi2": "Promotion",
                        "eng": "Promotion",
                        "thai": "Promotion"
                    },
                    "newsTypeName": {
                        "chi1": "Promotion",
                        "chi2": "Promotion",
                        "eng": "Promotion",
                        "thai": "Promotion"
                    },
                    "order": 1,
                    "updated_at": "2019-01-21T07:25:54Z"
                },
                "order": 1,
                "shop": {
                    "_id": "5bece6449dc6d6a8ac636273",
                    "address": {
                        "chi1": null,
                        "chi2": null,
                        "eng": "Floor. G,  999 Phloen Chit Rd, Khwaeng Lumphini, Khet Pathum Wan, Krung Thep Maha Nakhon 10330",
                        "thai": "ชั้น G, 999 ถนนเพลินจิต แขวงลุมพินี เขตปทุมวัน กรุงเทพมหานคร 10330"
                    },
                    "created_at": "2018-11-15T03:21:40Z",
                    "filenameLogo1": "5c62953713e8b.jpg",
                    "isActive": true,
                    "isPromotionAvailable": true,
                    "isSponser": false,
                    "location": {
                        "coordinates": [
                            100.54061250272,
                            13.745278364543
                        ],
                        "type": "Point"
                    },
                    "mainTypes": [
                        "Shopping"
                    ],
                    "mallFloorId": "5bbdde075ae58727a4006313",
                    "mapReach": 5,
                    "monsterRating": 0,
                    "order": 0,
                    "shopAssertId": "5bea3c459dc6d68fae4af002",
                    "shopCategoryId": [
                        "5bdbc30e9dc6d63c0d1cdb92"
                    ],
                    "shopDetail": {
                        "chi1": "",
                        "chi2": "",
                        "eng": "Bags and Accessories Shop",
                        "thai": "ร้านกระเป๋าและเครื่องประดับ"
                    },
                    "shopName": {
                        "chi1": "Furla",
                        "chi2": "Furla",
                        "eng": "Furla",
                        "thai": "Furla"
                    },
                    "shopTel": "02 656 1113",
                    "shopUrl": "Website Furla,https://www.facebook.com/FurlaThailand/",
                    "updated_at": "2019-06-11T09:31:41Z",
                    "workingTime": {
                        "chi1": null,
                        "chi2": null,
                        "eng": "Open Everyday 10.00 AM - 8.00 PM",
                        "thai": "ทุกวันจันทร์ - อาทิตย์ เวลา 10.00 - 20.00 น."
                    }
                },
                "shopId": "5bece6449dc6d6a8ac636273",
                "updated_at": "2019-07-02T03:50:16Z",
                "wildItemId": "5bf52c5c9dc6d625cb4204d2"
         }],
        "pageIndex": -1,
        "pageLimit": -1,
        "pages": 1,
        "paging": {
            "next": "",
            "previous": ""
        }
    },
    "isSuccess": true
}

Data Dictionary Promotion:

Field Type Description Default
_id ObjectId id ของรายการห้างนั้น Auto Create
created_at Datetime วันที่บันทึกข้อมูล Auto Create
filenameLogo1 String รูปภาพของห้างรูปที่ 1 จากการอัพโหลด path https://{domain}/media/images/{filenameLogo1} และ https://{domain}/media/thumbnail/{filenameLogo1}
isHighlight Int ระยะภายในใกล้ที่สุดจากความสนใจ
isNearBy Int ชั้นเริ่มต้นของห้าง 0
isActive Boolean สถานะการแสดงข้อมูล false
isReachDateTime Boolean ใช้คำณวนวันหมดอายุ ถ้าเป็นจริง ส่วนเป็น False ถือว่าไม่หมดอายุ เมื่อดึงข้อมูล false
location Location ข้อมูลพิกัดที่ตั้งของห้าง false
mainTypes Oฺbject ค่า mainTypes
newsActive ฺBoolean สถานะการแสดงข้อมูล
newsDetail Object แบ่งเป็น 4 ภาษา "newsDetail": {"eng":"","thai":"","chi1":"","chi2":""}
newsName Object ชื่อของห้าง แบ่งเป็น 4 ภาษา "newsName": {"eng":"","thai":"","chi1":"","chi2":""}
newsType Object ชนิดข่าว
order Int ลำดับการแสดงข้อมูล
shop Object รายละเอียดร้านค้า
shopId String Id ร้านค้า
updated_at Datetime วันที่แก้ไขข้อมูล Auto Update
wildItemId String Id ไอเท็มป่า

Data Dictionary Mall Floor:

Field Type Description Default
_id ObjectId id ของรายการชั้นในห้างนั้น Auto Create
created_at Datetime วันที่บันทึกข้อมูล Auto Create
mallFloorDetail รายละเอียด แบ่งเป็น 4 ภาษา "mallFloorDetail": {"eng":"","thai":"","chi1":"","chi2":""}
mallFloorName ชื่อชั้นของห้าง แบ่งเป็น 4 ภาษา "mallFloorName": {"eng":"","thai":"","chi1":"","chi2":""}
mallId ไอดีของห้างที่ชั้นนั้นอยู่
mapIndoorFloorData ค่า mapIndoorFloorData
mapIndoorFloorKey ค่า mapIndoorFloorKey
updated_at Datetime วันที่แก้ไขข้อมูล Auto Update

Data Dictionary Shop:

Field Type Description Default
_id ObjectId id ของรายการชั้นในห้างนั้น Auto Create
created_at Datetime วันที่บันทึกข้อมูล Auto Create
filenameLogo1 String รูปภาพของห้างรูปที่ 1 จากการอัพโหลด path https://{domain}/media/images/{filenameLogo1} และ https://{domain}/media/thumbnail/{filenameLogo1}
isActive Boolean สถานะการแสดงข้อมูล false
isPromotionAvailable Boolean สถานะของร้านที่มีโปรโมชั่น false
isSponser Boolean ร้านที่ได้รับการสนับสนุน false
location Location ข้อมูลพิกัดที่ตั้งของร้าน false
mainTypes array String ค่า MainType
mallFloorId ObjectId id ของรายการชั้นในห้างนั้น Auto
mapReach Int ค่า mapReach
monsterRating Int เรทติ้งที่มีมอนเตอร์เข้ามาในร้าน
order Int ลำดับในการเรียง
shopAssertId ObjectId id ของ shopAssert
shopCategoryId Array ObjectId id ของ shopCategory
shopDetail Object รายละเอียดร้านค้า "shopDetail": {"eng":"","thai":"","chi1":"","chi2":""}
shopName ObjectId ชื่อของร้านค้า "shopName": {"eng":"","thai":"","chi1":"","chi2":""}
shopTel String เบอร์โทรร้าน
shopUrl ObjectId เว็บไซต์ร้าน
updated_at Datetime วันที่แก้ไขข้อมูล Auto Update
workingTime Object เวลาเปิดทำการ

Data Dictionary Location:

Field Type Description Default
coordinates ค่า coordinates ค่าแรกเป็น Longitude และค่าสุดท้ายเป็น Lattitude มี Type เป็น Point เสมอ

[x] 2.2 Get Promotion Detail

GET /api/v2/Promotion/{id : string}

Description:

ดึงรายละเอียดของห้างนั้นโดยใช้ id

Url parameters:

Field Description Optional Default Auth
id id ของ Promotion No 0 Yes

Returns:

{
    "data": {
        "_id": "5c4ed9fa4ffb940f167a1416",
        "created_at": "2019-01-28T10:31:22Z",
        "filenameImage1": "5c5a60b8ab78f.png",
        "filenameImage2": "5c666a1558342.jpg",
        "isHighlight": true,
        "isNearBy": true,
        "isReachDateTime": false,
        "location": {
            "coordinates": [
                100.54061250272,
                13.745278364543
            ],
            "type": "Point"
        },
        "mainTypes": [
            "Shopping"
        ],
        "newsActive": true,
        "newsDetail": {
            "chi1": "",
            "chi2": "",
            "eng": "Sale up to 40%",
            "thai": "Sale สูงสุด 40%"
        },
        "newsName": {
            "chi1": "Sale!!",
            "chi2": "Sale!!",
            "eng": "Sale!!",
            "thai": "Sale!!"
        },
        "newsType": "5b8dd237aaea3c3fa4560211",
        "order": 1,
        "shopId": "5bece6449dc6d6a8ac636273",
        "updated_at": "2019-07-02T03:50:16Z",
        "wildItemId": "5bf52c5c9dc6d625cb4204d2"
    },
    "isSuccess": true
}

Data Dictionary Promotion:

ข้อมูลแบบเดียวกับข้อ 2.1

2.3 Get Promotion list by location

GET /api/v2/promotion/byLocation?lat={lat}&long={long}

Description:

ดึงข้อมูลโปรโมชั่นโดยใช้พิกัดละติจูดลองจิจูด

Url parameters:

Field Description Optional Default Auth
page หน้าปัจจุบัน Yes 0 Yes
limit จำนวนแสดงผลต่อหน้า Yes 10 Yes
lat ค่าละติจูด No No
long ค่าลองจิจูด No No
min ระยะที่ไกล้ที่สุด yes No
max ระยะทางที่ไกลที่สุเ yes No

Returns:

{
    "data": {
        "pageIndex": -1,
        "pageLimit": 1,
        "pages": 100,
        "paging": {
            "next": "api/v2/promotion/byLocation/?lat=13.7466304&long=100.5371464?page=1&limit=1",
            "previous": ""
        },
        "promotion": [
            {
                "_id": "5d3196744ffb94efe12a9764",
                "created_at": "2019-07-19T10:07:48Z",
                "dist": {
                    "calculated": 142.50627972427642
                },
                "filenameImage1": "5d319674bc360.png",
                "filenameImage2": "5d319674d1385.png",
                "isHighlight": true,
                "isNearBy": true,
                "isReachDateTime": false,
                "location": {
                    "coordinates": [
                        100.53836175703,
                        13.747125511578
                    ],
                    "type": "Point"
                },
                "mainTypes": [
                    "Shopping"
                ],
                "newsActive": true,
                "newsDetail": {
                    "chi1": "",
                    "chi2": "",
                    "eng": "Special Price 50% off",
                    "thai": "ราคาพิเศษลด 50%"
                },
                "newsName": {
                    "chi1": "",
                    "chi2": "",
                    "eng": "Special Price!!",
                    "thai": "ราคาพิเศษ!!"
                },
                "newsType": "5b8dd237aaea3c3fa4560211",
                "order": 1,
                "shopId": "5be50d829dc6d67148414eaf",
                "updated_at": "2019-07-19T10:07:48Z"
            }
        ]
    },
    "isSuccess": true
}

Data Dictionary Promotion:

ข้อมูลแบบเดียวกับข้อ 2.1