ultisuite-backend/internal/api/ultidraw/collab_room.go
R3D347HR4Y 0466a1c169
Some checks are pending
CI / Go tests (push) Waiting to run
CI / Integration tests (push) Waiting to run
CI / DB migrations (push) Waiting to run
wow
2026-06-11 01:22:52 +02:00

28 lines
917 B
Go

package ultidraw
import (
"context"
"fmt"
"strings"
)
func (s *Service) resolveCollabRoomID(ctx context.Context, ownerID, filePath string) (string, error) {
ownerID = strings.TrimSpace(ownerID)
filePath = normalizePath(filePath)
if ownerID == "" || filePath == "" {
return "", fmt.Errorf("collab room: missing owner or path")
}
if rev, err := s.nc.FileRevision(ctx, ownerID, filePath); err == nil && rev.FileID > 0 {
return fmt.Sprintf("draw:%s:%d", ownerID, rev.FileID), nil
}
return fmt.Sprintf("draw:%s:%s", ownerID, hashPath(filePath)), nil
}
func (s *Service) ownerPathForPublic(ctx context.Context, token, password, clientCanonical, displayName string) (ownerID, ownerPath string, err error) {
binding, err := s.nc.ResolvePublicShareBinding(ctx, token, password)
if err != nil {
return "", "", err
}
return binding.OwnerID, binding.OwnerPathForClient(clientCanonical, displayName), nil
}