goploy/ws/ProjectMessage.go
2020-09-04 09:36:23 +08:00

33 lines
764 B
Go

package ws
import (
"github.com/zhenorzz/goploy/model"
)
// ProjectMessage is publish project message struct
type ProjectMessage struct {
ProjectID int64 `json:"projectId"`
ProjectName string `json:"projectName"`
State uint8 `json:"state"`
Message string `json:"message"`
Ext interface{} `json:"ext"`
}
const (
ProjectFail = 0
GitCreate = 1
GitReset = 1
GitSwitchBranch = 2
GitClean = 3
GitCheckout = 4
GitPull = 5
AfterPullScript = 6
Rsync = 7
ProjectSuccess = 8
)
func (projectMessage ProjectMessage) canSendTo(client *Client) error {
_, err := model.Project{ID: projectMessage.ProjectID, UserID: client.UserInfo.ID}.GetUserProjectData()
return err
}