Contracts for buyer

This commit is contained in:
Nedim
2023-10-03 18:26:57 +02:00
parent 7df0c64d15
commit 2cfac4a023
9 changed files with 283 additions and 70 deletions

View File

@@ -21,10 +21,44 @@ type Contract struct {
Status string
BlockchainID string
ContractInfos []ContractInfo
BuyerName string `gorm:"-"`
NumberOfDevices int `gorm:"-"`
}
const ContractStatusActive = "active"
const ContractStatusPending = "pending"
const ContractStatusDraft = "draft"
const ContractStatusSigned = "signed"
const ContractStatusReadyForActivation = "ready_for_activation"
const ContractStatusExecuted = "executed"
const ContractStatusRevoked = "revoked"
type Status struct {
Key string `json:"key"`
Value string `json:"value"`
}
func GetContractStatuses() []Status {
return []Status{
{Key: "Active", Value: "active"},
{Key: "Pending signature", Value: "pending"},
{Key: "Draft", Value: "draft"},
{Key: "Signed", Value: "signed"},
{Key: "Ready for Activation", Value: "ready_for_activation"},
{Key: "Executed", Value: "executed"},
{Key: "Revoked", Value: "revoked"},
}
}
type ListContractResponse struct {
Status KeyValue `json:"Status"`
Buyer CompanyShortResponse `json:"Buyer"`
ContractID int
NumberOfDevices int
DateCreated time.Time
}
func (Contract) Update() (bool, error) {
return false, nil