package mappers import ( "apskel-pos-be/internal/entities" "apskel-pos-be/internal/models" ) func UserDeviceEntityToModel(entity *entities.UserDevice) *models.UserDevice { if entity == nil { return nil } return &models.UserDevice{ ID: entity.ID, UserID: entity.UserID, DeviceID: entity.DeviceID, DeviceName: entity.DeviceName, DeviceType: entity.DeviceType, Platform: entity.Platform, FCMToken: entity.FCMToken, AppVersion: entity.AppVersion, OsVersion: entity.OsVersion, IPAddress: entity.IPAddress, LastActiveAt: entity.LastActiveAt, CreatedAt: entity.CreatedAt, UpdatedAt: entity.UpdatedAt, } } func UserDeviceEntityToResponse(entity *entities.UserDevice) *models.UserDeviceResponse { if entity == nil { return nil } return &models.UserDeviceResponse{ ID: entity.ID, UserID: entity.UserID, DeviceID: entity.DeviceID, DeviceName: entity.DeviceName, DeviceType: entity.DeviceType, Platform: entity.Platform, FCMToken: entity.FCMToken, AppVersion: entity.AppVersion, OsVersion: entity.OsVersion, IPAddress: entity.IPAddress, LastActiveAt: entity.LastActiveAt, CreatedAt: entity.CreatedAt, UpdatedAt: entity.UpdatedAt, } } func UserDeviceEntitiesToResponses(entities []*entities.UserDevice) []*models.UserDeviceResponse { if entities == nil { return nil } responses := make([]*models.UserDeviceResponse, len(entities)) for i, entity := range entities { responses[i] = UserDeviceEntityToResponse(entity) } return responses }