diff --git a/api/jiaozifs.gen.go b/api/jiaozifs.gen.go index 5b1ec98..f0684a4 100644 --- a/api/jiaozifs.gen.go +++ b/api/jiaozifs.gen.go @@ -15,7 +15,6 @@ import ( "net/url" "path" "strings" - "time" "github.com/getkin/kin-openapi/openapi3" "github.com/go-chi/chi/v5" @@ -68,13 +67,13 @@ type AuthenticationToken struct { // Branch defines model for Branch. type Branch struct { CommitHash string `json:"commit_hash"` - CreatedAt time.Time `json:"created_at"` + CreatedAt int64 `json:"created_at"` CreatorId openapi_types.UUID `json:"creator_id"` Description *string `json:"description,omitempty"` Id openapi_types.UUID `json:"id"` Name string `json:"name"` RepositoryId openapi_types.UUID `json:"repository_id"` - UpdatedAt time.Time `json:"updated_at"` + UpdatedAt int64 `json:"updated_at"` } // BranchCreation defines model for BranchCreation. @@ -112,14 +111,14 @@ type ChangePair struct { type Commit struct { Author Signature `json:"author"` Committer Signature `json:"committer"` - CreatedAt time.Time `json:"created_at"` + CreatedAt int64 `json:"created_at"` Hash string `json:"hash"` MergeTag string `json:"merge_tag"` Message string `json:"message"` ParentHashes []string `json:"parent_hashes"` RepositoryId openapi_types.UUID `json:"repository_id"` TreeHash string `json:"tree_hash"` - UpdatedAt time.Time `json:"updated_at"` + UpdatedAt int64 `json:"updated_at"` } // CreateMergeRequest defines model for CreateMergeRequest. @@ -140,12 +139,12 @@ type CreateRepository struct { // FullTreeEntry defines model for FullTreeEntry. type FullTreeEntry struct { - CreatedAt time.Time `json:"created_at"` - Hash string `json:"hash"` - IsDir bool `json:"is_dir"` - Name string `json:"name"` - Size int64 `json:"size"` - UpdatedAt time.Time `json:"updated_at"` + CreatedAt int64 `json:"created_at"` + Hash string `json:"hash"` + IsDir bool `json:"is_dir"` + Name string `json:"name"` + Size int64 `json:"size"` + UpdatedAt int64 `json:"updated_at"` } // LoginConfig defines model for LoginConfig. @@ -188,7 +187,7 @@ type MergeMergeRequest struct { // MergeRequest defines model for MergeRequest. type MergeRequest struct { AuthorId openapi_types.UUID `json:"author_id"` - CreatedAt time.Time `json:"created_at"` + CreatedAt int64 `json:"created_at"` Description *string `json:"description,omitempty"` Id openapi_types.UUID `json:"id"` MergeStatus int `json:"merge_status"` @@ -198,14 +197,14 @@ type MergeRequest struct { TargetBranch openapi_types.UUID `json:"target_branch"` TargetRepoId openapi_types.UUID `json:"target_repo_id"` Title string `json:"title"` - UpdatedAt time.Time `json:"updated_at"` + UpdatedAt int64 `json:"updated_at"` } // MergeRequestFullState defines model for MergeRequestFullState. type MergeRequestFullState struct { AuthorId openapi_types.UUID `json:"author_id"` Changes []ChangePair `json:"changes"` - CreatedAt time.Time `json:"created_at"` + CreatedAt int64 `json:"created_at"` Description *string `json:"description,omitempty"` Id openapi_types.UUID `json:"id"` MergeStatus int `json:"merge_status"` @@ -215,7 +214,7 @@ type MergeRequestFullState struct { TargetBranch openapi_types.UUID `json:"target_branch"` TargetRepoId openapi_types.UUID `json:"target_repo_id"` Title string `json:"title"` - UpdatedAt time.Time `json:"updated_at"` + UpdatedAt int64 `json:"updated_at"` } // MergeRequestList defines model for MergeRequestList. @@ -262,7 +261,7 @@ type RefType string // Repository defines model for Repository. type Repository struct { - CreatedAt time.Time `json:"created_at"` + CreatedAt int64 `json:"created_at"` CreatorId openapi_types.UUID `json:"creator_id"` Description *string `json:"description,omitempty"` Head string `json:"head"` @@ -271,7 +270,7 @@ type Repository struct { OwnerId openapi_types.UUID `json:"owner_id"` StorageAdapterParams *string `json:"storage_adapter_params,omitempty"` StorageNamespace *string `json:"storage_namespace,omitempty"` - UpdatedAt time.Time `json:"updated_at"` + UpdatedAt int64 `json:"updated_at"` UsePublicStorage bool `json:"use_public_storage"` } @@ -296,7 +295,7 @@ type SetupStateState string type Signature struct { Email openapi_types.Email `json:"email"` Name string `json:"name"` - When time.Time `json:"when"` + When int64 `json:"when"` } // UpdateMergeRequest defines model for UpdateMergeRequest. @@ -320,15 +319,15 @@ type UpdateWip struct { // UserInfo defines model for UserInfo. type UserInfo struct { - CreatedAt time.Time `json:"created_at"` - CurrentSignInAt *time.Time `json:"current_sign_in_at,omitempty"` + CreatedAt int64 `json:"created_at"` + CurrentSignInAt *int64 `json:"current_sign_in_at,omitempty"` CurrentSignInIp *string `json:"current_sign_in_ip,omitempty"` Email openapi_types.Email `json:"email"` Id openapi_types.UUID `json:"id"` - LastSignInAt *time.Time `json:"last_sign_in_at,omitempty"` + LastSignInAt *int64 `json:"last_sign_in_at,omitempty"` LastSignInIp *string `json:"last_sign_in_ip,omitempty"` Name string `json:"name"` - UpdatedAt time.Time `json:"updated_at"` + UpdatedAt int64 `json:"updated_at"` } // UserRegisterInfo defines model for UserRegisterInfo. @@ -351,30 +350,27 @@ type VersionResult struct { // Wip defines model for Wip. type Wip struct { BaseCommit string `json:"base_commit"` - CreatedAt time.Time `json:"created_at"` + CreatedAt int64 `json:"created_at"` CreatorId openapi_types.UUID `json:"creator_id"` CurrentTree string `json:"current_tree"` Id openapi_types.UUID `json:"id"` RefId openapi_types.UUID `json:"ref_id"` RepositoryId openapi_types.UUID `json:"repository_id"` State int `json:"state"` - UpdatedAt time.Time `json:"updated_at"` + UpdatedAt int64 `json:"updated_at"` } // PaginationAmount defines model for PaginationAmount. type PaginationAmount = int -// PaginationBranchAfter defines model for PaginationBranchAfter. -type PaginationBranchAfter = string - -// PaginationCommitAfter defines model for PaginationCommitAfter. -type PaginationCommitAfter = string +// PaginationInt64After defines model for PaginationInt64After. +type PaginationInt64After = int64 // PaginationPrefix defines model for PaginationPrefix. type PaginationPrefix = string -// PaginationRepoAfter defines model for PaginationRepoAfter. -type PaginationRepoAfter = time.Time +// PaginationStringAfter defines model for PaginationStringAfter. +type PaginationStringAfter = string // LoginJSONBody defines parameters for Login. type LoginJSONBody struct { @@ -385,7 +381,7 @@ type LoginJSONBody struct { // ListMergeRequestsParams defines parameters for ListMergeRequests. type ListMergeRequestsParams struct { // After return items after this value - After *PaginationRepoAfter `form:"after,omitempty" json:"after,omitempty"` + After *PaginationInt64After `form:"after,omitempty" json:"after,omitempty"` // Amount how many items to return Amount *PaginationAmount `form:"amount,omitempty" json:"amount,omitempty"` @@ -462,7 +458,7 @@ type ListBranchesParams struct { Prefix *PaginationPrefix `form:"prefix,omitempty" json:"prefix,omitempty"` // After return items after this value - After *PaginationBranchAfter `form:"after,omitempty" json:"after,omitempty"` + After *PaginationStringAfter `form:"after,omitempty" json:"after,omitempty"` // Amount how many items to return Amount *PaginationAmount `form:"amount,omitempty" json:"amount,omitempty"` @@ -477,7 +473,7 @@ type GetCommitChangesParams struct { // GetCommitsInRefParams defines parameters for GetCommitsInRef. type GetCommitsInRefParams struct { // After return items after this value - After *PaginationCommitAfter `form:"after,omitempty" json:"after,omitempty"` + After *PaginationInt64After `form:"after,omitempty" json:"after,omitempty"` // Amount how many items to return Amount *PaginationAmount `form:"amount,omitempty" json:"amount,omitempty"` @@ -510,7 +506,7 @@ type ListRepositoryOfAuthenticatedUserParams struct { Prefix *PaginationPrefix `form:"prefix,omitempty" json:"prefix,omitempty"` // After return items after this value - After *PaginationRepoAfter `form:"after,omitempty" json:"after,omitempty"` + After *PaginationInt64After `form:"after,omitempty" json:"after,omitempty"` // Amount how many items to return Amount *PaginationAmount `form:"amount,omitempty" json:"amount,omitempty"` @@ -522,7 +518,7 @@ type ListRepositoryParams struct { Prefix *PaginationPrefix `form:"prefix,omitempty" json:"prefix,omitempty"` // After return items after this value - After *PaginationRepoAfter `form:"after,omitempty" json:"after,omitempty"` + After *PaginationInt64After `form:"after,omitempty" json:"after,omitempty"` // Amount how many items to return Amount *PaginationAmount `form:"amount,omitempty" json:"amount,omitempty"` @@ -8305,87 +8301,86 @@ func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handl // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+xd63PbOJL/V1C8/ZDc0ZbtZKZuPTW1lXidTe6cjMt2Jh9inwoimxImJMABQMsal//3", - "Kzz4BilKlvzI5ksqJkGg0d34oV+Abr2AJSmjQKXwDm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9AplrNfR7+g91Kmv9F44arEvfO913v7rniaiZ0q", - "8x/9jmMS6tkcc8405rw+2HM4MoyZ+vOizlbP2paUN1t/sBNA58CvgSPbdwUSvMOvV74nsiTByuD1UuAK", - "3RAuOCbxVCiZ68V/pb4tdJZlsldp1Xu3FvTJSX31NHnm5pKZpYNNOlKuRxzdauf/bnRbovzd6Dbh5/Dn", - "nSJhCg4O/gtkzU/a4oJyJ7ccS0rPKWfkIDGZRq8dhS1g0g/oE5PoHcto2CnBC5cEf3Kp0hDpTUGi+jxK", - "8enn+eMrU1NYHBD5arc+Gzu224kWrVcFSJNU7zku4OynVI0NdKZVq7ef5Um3uyu/Y207nPj1d6c+vXQM", - "dFffjNS07oaAjDGS6oJHFnmeqSK7ptStywUk8R5Q6gSjEyJqaCS81tpwCbJsMnIdkVHaO/gzeyar0PjG", - "SZncTnaouNusV/r9IIiq47HfMZjGREjEosbaIhTVIO35QmwnDjpKo7eDg46BBuHg/lb0+XvVZeNUbxRP", - "cyPPtGyeOP1hUNiFpLVrS2unXck53IQYTMCw6i0T62lnxTpWU1W7nrmpYiaEa1PqX1omktBppIQQgwne", - "1TXpn/q5Kdhoe0wOlphxkOkvRKUvGi9W4PWrdqN3jE9IGALtlMYnJvtl4PBca1w1RCMzhV300aQy7d/C", - "nBqgTNoz6gijfEQESka7FQnYb/SG3OWNFlxtYFiD6EUKiNDQnAeuFoBEnCVoTtKRqZIYSTz1kXXEUVE5", - "4bLtbIVON/j0J6RNmYaGtjqtbxcSEMd0WiNUH33Ig0C62OjXvZ39vYNXOXUmilSSd6ZP71XpSbFUi8I7", - "9P7PdPDixeVl+J876h//H+gfL//r5d8cwaLVLFIWSJA7QnLASR2OCiyeEIr5wn1A3LkO8qFqobIj83An", - "z9vcdhjZXTVYxxfmNF/fCfoTLOTORxaawye9jVXzg72fH4ozKeaS4Bhtk0P592f5qdt7q9JWuP5q78C1", - "qYSEK87ogyQphx1BphRCfQgkYlxXXbAcOypMO2FBUY/SP+76O54VmkL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LxZCFBrLM+Cr77eQhNE2DZaObdLcwan1ax71r9ndRUu64bMyzGCeMOAXyGa4lS5Q0QgfAVJrFy/spZ", + "V/zkBF+PU+Dj1OlUfMLXJMExolkyAa5sSqCSExAoBa5H8Co5vT2XHChcyzGLIgGObKNOIRXuEQfV9xVo", + "w5Xmc3CpbWXlNmZeEKrzXgJFLKOhUkNrHuvP+mluR9MMmxvMKqmoT9KlFqcQndtFmvvMBbTOSarxdFpE", + "5pyec1+w6KGTSjPA4VayTWxOYTCVNhI2xiFOpZYSxx0udt5Uu3UpDjayxfrKIRun2SQmwdiO4ApOubZi", + "Gywq5mt56uzyDqmuUokedietKPPG9tEzkFnaYWWrdTVOOURinBAhlHxb0KGcWkRyrzlJdDJfIMwB2W92", + "nQiaxwny8FzfvKuRPK2GltocFAglkuCY/KUjaZTJcfXJpcvnbvOhyKu02AAJJnFNl82TVZbkfGay+2uG", + "Q/MBdTcuMX7RGrxSysCxvAe7Fl0G9m0naX1AvCZQdg/2laSO3AAWMA6KlF3bLsy4TtlIDoOnJoB/pBHb", + "xN5iRxdkSseErv+hmXr5YXr10qWpKyj1wI0kxmIN8mtfDaS9c5VtwLtrLLhVtgmlDacwJUJ2acUmkCTF", + "QswZ1zJJCD0GOlXG/3/7w8op8gGLblwz+R24IIye6n3DEX1JyfjKNHFUVGVU2fkob+DUFAlCVrtoNens", + "PuVsynHS3X1j2mW7KtWuSa8HGlu2IZeA0uDFySEaD266ala+2JCX7hsbWKA1jvg1AbWT93baOYlr24A6", + "mhZknMjFmTJKCuUgwRhnxvnW1oq2ctTjcjYzKVMTd9A5kbw5KfNdZWmhmjmnONatxgJEXcdxSv4XtPH3", + "x1yOi5LBCWAO/H3OTZMpK8nRb5v0qCkRC1L1FfYHwewvEgn04fz8BL05+ej5XkwCoALKui7vTYqDGaCD", + "3T3FOx7bjsXhaDSfz3exfr3L+HRkvxWj449H7z6fvds52N3bnckkrhgS5aBmvGL5e/u7e7t72qlJgeKU", + "eIfeC/3IxBa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VSuEWH4", + "QUCXwxXwgaD7b2Aw++0bwyEi14hFaInFYyM+ayH6qRZCze5byc01QnwwCHQMZ4N6RZDPFd2zVFcq+dqY", + "4CNQhqhmfv7buvorHMdtfKwHLG6q91x/u1Syrd65bZ7U7tX+dqlkZFDbtaFWMncG2GmYMnOxYXmJ9eFo", + "FLMAxzMm5OGLl3/ffzHCKRld7Xtt7VraYfHp5e3/BwAA//9a8hKXZoYAAA==", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/api/swagger.yml b/api/swagger.yml index bcc3ead..6fd5f00 100644 --- a/api/swagger.yml +++ b/api/swagger.yml @@ -26,28 +26,21 @@ components: schema: type: string - PaginationBranchAfter: + PaginationStringAfter: in: query name: after description: return items after this value schema: type: string - PaginationRepoAfter: + PaginationInt64After: in: query name: after description: return items after this value schema: - type: string - format: date-time - - PaginationCommitAfter: - in: query - name: after - description: return items after this value - schema: - type: string - format: date-time-ns + type: integer + format: int64 + PaginationAmount: in: query @@ -224,11 +217,11 @@ components: type: string format: uuid created_at: - type: string - format: date-time + type: integer + format: int64 updated_at: - type: string - format: date-time + type: integer + format: int64 MergeRequestFullState: type: object required: @@ -278,11 +271,11 @@ components: items: $ref: "#/components/schemas/ChangePair" created_at: - type: string - format: date-time + type: integer + format: int64 updated_at: - type: string - format: date-time + type: integer + format: int64 MergeRequestList: type: object required: @@ -322,11 +315,11 @@ components: type: string format: uuid created_at: - type: string - format: date-time + type: integer + format: int64 updated_at: - type: string - format: date-time + type: integer + format: int64 BranchList: type: object required: @@ -405,11 +398,11 @@ components: type: string format: uuid created_at: - type: string - format: date-time + type: integer + format: int64 updated_at: - type: string - format: date-time + type: integer + format: int64 Blob: type: object required: @@ -440,11 +433,11 @@ components: additionalProperties: type: string created_at: - type: string - format: date-time + type: integer + format: int64 updated_at: - type: string - format: date-time + type: integer + format: int64 Signature: type: object required: @@ -458,8 +451,8 @@ components: type: string format: email when: - type: string - format: date-time + type: integer + format: int64 Commit: type: object required: @@ -494,11 +487,11 @@ components: items: type: string created_at: - type: string - format: date-time + type: integer + format: int64 updated_at: - type: string - format: date-time + type: integer + format: int64 TreeEntry: type: object required: @@ -532,11 +525,11 @@ components: type: integer format: int64 created_at: - type: string - format: date-time + type: integer + format: int64 updated_at: - type: string - format: date-time + type: integer + format: int64 TreeNode: type: object required: @@ -565,11 +558,11 @@ components: items: $ref: "#/components/schemas/TreeEntry" created_at: - type: string - format: date-time + type: integer + format: int64 updated_at: - type: string - format: date-time + type: integer + format: int64 Wip: type: object required: @@ -603,11 +596,11 @@ components: type: string format: uuid created_at: - type: string - format: date-time + type: integer + format: int64 updated_at: - type: string - format: date-time + type: integer + format: int64 UpdateWip: type: object properties: @@ -676,11 +669,11 @@ components: type: string format: email current_sign_in_at: - type: string - format: date-time + type: integer + format: int64 last_sign_in_at: - type: string - format: date-time + type: integer + format: int64 current_sign_in_ip: type: string format: ipv4 @@ -688,11 +681,11 @@ components: type: string format: ipv4 created_at: - type: string - format: date-time + type: integer + format: int64 updated_at: - type: string - format: date-time + type: integer + format: int64 UserRegisterInfo: type: object required: @@ -1560,7 +1553,7 @@ paths: operationId: getCommitsInRef summary: get commits in ref parameters: - - $ref: "#/components/parameters/PaginationCommitAfter" + - $ref: "#/components/parameters/PaginationInt64After" - $ref: "#/components/parameters/PaginationAmount" - in: query name: refName @@ -1662,7 +1655,7 @@ paths: operationId: listMergeRequests summary: get list of merge request in repository parameters: - - $ref: "#/components/parameters/PaginationRepoAfter" + - $ref: "#/components/parameters/PaginationInt64After" - $ref: "#/components/parameters/PaginationAmount" - in: query name: state @@ -1833,7 +1826,7 @@ paths: summary: list repository in specific owner parameters: - $ref: "#/components/parameters/PaginationPrefix" - - $ref: "#/components/parameters/PaginationRepoAfter" + - $ref: "#/components/parameters/PaginationInt64After" - $ref: "#/components/parameters/PaginationAmount" responses: 200: @@ -1857,7 +1850,7 @@ paths: summary: list repository parameters: - $ref: "#/components/parameters/PaginationPrefix" - - $ref: "#/components/parameters/PaginationRepoAfter" + - $ref: "#/components/parameters/PaginationInt64After" - $ref: "#/components/parameters/PaginationAmount" responses: 200: @@ -1918,7 +1911,7 @@ paths: summary: list branches parameters: - $ref: "#/components/parameters/PaginationPrefix" - - $ref: "#/components/parameters/PaginationBranchAfter" + - $ref: "#/components/parameters/PaginationStringAfter" - $ref: "#/components/parameters/PaginationAmount" responses: 200: diff --git a/controller/branch_ctl.go b/controller/branch_ctl.go index 8cbcf17..f21677c 100644 --- a/controller/branch_ctl.go +++ b/controller/branch_ctl.go @@ -103,13 +103,13 @@ func (bct BranchController) ListBranches(ctx context.Context, w *api.JiaozifsRes for _, branch := range branches { r := api.Branch{ CommitHash: branch.CommitHash.Hex(), - CreatedAt: branch.CreatedAt, + CreatedAt: branch.CreatedAt.UnixMilli(), CreatorId: branch.CreatorID, Description: branch.Description, Id: branch.ID, Name: branch.Name, RepositoryId: branch.RepositoryID, - UpdatedAt: branch.UpdatedAt, + UpdatedAt: branch.UpdatedAt.UnixMilli(), } results = append(results, r) } @@ -183,13 +183,13 @@ func (bct BranchController) CreateBranch(ctx context.Context, w *api.JiaozifsRes w.JSON(api.Branch{ CommitHash: newBranch.CommitHash.Hex(), - CreatedAt: newBranch.CreatedAt, + CreatedAt: newBranch.CreatedAt.UnixMilli(), CreatorId: newBranch.CreatorID, Description: newBranch.Description, Id: newBranch.ID, Name: newBranch.Name, RepositoryId: newBranch.RepositoryID, - UpdatedAt: newBranch.UpdatedAt, + UpdatedAt: newBranch.UpdatedAt.UnixMilli(), }, http.StatusCreated) } @@ -271,12 +271,12 @@ func (bct BranchController) GetBranch(ctx context.Context, w *api.JiaozifsRespon } w.JSON(api.Branch{ CommitHash: ref.CommitHash.Hex(), - CreatedAt: ref.CreatedAt, + CreatedAt: ref.CreatedAt.UnixMilli(), CreatorId: ref.CreatorID, Description: ref.Description, Id: ref.ID, Name: ref.Name, RepositoryId: ref.RepositoryID, - UpdatedAt: ref.UpdatedAt, + UpdatedAt: ref.UpdatedAt.UnixMilli(), }) } diff --git a/controller/commit_ctl.go b/controller/commit_ctl.go index 42b71bf..54dab56 100644 --- a/controller/commit_ctl.go +++ b/controller/commit_ctl.go @@ -7,6 +7,8 @@ import ( "net/http" "strings" + openapi_types "github.com/oapi-codegen/runtime/types" + "github.com/jiaozifs/jiaozifs/api" "github.com/jiaozifs/jiaozifs/auth" "github.com/jiaozifs/jiaozifs/block/params" @@ -123,7 +125,18 @@ func (commitCtl CommitController) GetEntriesInRef(ctx context.Context, w *api.Ji w.Error(err) return } - w.JSON(treeEntry) + apiTreeEntries := make([]api.FullTreeEntry, len(treeEntry)) + for index, entry := range treeEntry { + apiTreeEntries[index] = api.FullTreeEntry{ + CreatedAt: entry.CreatedAt.UnixMilli(), + Hash: entry.Hash.Hex(), + IsDir: entry.IsDir, + Name: entry.Name, + Size: entry.Size, + UpdatedAt: entry.UpdatedAt.UnixMilli(), + } + } + w.JSON(apiTreeEntries) } func (commitCtl CommitController) CompareCommit(ctx context.Context, w *api.JiaozifsResponse, _ *http.Request, ownerName string, repositoryName string, basehead string, params api.CompareCommitParams) { @@ -237,3 +250,26 @@ func (commitCtl CommitController) GetCommitChanges(ctx context.Context, w *api.J } w.JSON(changesResp) } + +func commitToDto(commit *models.Commit) *api.Commit { + return &api.Commit{ + Author: api.Signature{ + Email: openapi_types.Email(commit.Author.Email), + Name: commit.Author.Name, + When: commit.Author.When.UnixMilli(), + }, + Committer: api.Signature{ + Email: openapi_types.Email(commit.Committer.Email), + Name: commit.Committer.Name, + When: commit.Committer.When.UnixMilli(), + }, + CreatedAt: commit.CreatedAt.UnixMilli(), + Hash: commit.Hash.Hex(), + MergeTag: commit.MergeTag, + Message: commit.Message, + ParentHashes: hash.HexArrayOfHashes(commit.ParentHashes...), + RepositoryId: commit.RepositoryID, + TreeHash: commit.TreeHash.Hex(), + UpdatedAt: commit.UpdatedAt.UnixMilli(), + } +} diff --git a/controller/merge_request_ctl.go b/controller/merge_request_ctl.go index 565d3c1..736f011 100644 --- a/controller/merge_request_ctl.go +++ b/controller/merge_request_ctl.go @@ -57,7 +57,7 @@ func (mrCtl MergeRequestController) ListMergeRequests(ctx context.Context, w *ap } if params.After != nil { - listParams.SetAfter(*params.After) + listParams.SetAfter(time.UnixMilli(*params.After)) } pageAmount := utils.IntValue(params.Amount) if pageAmount > utils.DefaultMaxPerPage || pageAmount <= 0 { @@ -83,8 +83,8 @@ func (mrCtl MergeRequestController) ListMergeRequests(ctx context.Context, w *ap SourceRepoId: mr.SourceRepoID, TargetBranch: mr.TargetBranchID, TargetRepoId: mr.TargetRepoID, - CreatedAt: mr.CreatedAt, - UpdatedAt: mr.UpdatedAt, + CreatedAt: mr.CreatedAt.UnixMilli(), + UpdatedAt: mr.UpdatedAt.UnixMilli(), } } pagMag := utils.PaginationFor(hasMore, results, "UpdatedAt") @@ -202,8 +202,8 @@ func (mrCtl MergeRequestController) CreateMergeRequest(ctx context.Context, w *a SourceRepoId: mrModel.SourceRepoID, TargetBranch: mrModel.TargetBranchID, TargetRepoId: mrModel.TargetRepoID, - CreatedAt: mrModel.CreatedAt, - UpdatedAt: mrModel.UpdatedAt, + CreatedAt: mrModel.CreatedAt.UnixMilli(), + UpdatedAt: mrModel.UpdatedAt.UnixMilli(), } resp.Changes, err = changePairToDTO(changePairs) @@ -212,7 +212,7 @@ func (mrCtl MergeRequestController) CreateMergeRequest(ctx context.Context, w *a return } //get merge state - w.JSON(mrModel, http.StatusCreated) + w.JSON(resp, http.StatusCreated) } func (mrCtl MergeRequestController) GetMergeRequest(ctx context.Context, w *api.JiaozifsResponse, _ *http.Request, ownerName string, repositoryName string, mrSeq uint64) { operator, err := auth.GetOperator(ctx) @@ -285,8 +285,8 @@ func (mrCtl MergeRequestController) GetMergeRequest(ctx context.Context, w *api. SourceRepoId: mergeRequest.SourceRepoID, TargetBranch: mergeRequest.TargetBranchID, TargetRepoId: mergeRequest.TargetRepoID, - CreatedAt: mergeRequest.CreatedAt, - UpdatedAt: mergeRequest.UpdatedAt, + CreatedAt: mergeRequest.CreatedAt.UnixMilli(), + UpdatedAt: mergeRequest.UpdatedAt.UnixMilli(), } resp.Changes, err = changePairToDTO(changePairs) if err != nil { @@ -403,7 +403,7 @@ func (mrCtl MergeRequestController) Merge(ctx context.Context, w *api.JiaozifsRe return } - w.JSON(commit) + w.JSON(commitToDto(commit)) } func changePairToDTO(pairs []*versionmgr.ChangePair) ([]api.ChangePair, error) { diff --git a/controller/repository_ctl.go b/controller/repository_ctl.go index 90d387a..ec31a59 100644 --- a/controller/repository_ctl.go +++ b/controller/repository_ctl.go @@ -20,7 +20,6 @@ import ( "github.com/jiaozifs/jiaozifs/utils" "github.com/jiaozifs/jiaozifs/utils/hash" "github.com/jiaozifs/jiaozifs/versionmgr" - openapi_types "github.com/oapi-codegen/runtime/types" "go.uber.org/fx" ) @@ -68,7 +67,7 @@ func (repositoryCtl RepositoryController) ListRepositoryOfAuthenticatedUser(ctx listRepoParams.SetName(*params.Prefix, models.PrefixMatch) } if params.After != nil { - listRepoParams.SetAfter(*params.After) + listRepoParams.SetAfter(time.UnixMilli(utils.Int64Value(params.After))) } pageAmount := utils.IntValue(params.Amount) if pageAmount > utils.DefaultMaxPerPage || pageAmount <= 0 { @@ -85,16 +84,7 @@ func (repositoryCtl RepositoryController) ListRepositoryOfAuthenticatedUser(ctx } results := make([]api.Repository, 0, len(repositories)) for _, repo := range repositories { - r := api.Repository{ - CreatedAt: repo.CreatedAt, - CreatorId: repo.CreatorID, - Description: repo.Description, - Head: repo.HEAD, - Id: repo.ID, - Name: repo.Name, - UpdatedAt: repo.UpdatedAt, - } - results = append(results, r) + results = append(results, *repositoryToDto(repo)) } pagMag := utils.PaginationFor(hasMore, results, "UpdatedAt") pagination := api.Pagination{ @@ -131,7 +121,7 @@ func (repositoryCtl RepositoryController) ListRepository(ctx context.Context, w listRepoParams.SetName(*params.Prefix, models.PrefixMatch) } if params.After != nil { - listRepoParams.SetAfter(*params.After) + listRepoParams.SetAfter(time.UnixMilli(*params.After)) } pageAmount := utils.IntValue(params.Amount) if pageAmount > utils.DefaultMaxPerPage || pageAmount <= 0 { @@ -147,16 +137,7 @@ func (repositoryCtl RepositoryController) ListRepository(ctx context.Context, w } results := make([]api.Repository, 0, len(repositories)) for _, repo := range repositories { - r := api.Repository{ - CreatedAt: repo.CreatedAt, - CreatorId: repo.CreatorID, - Description: repo.Description, - Head: repo.HEAD, - Id: repo.ID, - Name: repo.Name, - UpdatedAt: repo.UpdatedAt, - } - results = append(results, r) + results = append(results, *repositoryToDto(repo)) } pagMag := utils.PaginationFor(hasMore, results, "UpdatedAt") pagination := api.Pagination{ @@ -244,15 +225,7 @@ func (repositoryCtl RepositoryController) CreateRepository(ctx context.Context, return } - w.JSON(api.Repository{ - CreatedAt: createdRepo.CreatedAt, - CreatorId: createdRepo.CreatorID, - Description: createdRepo.Description, - Head: createdRepo.HEAD, - Id: createdRepo.ID, - Name: createdRepo.Name, - UpdatedAt: createdRepo.UpdatedAt, - }) + w.JSON(repositoryToDto(createdRepo)) } func (repositoryCtl RepositoryController) DeleteRepository(ctx context.Context, w *api.JiaozifsResponse, _ *http.Request, ownerName string, repositoryName string) { @@ -349,7 +322,7 @@ func (repositoryCtl RepositoryController) GetRepository(ctx context.Context, w * return } - w.JSON(repo) + w.JSON(repositoryToDto(repo)) } func (repositoryCtl RepositoryController) UpdateRepository(ctx context.Context, w *api.JiaozifsResponse, _ *http.Request, body api.UpdateRepositoryJSONRequestBody, ownerName string, repositoryName string) { @@ -451,11 +424,7 @@ func (repositoryCtl RepositoryController) GetCommitsInRef(ctx context.Context, w commit, err := iter.Next() if err == nil { if params.After != nil { - parseTime, err := time.Parse(time.RFC3339Nano, *params.After) - if err != nil { - w.Error(err) - return - } + parseTime := time.UnixMilli(*params.After) if commit.Commit().Committer.When.Add(time.Nanosecond).After(parseTime) { continue } @@ -464,27 +433,7 @@ func (repositoryCtl RepositoryController) GetCommitsInRef(ctx context.Context, w break } modelCommit := commit.Commit() - commits = append(commits, api.Commit{ - RepositoryId: modelCommit.RepositoryID, - Author: api.Signature{ - Email: openapi_types.Email(modelCommit.Author.Email), - Name: modelCommit.Author.Name, - When: modelCommit.Author.When, - }, - - Committer: api.Signature{ - Email: openapi_types.Email(modelCommit.Committer.Email), - Name: modelCommit.Committer.Name, - When: modelCommit.Committer.When, - }, - CreatedAt: modelCommit.CreatedAt, - Hash: modelCommit.Hash.Hex(), - MergeTag: modelCommit.MergeTag, - Message: modelCommit.Message, - ParentHashes: hash.HexArrayOfHashes(modelCommit.ParentHashes...), - TreeHash: modelCommit.TreeHash.Hex(), - UpdatedAt: modelCommit.UpdatedAt, - }) + commits = append(commits, *commitToDto(modelCommit)) continue } if err == io.EOF { @@ -495,3 +444,15 @@ func (repositoryCtl RepositoryController) GetCommitsInRef(ctx context.Context, w } w.JSON(commits) } + +func repositoryToDto(repository *models.Repository) *api.Repository { + return &api.Repository{ + CreatedAt: repository.CreatedAt.UnixMilli(), + CreatorId: repository.CreatorID, + Description: repository.Description, + Head: repository.HEAD, + Id: repository.ID, + Name: repository.Name, + UpdatedAt: repository.UpdatedAt.UnixMilli(), + } +} diff --git a/controller/user_ctl.go b/controller/user_ctl.go index a4489d9..1a4f842 100644 --- a/controller/user_ctl.go +++ b/controller/user_ctl.go @@ -6,6 +6,8 @@ import ( "net/http" "time" + "github.com/jiaozifs/jiaozifs/utils" + "github.com/go-openapi/swag" "github.com/gorilla/sessions" logging "github.com/ipfs/go-log/v2" @@ -105,12 +107,12 @@ func (userCtl UserController) GetUserInfo(ctx context.Context, w *api.JiaozifsRe userInfo := api.UserInfo{ Name: user.Name, Email: openapitypes.Email(user.Email), - CurrentSignInAt: &user.CurrentSignInAt, + CurrentSignInAt: utils.Int64(user.CurrentSignInAt.UnixMilli()), CurrentSignInIp: &user.CurrentSignInIP, - LastSignInAt: &user.LastSignInAt, + LastSignInAt: utils.Int64(user.LastSignInAt.UnixMilli()), LastSignInIp: &user.LastSignInIP, - UpdatedAt: user.UpdatedAt, - CreatedAt: user.CreatedAt, + UpdatedAt: user.UpdatedAt.UnixMilli(), + CreatedAt: user.CreatedAt.UnixMilli(), } w.JSON(userInfo) } diff --git a/controller/wip_ctl.go b/controller/wip_ctl.go index 1bb5a4e..0995d25 100644 --- a/controller/wip_ctl.go +++ b/controller/wip_ctl.go @@ -66,9 +66,9 @@ func (wipCtl WipController) GetWip(ctx context.Context, w *api.JiaozifsResponse, return } if isNew { - w.JSON(wip, http.StatusCreated) + w.JSON(wipToDto(wip), http.StatusCreated) } - w.JSON(wip) + w.JSON(wipToDto(wip)) } // ListWip return wips of branches, operator only see himself wips in specific repository @@ -102,7 +102,11 @@ func (wipCtl WipController) ListWip(ctx context.Context, w *api.JiaozifsResponse return } - w.JSON(wips) + apiWips := make([]*api.Wip, len(wips)) + for index, wip := range wips { + apiWips[index] = wipToDto(wip) + } + w.JSON(apiWips) } // CommitWip commit wip to branch, operator only could operator himself wip @@ -148,7 +152,7 @@ func (wipCtl WipController) CommitWip(ctx context.Context, w *api.JiaozifsRespon return } - w.JSON(workRepo.CurWip(), http.StatusCreated) + w.JSON(wipToDto(workRepo.CurWip()), http.StatusCreated) } func (wipCtl WipController) UpdateWip(ctx context.Context, w *api.JiaozifsResponse, _ *http.Request, body api.UpdateWipJSONRequestBody, ownerName string, repositoryName string, params api.UpdateWipParams) { @@ -391,3 +395,17 @@ func (wipCtl WipController) RevertWipChanges(ctx context.Context, w *api.Jiaozif w.OK() } + +func wipToDto(wip *models.WorkingInProcess) *api.Wip { + return &api.Wip{ + BaseCommit: wip.BaseCommit.Hex(), + CreatedAt: wip.CreatedAt.UnixMilli(), + CreatorId: wip.CreatorID, + CurrentTree: wip.CurrentTree.Hex(), + Id: wip.ID, + RefId: wip.RefID, + RepositoryId: wip.RepositoryID, + State: int(wip.State), + UpdatedAt: wip.UpdatedAt.UnixMilli(), + } +} diff --git a/integrationtest/merge_request_test.go b/integrationtest/merge_request_test.go index 0455437..1946fe4 100644 --- a/integrationtest/merge_request_test.go +++ b/integrationtest/merge_request_test.go @@ -325,7 +325,7 @@ func MergeRequestSpec(ctx context.Context, urlStr string) func(c convey.C) { }) c.Convey("success to list page merge quest", func() { - var after *time.Time + var after *int64 for i := 0; i < 6; i++ { resp, err := client.ListMergeRequests(ctx, userName, repoName, &api.ListMergeRequestsParams{ After: after, @@ -341,9 +341,10 @@ func MergeRequestSpec(ctx context.Context, urlStr string) func(c convey.C) { convey.ShouldBeFalse((*result.JSON200).Pagination.HasMore) } else { convey.ShouldBeTrue((*result.JSON200).Pagination.HasMore) - next, err := time.Parse(`2006-01-02 15:04:05.999999999 -0700 MST`, (*result.JSON200).Pagination.NextOffset) + val, err := strconv.ParseInt((*result.JSON200).Pagination.NextOffset, 10, 64) convey.So(err, convey.ShouldBeNil) - after = &next + next := time.UnixMilli(val) + after = utils.Int64(next.UnixMilli()) } } }) diff --git a/integrationtest/repo_test.go b/integrationtest/repo_test.go index 9698c9e..dfcecfa 100644 --- a/integrationtest/repo_test.go +++ b/integrationtest/repo_test.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "net/http" - "time" "github.com/jiaozifs/jiaozifs/api" apiimpl "github.com/jiaozifs/jiaozifs/api/api_impl" @@ -147,7 +146,7 @@ func RepoSpec(ctx context.Context, urlStr string) func(c convey.C) { convey.So(len(listRepos.JSON200.Results), convey.ShouldEqual, 2) newResp, err := client.ListRepositoryOfAuthenticatedUser(ctx, &api.ListRepositoryOfAuthenticatedUserParams{ - After: utils.Time(listRepos.JSON200.Results[0].UpdatedAt), + After: utils.Int64(listRepos.JSON200.Results[0].UpdatedAt), Amount: utils.Int(1), }) convey.So(err, convey.ShouldBeNil) @@ -205,7 +204,7 @@ func RepoSpec(ctx context.Context, urlStr string) func(c convey.C) { convey.So(len(listRepos.JSON200.Results), convey.ShouldEqual, 2) newResp, err := client.ListRepository(ctx, userName, &api.ListRepositoryParams{ - After: utils.Time(listRepos.JSON200.Results[0].UpdatedAt), + After: utils.Int64(listRepos.JSON200.Results[0].UpdatedAt), Amount: utils.Int(1), }) convey.So(err, convey.ShouldBeNil) @@ -430,7 +429,7 @@ func RepoSpec(ctx context.Context, urlStr string) func(c convey.C) { convey.So((*result.JSON200)[0].Message, convey.ShouldEqual, "third commit") newResp, err := client.GetCommitsInRef(ctx, userName, repoName, &api.GetCommitsInRefParams{ - After: utils.String((*result.JSON200)[0].Committer.When.Format(time.RFC3339Nano)), + After: utils.Int64((*result.JSON200)[0].Committer.When), Amount: utils.Int(1), RefName: utils.String(controller.DefaultBranchName), }) @@ -442,15 +441,6 @@ func RepoSpec(ctx context.Context, urlStr string) func(c convey.C) { convey.So(*newResult.JSON200, convey.ShouldHaveLength, 1) convey.So((*newResult.JSON200)[0].Message, convey.ShouldEqual, "second commit") }) - - c.Convey("failed get commits by wrong params", func() { - resp, err := client.GetCommitsInRef(ctx, userName, repoName, &api.GetCommitsInRefParams{ - After: utils.String("123"), - RefName: utils.String(controller.DefaultBranchName), - }) - convey.So(err, convey.ShouldBeNil) - convey.So(resp.StatusCode, convey.ShouldEqual, http.StatusInternalServerError) - }) }) c.Convey("delete repository", func(c convey.C) { diff --git a/models/branch.go b/models/branch.go index 3032037..bb4580e 100644 --- a/models/branch.go +++ b/models/branch.go @@ -22,8 +22,8 @@ type Branch struct { // CreatorID who create this branch CreatorID uuid.UUID `bun:"creator_id,type:uuid,notnull" json:"creator_id"` - CreatedAt time.Time `bun:"created_at,notnull" json:"created_at"` - UpdatedAt time.Time `bun:"updated_at,notnull" json:"updated_at"` + CreatedAt time.Time `bun:"created_at,type:timestamp,notnull" json:"created_at"` + UpdatedAt time.Time `bun:"updated_at,type:timestamp,notnull" json:"updated_at"` } type GetBranchParams struct { diff --git a/models/commit.go b/models/commit.go index 43cdf79..8f1c6b0 100644 --- a/models/commit.go +++ b/models/commit.go @@ -39,8 +39,8 @@ type Commit struct { // ParentHashes are the hashes of the parent commits of the commit. ParentHashes []hash.Hash `bun:"parent_hashes,type:bytea[]" json:"parent_hashes"` - CreatedAt time.Time `bun:"created_at,notnull" json:"created_at"` - UpdatedAt time.Time `bun:"updated_at,notnull" json:"updated_at"` + CreatedAt time.Time `bun:"created_at,type:timestamp,notnull" json:"created_at"` + UpdatedAt time.Time `bun:"updated_at,type:timestamp,notnull" json:"updated_at"` } func (commit *Commit) GetHash() (hash.Hash, error) { diff --git a/models/merge_request.go b/models/merge_request.go index 6052fac..7e38f3a 100644 --- a/models/merge_request.go +++ b/models/merge_request.go @@ -31,8 +31,8 @@ type MergeRequest struct { AuthorID uuid.UUID `bun:"author_id,type:bytea,notnull" json:"author_id"` - CreatedAt time.Time `bun:"created_at,notnull" json:"created_at"` - UpdatedAt time.Time `bun:"updated_at,notnull" json:"updated_at"` + CreatedAt time.Time `bun:"created_at,type:timestamp,notnull" json:"created_at"` + UpdatedAt time.Time `bun:"updated_at,type:timestamp,notnull" json:"updated_at"` } type GetMergeRequestParams struct { diff --git a/models/repository.go b/models/repository.go index 80859c8..542bc55 100644 --- a/models/repository.go +++ b/models/repository.go @@ -23,8 +23,8 @@ type Repository struct { Description *string `bun:"description" json:"description,omitempty"` CreatorID uuid.UUID `bun:"creator_id,type:uuid,notnull" json:"creator_id"` - CreatedAt time.Time `bun:"created_at,notnull" json:"created_at"` - UpdatedAt time.Time `bun:"updated_at,notnull" json:"updated_at"` + CreatedAt time.Time `bun:"created_at,type:timestamp,notnull" json:"created_at"` + UpdatedAt time.Time `bun:"updated_at,type:timestamp,notnull" json:"updated_at"` } type GetRepoParams struct { diff --git a/models/tag.go b/models/tag.go index 97a4a74..f48454f 100644 --- a/models/tag.go +++ b/models/tag.go @@ -26,8 +26,8 @@ type Tag struct { // Message is the tag message, contains arbitrary text. Message string `bun:"message" json:"message"` - CreatedAt time.Time `bun:"created_at" json:"created_at"` - UpdatedAt time.Time `bun:"updated_at" json:"updated_at"` + CreatedAt time.Time `bun:"created_at,type:timestamp,notnull" json:"created_at"` + UpdatedAt time.Time `bun:"updated_at,type:timestamp,notnull" json:"updated_at"` } type ITagRepo interface { diff --git a/models/tree.go b/models/tree.go index 51f1f97..f0caf38 100644 --- a/models/tree.go +++ b/models/tree.go @@ -83,8 +83,8 @@ type Blob struct { Size int64 `bun:"size"` Properties Property `bun:"properties,type:jsonb,notnull"` - CreatedAt time.Time `bun:"created_at,notnull"` - UpdatedAt time.Time `bun:"updated_at,notnull"` + CreatedAt time.Time `bun:"created_at,type:timestamp,notnull"` + UpdatedAt time.Time `bun:"updated_at,type:timestamp,notnull"` } func NewBlob(props Property, repoID uuid.UUID, checkSum hash.Hash, size int64) (*Blob, error) { @@ -154,8 +154,8 @@ type TreeNode struct { SubObjects []TreeEntry `bun:"sub_objects,type:jsonb" json:"sub_objects"` Properties Property `bun:"properties,type:jsonb,notnull" json:"properties"` - CreatedAt time.Time `bun:"created_at,notnull" json:"created_at"` - UpdatedAt time.Time `bun:"updated_at,notnull" json:"updated_at"` + CreatedAt time.Time `bun:"created_at,type:timestamp,notnull" json:"created_at"` + UpdatedAt time.Time `bun:"updated_at,type:timestamp,notnull" json:"updated_at"` } func NewTreeNode(props Property, repoID uuid.UUID, subObjects ...TreeEntry) (*TreeNode, error) { diff --git a/models/user.go b/models/user.go index b51109f..9e2a395 100644 --- a/models/user.go +++ b/models/user.go @@ -14,12 +14,12 @@ type User struct { Name string `bun:"name,unique,notnull" json:"name"` Email string `bun:"email,unique,notnull" json:"email"` EncryptedPassword string `bun:"encrypted_password,notnull" json:"encrypted_password"` - CurrentSignInAt time.Time `bun:"current_sign_in_at" json:"current_sign_in_at"` - LastSignInAt time.Time `bun:"last_sign_in_at" json:"last_sign_in_at"` + CurrentSignInAt time.Time `bun:"current_sign_in_at,type:timestamp" json:"current_sign_in_at"` + LastSignInAt time.Time `bun:"last_sign_in_at,type:timestamp" json:"last_sign_in_at"` CurrentSignInIP string `bun:"current_sign_in_ip" json:"current_sign_in_ip"` LastSignInIP string `bun:"last_sign_in_ip" json:"last_sign_in_ip"` - CreatedAt time.Time `bun:"created_at,notnull" json:"created_at"` - UpdatedAt time.Time `bun:"updated_at,notnull" json:"updated_at"` + CreatedAt time.Time `bun:"created_at,type:timestamp,notnull" json:"created_at"` + UpdatedAt time.Time `bun:"updated_at,type:timestamp,notnull" json:"updated_at"` } type GetUserParams struct { diff --git a/models/wip.go b/models/wip.go index dc2e049..4c4f127 100644 --- a/models/wip.go +++ b/models/wip.go @@ -25,8 +25,8 @@ type WorkingInProcess struct { RefID uuid.UUID `bun:"ref_id,unique:creator_id_repository_id_ref_id_unique,type:uuid,notnull" json:"ref_id"` State WipState `bun:"state,notnull" json:"state"` CreatorID uuid.UUID `bun:"creator_id,unique:creator_id_repository_id_ref_id_unique,type:uuid,notnull" json:"creator_id"` - CreatedAt time.Time `bun:"created_at" json:"created_at"` - UpdatedAt time.Time `bun:"updated_at" json:"updated_at"` + CreatedAt time.Time `bun:"created_at,type:timestamp,notnull" json:"created_at"` + UpdatedAt time.Time `bun:"updated_at,type:timestamp,notnull" json:"updated_at"` } type GetWipParams struct { diff --git a/utils/pagination.go b/utils/pagination.go index 08190d4..c7bbf29 100644 --- a/utils/pagination.go +++ b/utils/pagination.go @@ -2,6 +2,7 @@ package utils import ( "reflect" + "strconv" "time" ) @@ -32,8 +33,10 @@ func PaginationFor(hasMore bool, results interface{}, fieldName string) PageMana if token.Type() == reflect.TypeOf(time.Time{}) { pagination.NextOffset = token.Interface().(time.Time).String() } + case reflect.Int64: + pagination.NextOffset = strconv.FormatInt(token.Int(), 10) case reflect.String: - pagination.NextOffset = token.Interface().(string) + pagination.NextOffset = token.String() } return pagination }