- Added videoWorkflowRepository with methods to manage video and user interactions. - Introduced catalog_mapper for converting database models to protobuf representations. - Created domain_helpers for normalizing domain and ad format values. - Defined service interfaces for payment, account, notification, domain, ad template, player config, video, and user management. - Implemented OAuth helpers for generating state and caching keys. - Developed payment_proto_helpers for mapping payment-related models to protobuf. - Added service policy helpers to enforce plan requirements and user permissions. - Created user_mapper for converting user payloads to protobuf format. - Implemented value_helpers for handling various value conversions and nil checks. - Developed video_helpers for normalizing video statuses and managing storage types. - Created video_mapper for mapping video models to protobuf format. - Implemented render workflow for managing video creation and job processing.
30 lines
747 B
Go
30 lines
747 B
Go
package service
|
|
|
|
import "strings"
|
|
|
|
func normalizeDomain(value string) string {
|
|
normalized := strings.TrimSpace(strings.ToLower(value))
|
|
normalized = strings.TrimPrefix(normalized, "https://")
|
|
normalized = strings.TrimPrefix(normalized, "http://")
|
|
normalized = strings.TrimPrefix(normalized, "www.")
|
|
normalized = strings.TrimSuffix(normalized, "/")
|
|
return normalized
|
|
}
|
|
|
|
func normalizeAdFormat(value string) string {
|
|
switch strings.TrimSpace(strings.ToLower(value)) {
|
|
case "mid-roll", "post-roll":
|
|
return strings.TrimSpace(strings.ToLower(value))
|
|
default:
|
|
return "pre-roll"
|
|
}
|
|
}
|
|
|
|
func adTemplateIsActive(value *bool) bool {
|
|
return value == nil || *value
|
|
}
|
|
|
|
func playerConfigIsActive(value *bool) bool {
|
|
return value == nil || *value
|
|
}
|