robotAPI struct instead of robot struct
parent
2a637f3426
commit
6cb66ad400
|
@ -120,14 +120,28 @@ func FirstRequest(c *fiber.Ctx) error {
|
|||
func addRobotSSEMessage(newRobot *structs.Robot) {
|
||||
totalPages := cache.GetAllRobots(rspagination.PageQuery{Page: 1}).TotalPages
|
||||
|
||||
apiRobot := structs.APIRobot{
|
||||
Id: newRobot.Id,
|
||||
Type: newRobot.Type,
|
||||
Name: newRobot.Name,
|
||||
Status: newRobot.Status,
|
||||
Address: newRobot.Address,
|
||||
CurrentJobName: newRobot.CurrentJobName,
|
||||
JobsWaitingCount: newRobot.JobsWaitingCount,
|
||||
JobsWaitingNameList: []string{},
|
||||
FirmwareVersion: newRobot.FirmwareVersion,
|
||||
ConnectedAt: newRobot.ConnectedAt,
|
||||
CreatedAt: newRobot.CreatedAt,
|
||||
}
|
||||
|
||||
robot.BroadcastSSEMessage(structs.SSEMessage{
|
||||
Cmd: utils.SSESentCmdAddRobot,
|
||||
Body: struct {
|
||||
Robot *structs.Robot
|
||||
Robot *structs.APIRobot
|
||||
TotalPages int
|
||||
UnauthorizedRobotsTotalPages int
|
||||
}{
|
||||
Robot: newRobot,
|
||||
Robot: &apiRobot,
|
||||
TotalPages: totalPages,
|
||||
UnauthorizedRobotsTotalPages: cache.GetAllUnauthorizedRobots(rspagination.PageQuery{Page: 1}).TotalPages,
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue