support for FE
This commit is contained in:
@@ -4,8 +4,8 @@ import "gorm.io/gorm"
|
||||
|
||||
type AddonFile struct {
|
||||
gorm.Model
|
||||
Path string `json:"path"`
|
||||
Hash string `json:"hash" gorm:"index"`
|
||||
AddonID string `json:"addonid" gorm:"index"`
|
||||
Version string `json:"version"`
|
||||
Path string `json:"path"`
|
||||
Hash string `json:"hash" gorm:"index:idx_hash_addon,priority:1;index"`
|
||||
AddonID string `json:"addonid" gorm:"index:idx_hash_addon,priority:2;index"`
|
||||
Version string `json:"version"`
|
||||
}
|
||||
|
||||
61
models/apiModels.go
Normal file
61
models/apiModels.go
Normal file
@@ -0,0 +1,61 @@
|
||||
package models
|
||||
|
||||
// SimplifiedAddon contains only essential addon information for API responses
|
||||
type SimplifiedAddon struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Summary string `json:"summary"`
|
||||
SubscriberCount int `json:"subscriberCount"`
|
||||
CurrentVersionNumber string `json:"currentVersionNumber"`
|
||||
Preview string `json:"preview"`
|
||||
Author string `json:"author"`
|
||||
AddonFiles []SimplifiedAddonFile `json:"addonFiles"`
|
||||
}
|
||||
|
||||
// SimplifiedAddonFile contains only essential addon file information for API responses
|
||||
type SimplifiedAddonFile struct {
|
||||
Path string `json:"path"`
|
||||
Hash string `json:"hash"`
|
||||
Version string `json:"version"`
|
||||
AddonID string `json:"addonId"`
|
||||
}
|
||||
|
||||
// DuplicateFileInfo holds information about a duplicate file
|
||||
type DuplicateFileInfo struct {
|
||||
Path string `json:"path"`
|
||||
Hash string `json:"hash"`
|
||||
Version string `json:"version"`
|
||||
AddonID string `json:"addonId"`
|
||||
}
|
||||
|
||||
// AddonWithDuplicates holds addon information and its duplicate files
|
||||
type AddonWithDuplicates struct {
|
||||
Addon SimplifiedAddon `json:"addon"`
|
||||
Duplicates []DuplicateFileInfo `json:"duplicates"`
|
||||
}
|
||||
|
||||
// DuplicatesResponse is the main response structure
|
||||
type DuplicatesResponse struct {
|
||||
SourceAddon SimplifiedAddon `json:"sourceAddon"`
|
||||
DuplicateAddons map[string]AddonWithDuplicates `json:"duplicateAddons"`
|
||||
}
|
||||
|
||||
// AddonSearchResult contains minimal addon information for search results
|
||||
type AddonSearchResult struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Summary string `json:"summary"`
|
||||
Preview string `json:"preview"`
|
||||
SubscriberCount int `json:"subscriberCount"`
|
||||
CurrentVersionNumber string `json:"currentVersionNumber"`
|
||||
Author string `json:"author"`
|
||||
}
|
||||
|
||||
// SearchResponse contains the search results
|
||||
type SearchResponse struct {
|
||||
Query string `json:"query"`
|
||||
Results []AddonSearchResult `json:"results"`
|
||||
Total int `json:"total"`
|
||||
}
|
||||
Reference in New Issue
Block a user