MCPcopy Create free account
hub / github.com/rilldata/rill / organizationToDTO

Method organizationToDTO

admin/server/organizations.go:1045–1103  ·  view source on GitHub ↗
(o *database.Organization, privileged bool)

Source from the content-addressed store, hash-verified

1043}
1044
1045func (s *Server) organizationToDTO(o *database.Organization, privileged bool) *adminv1.Organization {
1046 var logoURL string
1047 if o.LogoAssetID != nil {
1048 logoURL = s.admin.URLs.WithCustomDomain(o.CustomDomain).Asset(*o.LogoAssetID)
1049 }
1050
1051 var logoDarkURL string
1052 if o.LogoDarkAssetID != nil {
1053 logoDarkURL = s.admin.URLs.WithCustomDomain(o.CustomDomain).Asset(*o.LogoDarkAssetID)
1054 }
1055
1056 var faviconURL string
1057 if o.FaviconAssetID != nil {
1058 faviconURL = s.admin.URLs.WithCustomDomain(o.CustomDomain).Asset(*o.FaviconAssetID)
1059 }
1060
1061 var thumbnailURL string
1062 if o.ThumbnailAssetID != nil {
1063 thumbnailURL = s.admin.URLs.WithCustomDomain(o.CustomDomain).Asset(*o.ThumbnailAssetID)
1064 }
1065
1066 var defaultProjectRoleID string
1067 if o.DefaultProjectRoleID != nil {
1068 defaultProjectRoleID = *o.DefaultProjectRoleID
1069 }
1070
1071 res := &adminv1.Organization{
1072 Id: o.ID,
1073 Name: o.Name,
1074 DisplayName: o.DisplayName,
1075 Description: o.Description,
1076 LogoUrl: logoURL,
1077 LogoDarkUrl: logoDarkURL,
1078 FaviconUrl: faviconURL,
1079 ThumbnailUrl: thumbnailURL,
1080 CustomDomain: o.CustomDomain,
1081 DefaultProjectRoleId: defaultProjectRoleID,
1082 Quotas: &adminv1.OrganizationQuotas{
1083 Projects: int32(o.QuotaProjects),
1084 Deployments: int32(o.QuotaDeployments),
1085 SlotsTotal: int32(o.QuotaSlotsTotal),
1086 SlotsPerDeployment: int32(o.QuotaSlotsPerDeployment),
1087 OutstandingInvites: int32(o.QuotaOutstandingInvites),
1088 StorageLimitBytesPerDeployment: o.QuotaStorageLimitBytesPerDeployment,
1089 },
1090 CreatedOn: timestamppb.New(o.CreatedOn),
1091 UpdatedOn: timestamppb.New(o.UpdatedOn),
1092 }
1093
1094 if privileged {
1095 res.BillingCustomerId = o.BillingCustomerID
1096 res.PaymentCustomerId = o.PaymentCustomerID
1097 res.BillingEmail = o.BillingEmail
1098 res.BillingPlanName = o.BillingPlanName
1099 res.BillingPlanDisplayName = o.BillingPlanDisplayName
1100 }
1101
1102 return res

Calls 2

AssetMethod · 0.80
WithCustomDomainMethod · 0.80

Tested by

no test coverage detected