| @@ -33,27 +33,27 @@ const ( | |||||
| // Attachment represent a attachment of issue/comment/release. | // Attachment represent a attachment of issue/comment/release. | ||||
| type Attachment struct { | type Attachment struct { | ||||
| ID int64 `xorm:"pk autoincr" json:"id"` | |||||
| UUID string `xorm:"uuid UNIQUE" json:"uuid"` | |||||
| IssueID int64 `xorm:"INDEX" json:"issueId"` | |||||
| DatasetID int64 `xorm:"INDEX DEFAULT 0" json:"datasetId"` | |||||
| ReleaseID int64 `xorm:"INDEX" json:"releaseId"` | |||||
| UploaderID int64 `xorm:"INDEX DEFAULT 0" json:"uploaderId"` // Notice: will be zero before this column added | |||||
| CommentID int64 `json:"commentId"` | |||||
| Name string `json:"name"` | |||||
| Description string `xorm:"TEXT" json:"description"` | |||||
| DownloadCount int64 `xorm:"DEFAULT 0" json:"downloadCount"` | |||||
| UseNumber int64 `xorm:"DEFAULT 0" json:"useNumber"` | |||||
| Size int64 `xorm:"DEFAULT 0" json:"size"` | |||||
| IsPrivate bool `xorm:"DEFAULT false" json:"isPrivate"` | |||||
| DecompressState int32 `xorm:"DEFAULT 0" json:"decompressState"` | |||||
| Type int `xorm:"DEFAULT 0" json:"type"` | |||||
| CreatedUnix timeutil.TimeStamp `xorm:"created" json:"createdUnix"` | |||||
| FileChunk *FileChunk `xorm:"-" json:"fileChunk"` | |||||
| CanDel bool `xorm:"-" json:"canDel"` | |||||
| Uploader *User `xorm:"-" json:"uploader"` | |||||
| Md5 string `xorm:"-" json:"md5"` | |||||
| ID int64 `xorm:"pk autoincr"` | |||||
| UUID string `xorm:"uuid UNIQUE"` | |||||
| IssueID int64 `xorm:"INDEX"` | |||||
| DatasetID int64 `xorm:"INDEX DEFAULT 0"` | |||||
| ReleaseID int64 `xorm:"INDEX"` | |||||
| UploaderID int64 `xorm:"INDEX DEFAULT 0"` // Notice: will be zero before this column added | |||||
| CommentID int64 | |||||
| Name string | |||||
| Description string `xorm:"TEXT"` | |||||
| DownloadCount int64 `xorm:"DEFAULT 0"` | |||||
| UseNumber int64 `xorm:"DEFAULT 0"` | |||||
| Size int64 `xorm:"DEFAULT 0"` | |||||
| IsPrivate bool `xorm:"DEFAULT false"` | |||||
| DecompressState int32 `xorm:"DEFAULT 0"` | |||||
| Type int `xorm:"DEFAULT 0"` | |||||
| CreatedUnix timeutil.TimeStamp `xorm:"created"` | |||||
| FileChunk *FileChunk `xorm:"-"` | |||||
| CanDel bool `xorm:"-"` | |||||
| Uploader *User `xorm:"-"` | |||||
| Md5 string `xorm:"-"` | |||||
| } | } | ||||
| type AttachmentUsername struct { | type AttachmentUsername struct { | ||||
| @@ -21,26 +21,26 @@ const ( | |||||
| ) | ) | ||||
| type Dataset struct { | type Dataset struct { | ||||
| ID int64 `xorm:"pk autoincr" json:"id"` | |||||
| Title string `xorm:"INDEX NOT NULL" json:"title"` | |||||
| Status int32 `xorm:"INDEX" json:"status"` // normal_private: 0, pulbic: 1, is_delete: 2 | |||||
| Category string `json:"category"` | |||||
| Description string `xorm:"TEXT" json:"description"` | |||||
| DownloadTimes int64 `json:"downloadTimes"` | |||||
| UseCount int64 `xorm:"DEFAULT 0" json:"useCount"` | |||||
| NumStars int `xorm:"INDEX NOT NULL DEFAULT 0" json:"numStars"` | |||||
| Recommend bool `xorm:"INDEX NOT NULL DEFAULT false" json:"recommend"` | |||||
| License string `json:"license"` | |||||
| Task string `json:"task"` | |||||
| ReleaseID int64 `xorm:"INDEX" json:"releaseId"` | |||||
| UserID int64 `xorm:"INDEX" json:"userId"` | |||||
| RepoID int64 `xorm:"INDEX" json:"repoId"` | |||||
| Repo *Repository `xorm:"-" json:"repo"` | |||||
| CreatedUnix timeutil.TimeStamp `xorm:"INDEX created" json:"createdUnix"` | |||||
| UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated" json:"updatedUnix"` | |||||
| User *User `xorm:"-" json:"user"` | |||||
| Attachments []*Attachment `xorm:"-" json:"attachments"` | |||||
| ID int64 `xorm:"pk autoincr"` | |||||
| Title string `xorm:"INDEX NOT NULL""` | |||||
| Status int32 `xorm:"INDEX""` // normal_private: 0, pulbic: 1, is_delete: 2 | |||||
| Category string | |||||
| Description string `xorm:"TEXT"` | |||||
| DownloadTimes int64 | |||||
| UseCount int64 `xorm:"DEFAULT 0"` | |||||
| NumStars int `xorm:"INDEX NOT NULL DEFAULT 0"` | |||||
| Recommend bool `xorm:"INDEX NOT NULL DEFAULT false"` | |||||
| License string | |||||
| Task string | |||||
| ReleaseID int64 `xorm:"INDEX"` | |||||
| UserID int64 `xorm:"INDEX"` | |||||
| RepoID int64 `xorm:"INDEX"` | |||||
| Repo *Repository `xorm:"-"` | |||||
| CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` | |||||
| UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` | |||||
| User *User `xorm:"-"` | |||||
| Attachments []*Attachment `xorm:"-"` | |||||
| } | } | ||||
| type DatasetWithStar struct { | type DatasetWithStar struct { | ||||
| @@ -162,79 +162,79 @@ const ( | |||||
| // Repository represents a git repository. | // Repository represents a git repository. | ||||
| type Repository struct { | type Repository struct { | ||||
| ID int64 `xorm:"pk autoincr" json:"id"` | |||||
| OwnerID int64 `xorm:"UNIQUE(s) index" json:"ownerId"` | |||||
| OwnerName string `json:"ownerName"` | |||||
| Owner *User `xorm:"-" json:"owner"` | |||||
| LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL" json:"lowerName"` | |||||
| Name string `xorm:"INDEX NOT NULL" json:"name"` | |||||
| Description string `xorm:"TEXT" json:"description"` | |||||
| Website string `xorm:"VARCHAR(2048)" json:"website"` | |||||
| OriginalServiceType api.GitServiceType `xorm:"index" json:"originalServiceType"` | |||||
| OriginalURL string `xorm:"VARCHAR(2048)" json:"originalUrl"` | |||||
| DefaultBranch string `json:"defaultBranch"` | |||||
| CreatorID int64 `xorm:"INDEX NOT NULL DEFAULT 0" json:"creatorId"` | |||||
| Creator *User `xorm:"-" json:"creator"` | |||||
| NumWatches int `json:"numWatches"` | |||||
| NumStars int `json:"numStars"` | |||||
| NumForks int `json:"numForks"` | |||||
| NumIssues int `json:"numIssues"` | |||||
| NumClosedIssues int `json:"numClosedIssues"` | |||||
| NumOpenIssues int `xorm:"-" json:"numOpenIssues"` | |||||
| NumPulls int `json:"numPulls"` | |||||
| NumClosedPulls int `json:"numClosedPulls"` | |||||
| NumOpenPulls int `xorm:"-" json:"numOpenPulls"` | |||||
| NumMilestones int `xorm:"NOT NULL DEFAULT 0" json:"numMilestones"` | |||||
| NumClosedMilestones int `xorm:"NOT NULL DEFAULT 0" json:"numClosedMilestones"` | |||||
| NumOpenMilestones int `xorm:"-" json:"numOpenMilestones"` | |||||
| NumCommit int64 `xorm:"NOT NULL DEFAULT 0" json:"numCommit"` | |||||
| RepoType RepoType `xorm:"NOT NULL DEFAULT 0" json:"repoType"` | |||||
| IsPrivate bool `xorm:"INDEX" json:"isPrivate"` | |||||
| IsEmpty bool `xorm:"INDEX" json:"isEmpty"` | |||||
| IsArchived bool `xorm:"INDEX" json:"isArchived"` | |||||
| IsMirror bool `xorm:"INDEX" json:"isMirror"` | |||||
| ID int64 `xorm:"pk autoincr"` | |||||
| OwnerID int64 `xorm:"UNIQUE(s) index"` | |||||
| OwnerName string | |||||
| Owner *User `xorm:"-"` | |||||
| LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"` | |||||
| Name string `xorm:"INDEX NOT NULL"` | |||||
| Description string `xorm:"TEXT"` | |||||
| Website string `xorm:"VARCHAR(2048)"` | |||||
| OriginalServiceType api.GitServiceType `xorm:"index"` | |||||
| OriginalURL string `xorm:"VARCHAR(2048)"` | |||||
| DefaultBranch string | |||||
| CreatorID int64 `xorm:"INDEX NOT NULL DEFAULT 0"` | |||||
| Creator *User `xorm:"-"` | |||||
| NumWatches int | |||||
| NumStars int | |||||
| NumForks int | |||||
| NumIssues int | |||||
| NumClosedIssues int | |||||
| NumOpenIssues int `xorm:"-"` | |||||
| NumPulls int | |||||
| NumClosedPulls int | |||||
| NumOpenPulls int `xorm:"-"` | |||||
| NumMilestones int `xorm:"NOT NULL DEFAULT 0"` | |||||
| NumClosedMilestones int `xorm:"NOT NULL DEFAULT 0"` | |||||
| NumOpenMilestones int `xorm:"-"` | |||||
| NumCommit int64 `xorm:"NOT NULL DEFAULT 0"` | |||||
| RepoType RepoType `xorm:"NOT NULL DEFAULT 0"` | |||||
| IsPrivate bool `xorm:"INDEX"` | |||||
| IsEmpty bool `xorm:"INDEX"` | |||||
| IsArchived bool `xorm:"INDEX"` | |||||
| IsMirror bool `xorm:"INDEX"` | |||||
| *Mirror `xorm:"-"` | *Mirror `xorm:"-"` | ||||
| Status RepositoryStatus `xorm:"NOT NULL DEFAULT 0" json:"status"` | |||||
| Status RepositoryStatus `xorm:"NOT NULL DEFAULT 0"` | |||||
| RenderingMetas map[string]string `xorm:"-"` | RenderingMetas map[string]string `xorm:"-"` | ||||
| Units []*RepoUnit `xorm:"-" json:"units"` | |||||
| PrimaryLanguage *LanguageStat `xorm:"-" json:"primaryLanguage"` | |||||
| IsFork bool `xorm:"INDEX NOT NULL DEFAULT false" json:"isFork"` | |||||
| ForkID int64 `xorm:"INDEX" json:"forkId"` | |||||
| BaseRepo *Repository `xorm:"-" json:"baseRepo"` | |||||
| IsTemplate bool `xorm:"INDEX NOT NULL DEFAULT false" json:"isTemplate"` | |||||
| TemplateID int64 `xorm:"INDEX" json:"templateId"` | |||||
| TemplateRepo *Repository `xorm:"-" json:"templateRepo"` | |||||
| Size int64 `xorm:"NOT NULL DEFAULT 0" json:"size"` | |||||
| CodeIndexerStatus *RepoIndexerStatus `xorm:"-" json:"codeIndexerStatus"` | |||||
| StatsIndexerStatus *RepoIndexerStatus `xorm:"-" json:"statsIndexerStatus"` | |||||
| IsFsckEnabled bool `xorm:"NOT NULL DEFAULT true" json:"isFsckEnabled"` | |||||
| CloseIssuesViaCommitInAnyBranch bool `xorm:"NOT NULL DEFAULT false" json:"closeIssuesViaCommitInAnyBranch"` | |||||
| Topics []string `xorm:"TEXT JSON" json:"topics"` | |||||
| Units []*RepoUnit `xorm:"-"` | |||||
| PrimaryLanguage *LanguageStat `xorm:"-"` | |||||
| IsFork bool `xorm:"INDEX NOT NULL DEFAULT false"` | |||||
| ForkID int64 `xorm:"INDEX"` | |||||
| BaseRepo *Repository `xorm:"-"` | |||||
| IsTemplate bool `xorm:"INDEX NOT NULL DEFAULT false"` | |||||
| TemplateID int64 `xorm:"INDEX"` | |||||
| TemplateRepo *Repository `xorm:"-"` | |||||
| Size int64 `xorm:"NOT NULL DEFAULT 0"` | |||||
| CodeIndexerStatus *RepoIndexerStatus `xorm:"-"` | |||||
| StatsIndexerStatus *RepoIndexerStatus `xorm:"-"` | |||||
| IsFsckEnabled bool `xorm:"NOT NULL DEFAULT true"` | |||||
| CloseIssuesViaCommitInAnyBranch bool `xorm:"NOT NULL DEFAULT false"` | |||||
| Topics []string `xorm:"TEXT JSON"` | |||||
| // Avatar: ID(10-20)-md5(32) - must fit into 64 symbols | // Avatar: ID(10-20)-md5(32) - must fit into 64 symbols | ||||
| Avatar string `xorm:"VARCHAR(64)" json:"avatar"` | |||||
| Avatar string `xorm:"VARCHAR(64)"` | |||||
| //blockchain | //blockchain | ||||
| ContractAddress string `xorm:"INDEX" json:"contractAddress"` | |||||
| Balance string `xorm:"NOT NULL DEFAULT '0'" json:"balance"` | |||||
| BlockChainStatus RepoBlockChainStatus `xorm:"NOT NULL DEFAULT 0" json:"blockChainStatus"` | |||||
| ContractAddress string `xorm:"INDEX"` | |||||
| Balance string `xorm:"NOT NULL DEFAULT '0'"` | |||||
| BlockChainStatus RepoBlockChainStatus `xorm:"NOT NULL DEFAULT 0"` | |||||
| // git clone and git pull total count | // git clone and git pull total count | ||||
| CloneCnt int64 `xorm:"NOT NULL DEFAULT 0" json:"clone_cnt" json:"cloneCnt"` | |||||
| CloneCnt int64 `xorm:"NOT NULL DEFAULT 0" json:"clone_cnt"` | |||||
| // only git clone total count | // only git clone total count | ||||
| GitCloneCnt int64 `xorm:"NOT NULL DEFAULT 0" json:"git_clone_cnt" json:"gitCloneCnt"` | |||||
| GitCloneCnt int64 `xorm:"NOT NULL DEFAULT 0" json:"git_clone_cnt"` | |||||
| CreatedUnix timeutil.TimeStamp `xorm:"INDEX created" json:"createdUnix"` | |||||
| UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated" json:"updatedUnix"` | |||||
| CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` | |||||
| UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` | |||||
| Hot int64 `xorm:"-" json:"hot"` | |||||
| Active int64 `xorm:"-" json:"active"` | |||||
| Alias string `xorm:"INDEX" json:"alias"` | |||||
| LowerAlias string `xorm:"INDEX" json:"lowerAlias"` | |||||
| Hot int64 `xorm:"-"` | |||||
| Active int64 `xorm:"-"` | |||||
| Alias string `xorm:"INDEX"` | |||||
| LowerAlias string `xorm:"INDEX"` | |||||
| } | } | ||||
| type RepositoryShow struct { | type RepositoryShow struct { | ||||
| @@ -6,6 +6,8 @@ package structs // import "code.gitea.io/gitea/modules/structs" | |||||
| import ( | import ( | ||||
| "time" | "time" | ||||
| "code.gitea.io/gitea/modules/timeutil" | |||||
| ) | ) | ||||
| // Attachment a generic attachment | // Attachment a generic attachment | ||||
| @@ -27,3 +29,48 @@ type Attachment struct { | |||||
| type EditAttachmentOptions struct { | type EditAttachmentOptions struct { | ||||
| Name string `json:"name"` | Name string `json:"name"` | ||||
| } | } | ||||
| type Dataset struct { | |||||
| ID int64 `json:"id"` | |||||
| Title string `json:"title"` | |||||
| Status int32 `json:"status"` | |||||
| Category string `json:"category"` | |||||
| Description string `json:"description"` | |||||
| DownloadTimes int64 `json:"downloadTimes"` | |||||
| UseCount int64 `json:"useCount"` | |||||
| NumStars int `json:"numStars"` | |||||
| Recommend bool `json:"recommend"` | |||||
| License string `json:"license"` | |||||
| Task string `json:"task"` | |||||
| ReleaseID int64 `json:"releaseId"` | |||||
| UserID int64 `json:"userId"` | |||||
| RepoID int64 `json:"repoId"` | |||||
| Repo *RepositoryShow `json:"repo"` | |||||
| CreatedUnix timeutil.TimeStamp `json:"createdUnix"` | |||||
| UpdatedUnix timeutil.TimeStamp `json:"updatedUnix"` | |||||
| Attachments []*AttachmentShow `json:"attachments"` | |||||
| } | |||||
| type RepositoryShow struct { | |||||
| OwnerName string `json:"ownerName"` | |||||
| Name string `json:"name"` | |||||
| } | |||||
| type AttachmentShow struct { | |||||
| ID int64 `json:"id"` | |||||
| UUID string `json:"uuid"` | |||||
| DatasetID int64 `json:"datasetId"` | |||||
| ReleaseID int64 `json:"releaseId"` | |||||
| UploaderID int64 `json:"uploaderId"` | |||||
| CommentID int64 `json:"commentId"` | |||||
| Name string `json:"name"` | |||||
| Description string `json:"description"` | |||||
| DownloadCount int64 `json:"downloadCount"` | |||||
| UseNumber int64 `json:"useNumber"` | |||||
| Size int64 `json:"size"` | |||||
| IsPrivate bool `json:"isPrivate"` | |||||
| DecompressState int32 `json:"decompressState"` | |||||
| Type int `json:"type"` | |||||
| CreatedUnix timeutil.TimeStamp `json:"createdUnix"` | |||||
| } | |||||
| @@ -1,5 +1,10 @@ | |||||
| package structs | package structs | ||||
| import ( | |||||
| "code.gitea.io/gitea/models" | |||||
| "code.gitea.io/gitea/modules/timeutil" | |||||
| ) | |||||
| type CreateGrampusTrainJobOption struct { | type CreateGrampusTrainJobOption struct { | ||||
| DisplayJobName string `json:"display_job_name" binding:"Required"` | DisplayJobName string `json:"display_job_name" binding:"Required"` | ||||
| JobName string `json:"job_name" binding:"Required" ` | JobName string `json:"job_name" binding:"Required" ` | ||||
| @@ -40,3 +45,38 @@ type CreateTrainJobOption struct { | |||||
| PreTrainModelUrl string `json:"pre_train_model_url"` | PreTrainModelUrl string `json:"pre_train_model_url"` | ||||
| SpecId int64 `json:"spec_id" binding:"Required"` | SpecId int64 `json:"spec_id" binding:"Required"` | ||||
| } | } | ||||
| type Cloudbrain struct { | |||||
| ID int64 `json:"id"` | |||||
| JobID string `json:"job_id"` | |||||
| JobType string `json:"job_type"` | |||||
| Type int `json:"type"` | |||||
| DisplayJobName string `json:"display_job_name"` | |||||
| Status string `json:"status"` | |||||
| CreatedUnix timeutil.TimeStamp `json:"created_unix"` | |||||
| RepoID int64 `json:"repo_id"` | |||||
| Duration int64 `json:"duration"` //运行时长 单位秒 | |||||
| TrainJobDuration string `json:"train_job_duration"` | |||||
| ImageID string `json:"image_id"` //grampus image_id | |||||
| Image string `json:"image"` | |||||
| Uuid string `json:"uuid"` //数据集id | |||||
| DatasetName string `json:"dataset_name"` | |||||
| ComputeResource string `json:"compute_resource"` //计算资源,例如npu | |||||
| AiCenter string `json:"ai_center"` //grampus ai center: center_id+center_name | |||||
| BranchName string `json:"branch_name"` //分支名称 | |||||
| Parameters string `json:"parameters"` //传给modelarts的param参数 | |||||
| BootFile string `json:"boot_file"` //启动文件 | |||||
| Description string `json:"description"` //描述 | |||||
| ModelName string `json:"model_name"` //模型名称 | |||||
| ModelVersion string `json:"model_version"` //模型版本 | |||||
| CkptName string `json:"ckpt_name"` //权重文件名称 | |||||
| VersionCount int `json:"-"` //任务的当前版本数量,不包括删除的 | |||||
| IsLatestVersion string `json:"-"` //是否是最新版本,1是,0否 | |||||
| CommitID string `json:"-"` //提交的仓库代码id | |||||
| PreVersionName string `json:"-"` //父版本名称 | |||||
| StartTime timeutil.TimeStamp `json:"start_time"` | |||||
| EndTime timeutil.TimeStamp `json:"end_time"` | |||||
| Spec *models.Specification `json:"spec"` | |||||
| } | |||||