Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"constants.go",
"dto.go",
"tapd.go",
],
importpath = "go-common/app/admin/ep/tapd/model",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = ["//library/ecode:go_default_library"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,39 @@
package model
// pagination.
const (
DefaultPageSize = 5
DefaultPageNum = 1
)
// Hook URL Status element
const (
HookURLStatusEnable = 1
HookURLStatusDisable = 2
)
// HookEventStatusEnable
const (
HookEventStatusEnable = 1
HookEventStatusDisable = 2
)
// Event Event
type Event string
// event element
const (
StoryCreate Event = "story::create"
BugCreate = "bug::create"
TaskCreate = "task::create"
LaunchformCreate = "launchform::create"
StoryUpdate = "story::update"
BugUpdate = "bug::update"
TaskUpdate = "task::update"
LaunchformUpdate = "launchform::update"
StoryDelete = "story::delete"
BugDelete = "bug::delete"
TaskDelete = "task::delete"
)

View File

@@ -0,0 +1,36 @@
package model
import (
"time"
)
// HookUrl Hook Url.
type HookUrl struct {
ID int64 `json:"id" gorm:"auto_increment;primary_key;column:id"`
URL string `json:"url" gorm:"column:url"`
WorkspaceID int `json:"workspace_id" gorm:"column:workspace_id"`
Status int `json:"status" gorm:"column:status"`
UpdateBy string `json:"update_by" gorm:"column:update_by"`
CTime time.Time `json:"ctime" gorm:"column:ctime"`
UTime time.Time `json:"mtime" gorm:"column:mtime"`
}
// UrlEvent Url Event.
type UrlEvent struct {
ID int64 `json:"id" gorm:"auto_increment;primary_key;column:id"`
Event string `json:"event" gorm:"column:event"`
UrlID int64 `json:"url_id" gorm:"column:url_id"`
Status int `json:"status" gorm:"column:status"`
CTime time.Time `json:"ctime" gorm:"column:ctime"`
UTime time.Time `json:"mtime" gorm:"column:mtime"`
}
// EventLog Event Log.
type EventLog struct {
ID int64 `json:"id" gorm:"auto_increment;primary_key;column:id"`
Event string `json:"event" gorm:"column:event"`
WorkspaceID int `json:"workspace_id" gorm:"column:workspace_id"`
EventID int `json:"event_id" gorm:"column:event_id"`
CTime time.Time `json:"ctime" gorm:"column:ctime"`
UTime time.Time `json:"mtime" gorm:"column:mtime"`
}

View File

@@ -0,0 +1,77 @@
package model
import "go-common/library/ecode"
// Pagination Pagination.
type Pagination struct {
PageSize int `form:"page_size" json:"page_size"`
PageNum int `form:"page_num" json:"page_num"`
}
// Verify verify the value of pageNum and pageSize.
func (p *Pagination) Verify() error {
if p.PageNum < 0 {
return ecode.MerlinIllegalPageNumErr
} else if p.PageNum == 0 {
p.PageNum = DefaultPageNum
}
if p.PageSize < 0 {
return ecode.MerlinIllegalPageSizeErr
} else if p.PageSize == 0 {
p.PageSize = DefaultPageSize
}
return nil
}
// HookURLUpdateReq Hook URL Update Req.
type HookURLUpdateReq struct {
ID int64 `json:"id"`
URL string `json:"url"`
WorkspaceID int `json:"workspace_id"`
Status int `json:"status"`
Events []string `json:"events"`
}
// QueryHookURLReq Query Hook URL Req
type QueryHookURLReq struct {
Pagination
HookURLUpdateReq
UpdateBy string `json:"update_by"`
}
// QueryHookURLRep Query Hook URL Rep.
type QueryHookURLRep struct {
Pagination
Total int64 `json:"total"`
HookUrls []*HookUrl `json:"hook_urls"`
}
// EventRequest Event Request.
type EventRequest struct {
Event Event `json:"event"`
WorkspaceID string `json:"workspace_id"`
EventID string `json:"id"`
Created string `json:"created"`
Secret string `json:"secret"`
}
// EventCallBackRequest Event CallBack Request.
type EventCallBackRequest struct {
Code int `json:"code"`
Data interface{} `json:"data"`
}
// QueryEventLogReq Query Event Log Req
type QueryEventLogReq struct {
Pagination
Event Event `json:"event"`
WorkspaceID int `json:"workspace_id"`
EventID int `json:"id"`
}
// QueryEventLogRep Query Event Log Rep.
type QueryEventLogRep struct {
Pagination
Total int64 `json:"total"`
EventLogs []*EventLog `json:"event_logs"`
}