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) {
|
func addRobotSSEMessage(newRobot *structs.Robot) {
|
||||||
totalPages := cache.GetAllRobots(rspagination.PageQuery{Page: 1}).TotalPages
|
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{
|
robot.BroadcastSSEMessage(structs.SSEMessage{
|
||||||
Cmd: utils.SSESentCmdAddRobot,
|
Cmd: utils.SSESentCmdAddRobot,
|
||||||
Body: struct {
|
Body: struct {
|
||||||
Robot *structs.Robot
|
Robot *structs.APIRobot
|
||||||
TotalPages int
|
TotalPages int
|
||||||
UnauthorizedRobotsTotalPages int
|
UnauthorizedRobotsTotalPages int
|
||||||
}{
|
}{
|
||||||
Robot: newRobot,
|
Robot: &apiRobot,
|
||||||
TotalPages: totalPages,
|
TotalPages: totalPages,
|
||||||
UnauthorizedRobotsTotalPages: cache.GetAllUnauthorizedRobots(rspagination.PageQuery{Page: 1}).TotalPages,
|
UnauthorizedRobotsTotalPages: cache.GetAllUnauthorizedRobots(rspagination.PageQuery{Page: 1}).TotalPages,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue