dbmodel

package
v0.0.2-0...-18890bd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const IPFSRootURL = "https://ipfs.io/ipfs"

Variables

This section is empty.

Functions

func ThumbnailURL

func ThumbnailURL(src DigitalAssetSrc) string

Types

type Alert

type Alert struct {
	gorm.Model

	Source   DigitalAssetSrc `gorm:"foreignKey:SourceID"`
	SourceID uint

	OtherSource   DigitalAssetSrc `gorm:"foreignKey:OtherSourceID"`
	OtherSourceID uint

	Status  string `sql:"type:text;"`
	Message string `sql:"type:text;"`
}

Alert data dbmodel

type Asset

type Asset struct {
	gorm.Model

	// The asset template metadata
	Metadata         string `sql:"type:text;"`
	MD5HashMetadata  string `sql:"type:text;"`
	IPFSHashMetadata string `sql:"type:text;"`

	// An external metadata URL, ex. https://metadata.mintable.app/ao1YMdMJWwF39585fg9C/52
	ExternalMetadataURL string `sql:"type:text;"`

	// An external asset ID for a sequencing ex. 52
	ExternalAssetId int

	// The number of copies when multiple copies of a piece of artwork are produced - e.g. for a limited edition of 20 prints, 'artEdition' refers to the total number of copies (in this example "20").
	EditionTotal int

	// The edition number in the edition total
	EditionNumber int

	// Friendly name (must be short)
	Name string `sql:"type:text;"`

	// Certificate label
	CertificateLabel string `sql:"type:text;"`

	// Asset label (max size : 32)
	AssetLabel string `sql:"type:text;"`

	// Arbitrary data to be stored in the transaction
	Note string `sql:"type:text;"` //

	AssetTemplateID uint
}

Asset data dbmodel (ex. a limited edition copy 1/15)

type AssetTemplate

type AssetTemplate struct {
	gorm.Model

	// The asset template metadata
	Metadata string `sql:"type:text;"`

	// An external metadata URL, ex. https://metadata.mintable.app/ao1YMdMJWwF39585fg9C/52
	ExternalMetadataURL string `sql:"type:text;"`

	// An external asset ID for a sequencing ex. 52
	ExternalAssetId int

	// The number of copies when multiple copies of a piece of artwork are produced - e.g. for a limited edition of 20 prints, 'artEdition' refers to the total number of copies (in this example "20").
	EditionTotal int

	// Friendly name (must be short)
	Name string `sql:"type:text;"`

	// Certificate label
	CertificateLabel string `sql:"type:text;"`

	// Asset label (max size : 32, auto truncated)
	AssetLabel string `sql:"type:text;"`

	// Arbitrary data to be stored in the transaction
	Note string `sql:"type:text;"` //

	// Additional properties
	AssetProperties string `sql:"type:text;"` //

	// digital asset source
	Source   DigitalAssetSrc `gorm:"foreignKey:SourceID"`
	SourceID uint

	// assets from template
	Assets []Asset `gorm:"foreignKey:AssetTemplateID"`

	// uuid for preview
	ObjectUUID string `gorm:"type:char(36);index"`
}

AssetTemplate data dbmodel (ex. a limited edition copy 1/15)

type Certificate

type Certificate struct {
	gorm.Model

	// short text at center of certificate
	CertificateLabel string `sql:"type:text;"`

	// the user issuing the certificate
	Issuer   User `gorm:"foreignKey:IssuerID"`
	IssuerID uint

	// the user printing the certificate (also responsible to send proofs to the primary & secondary conservator)
	Printer   User `gorm:"foreignKey:PrinterID"`
	PrinterID uint

	// the primary conservator (normally : UNCOPIED)
	PrimaryConservator   User `gorm:"foreignKey:PrimaryConservatorID"`
	PrimaryConservatorID uint

	// the secondary conservator (ex. a trusted physical and digital archiver)
	SecondaryConservator   User `gorm:"foreignKey:SecondaryConservatorID"`
	SecondaryConservatorID uint

	// where the document is stored immutably
	ImmutableDocumentPrimaryURL   string `sql:"type:text;"` // stable URL to immutable PDF document
	ImmutableDocumentSecondaryURL string `sql:"type:text;"` // stable URL to immutable PDF document backup
	ImmutableDocumentHash         string `sql:"type:text;"` // "friendly name" of asset

	// blockchain IDs
	CertificateSecondaryScheme string `sql:"type:text;"` // the certificate's secondary system ex. Algorand blockchain
	CertificateSecondaryID     string `sql:"type:text;"` // the certificate's ID in secondary system ex. Algorand blockchain assetId
	CertificateSecondaryURL    string `sql:"type:text;"` // link to the certificate in secondary system ex. stable link to blockchain explorer

	// role tokens : qrcodes split
	IssuerToken                    CertificateToken `gorm:"foreignKey:IssuerTokenID"`
	IssuerTokenID                  uint
	OwnerToken                     CertificateToken `gorm:"foreignKey:OwnerTokenID"`
	OwnerTokenID                   uint
	PrimaryAssetVerifierToken      CertificateToken `gorm:"foreignKey:PrimaryAssetVerifierTokenID"`
	PrimaryAssetVerifierTokenID    uint
	SecondaryAssetVerifierToken    CertificateToken `gorm:"foreignKey:SecondaryAssetVerifierTokenID"`
	SecondaryAssetVerifierTokenID  uint
	PrimaryOwnerVerifierToken      CertificateToken `gorm:"foreignKey:PrimaryOwnerVerifierTokenID"`
	PrimaryOwnerVerifierTokenID    uint
	SecondaryOwnerVerifierToken    CertificateToken `gorm:"foreignKey:SecondaryOwnerVerifierTokenID"`
	SecondaryOwnerVerifierTokenID  uint
	PrimaryIssuerVerifierToken     CertificateToken `gorm:"foreignKey:PrimaryIssuerVerifierTokenID"`
	PrimaryIssuerVerifierTokenID   uint
	SecondaryIssuerVerifierToken   CertificateToken `gorm:"foreignKey:SecondaryIssuerVerifierTokenID"`
	SecondaryIssuerVerifierTokenID uint
}

Certificate data dbmodel

type CertificateIssuance

type CertificateIssuance struct {
	gorm.Model

	Asset   Asset `gorm:"foreignKey:AssetID"`
	AssetID uint

	Order   Order `gorm:"foreignKey:OrderID"`
	OrderID uint

	Certificate   Certificate `gorm:"foreignKey:CertificateID"`
	CertificateID uint

	AlgorandTransactionID string `sql:"type:text;"`
}

CertificateIssuance dbmodel

type CertificateToken

type CertificateToken struct {
	gorm.Model

	CertificateID uint

	Role      string `sql:"type:text;"` // role, ex. Issuer, Owner, etc.
	Token     string `sql:"type:text;"` // token
	TokenHash string `sql:"type:text;"` // token hash
}

Certificate data dbmodel

type DigitalAssetSrc

type DigitalAssetSrc struct {
	gorm.Model

	Issuer   User `gorm:"foreignKey:IssuerID"`
	IssuerID uint

	IssuerClaimsAuthorship bool   // if asset was uploaded on behalf of author
	AuthorName             string `sql:"type:text;"` // "friendly name" of author
	AuthorProfileURL       string `sql:"type:text;"` // public profile of author, ex. Wikipedia
	SourceLicense          string `sql:"type:text;"` // license terms friendly name
	SourceLicenseURL       string `sql:"type:text;"` // source file license terms
	IsProxy                bool   // the asset is a proxy

	// the Issuer will have several options to 'upload' the asset file
	IPFSUploader string `sql:"type:text;"`
	IPFSFilename string `sql:"type:text;"`
	IPFSHash     string `gorm:"type:varchar(255);index"`
	IPFSMimetype string `sql:"type:text;"`

	// asset thumbnail
	IPFSHashThumbnail string `sql:"type:text;"`

	// once the digital asset is validated, stamp it with a MD5 checksum
	Stamp      string `gorm:"type:char(32);index"`
	StampError string `sql:"type:text;"`

	ExternalSourceID string `sql:"type:text;"`

	// hashes for similarity indexing
	AverageHash    uint64 `gorm:"type:numeric;"`
	DifferenceHash uint64 `gorm:"type:numeric;"`
	PerceptionHash uint64 `gorm:"type:numeric;"`
}

DigitalAssetSrc data dbmodel (ex. a raw image)

type Order

type Order struct {
	gorm.Model

	// the order UUID
	OrderUUID string `gorm:"type:char(36);index"`

	// asset template
	AssetTemplate   AssetTemplate `gorm:"foreignKey:AssetTemplateID"`
	AssetTemplateID uint

	// payment/invoice status
	PaymentStatus string
	InvoiceURL    string

	// delivery status
	DeliveryStatus string

	// production status : file delivery
	ZipBundle         string
	ProductionStatus  string
	ProductionMessage string

	// is do it yourself?
	IsDIY bool

	// Paypal Details
	PaypalDetails string `sql:"type:text;"`

	// quality check status
	QualityStatus string
	Quality       int
}

Order fulfillment dbmodel

type User

type User struct {
	gorm.Model
	UserName     string
	DisplayName  string
	EmailAddress string
	PasswordHash string
	// blockchain specifics
	EthereumAddress string
	UserRole        string
}

User data dbmodel

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL