Files
yovision/Sense/server/app/sense/area/export_port.go
T

20 lines
476 B
Go

package area
import (
"context"
"fmt"
"sync/atomic"
)
var activeService atomic.Pointer[Service]
// ExportCurrent is a project-internal adapter port for a future versioned
// contract mapper. The internal Area type is not a shared Brain contract.
func ExportCurrent(ctx context.Context, deviceID string) ([]Area, error) {
service := activeService.Load()
if service == nil {
return nil, fmt.Errorf("area service is not ready")
}
return service.List(ctx, deviceID)
}