Buy History - up1/soa_group2 GitHub Wiki

Buy History

Buy History เป็น Collection เก็บข้อมูลการซื้อสินค้า

Constaint

  • id : รหัสสินค้าสร้างขึ้นจากการสุ่มขึ่นมาและต้องไม่ซ้ำกัน
  • totalPrice : จำนวนสินค้าต้องไม่เป็นจำนวนติดลบ
  • buyDate, paidDate และ payScheduled : ต้องเป็น Unix Timestamp
  • category : ต้องเก็บประเภทสินค้าและประเภทสินค้าที่เป็น Parent
  • buyDate, paidDate และ payScheduled : เก็็บข้อมูลแบบ Long
  • payScheduled นั้นจะเป็นเวลานับจากbuyDateไป7วัน

Schema

{
    "id" : "รหัสการสั่งซื้อ",
    "buyer" : "ชื่อผู้ซื้อ",
    "totalPrice" : "ราคารวม",
    "buyDate" : "เวลาที่สั่งซื้อ",
    "paidDate" : "เวลาที่จ่ายเงิน",
    "payScheduled" : "กำหนดการจ่ายเงิน",
    "buyProducts" : "รายการสินค้าที่สั่งซื้อ",
    "deliveryAddress" : "สถานที่จัดส่ง",
    "payStatus" : "สถานะของรหัสการสั่งซื้อ(จ่ายเงินแล้ว,ยังไม่จ่ายเงิน)",
    "tel" : "เบอร์โทรศัพท์ของผู้สั่งซื้อ",
    "email" : "emailของผู้สั่งซื้อ"
}

Java Model

public class BuyHistory {

    private String id;
    private String buyer;
    private Integer totalPrice;
    private Long buyDate;
    private Long paidDate;
    private Long payScheduled;
    private ArrayList<Product> buyProducts;
    private String deliveryAddress;
    private Integer payStatus;
    private String tel;
    private String email;

Example

{
    "id" : "1",
    "buyer" : "supphawit",
    "totalPrice" : "70000",
    "buyDate" : "123213231",
    "paidDate" : "123213231",
    "payScheduled" : "123299631",
    "buyProducts" : [
        {
            "id" : "213",
            "name" : "Iphone 7 Plus 64 GB",
            "detail" : "Lastest Apple's Product. I just use it for 7 days",
            "price" : "30000",
            "amount" : "1",
            "owner" : "kanathips",
            "saleDate" : "123213231",
            "editDate" : "123123123",
            "category" : {"current" : "Smart Phone", "parent" : ["IT"] }
        },
        {
            "id" : "214",
            "name" : "Iphone 8 Plus 128 GB",
            "detail" : "Lastest Apple's Product. I just use it for 7 days",
            "price" : "40000",
            "amount" : "1",
            "owner" : "kanathips",
            "saleDate" : "123213231",
            "editDate" : "123123123",
            "category" : { "current" : "Smart Phone", "parent" : ["IT"] }
        } 
    ],
    "deliveryAddress" : "87 หมู่ 10 ตำบลนครปฐม อำเภอเมือง จังหวัด นครปฐม 73000",
    "payStatus" : 0,
    "tel" : "0832926881",
    "email" : "[email protected]"
}
⚠️ **GitHub.com Fallback** ⚠️