Skip to content

Commit 45dd28a

Browse files
joanagmaiaCopilot
andauthored
chore: optionally add organization logo via lfx serve api (CM-1102) (#4008)
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 49ea594 commit 45dd28a

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

backend/src/api/public/v1/organizations/createOrganization.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,22 @@ const bodySchema = z.object({
1313
name: z.string().trim().min(1),
1414
domain: z.string().trim().min(1),
1515
source: z.string().trim().min(1),
16+
logo: z.string().trim().min(1).optional(),
1617
})
1718

1819
export async function createOrganization(req: Request, res: Response): Promise<void> {
19-
const { name, domain, source } = validateOrThrow(bodySchema, req.body)
20+
const { name, domain, source, logo } = validateOrThrow(bodySchema, req.body)
2021

2122
const qx = optionsQx(req)
2223

2324
let organizationId: string | undefined
2425

2526
await qx.tx(async (tx) => {
26-
const orgSource = OrganizationAttributeSource.CUSTOM
27+
const orgSource = OrganizationAttributeSource.LFX_SERVE
2728

2829
organizationId = await findOrCreateOrganization(tx, orgSource, {
2930
displayName: name,
31+
logo,
3032
identities: [
3133
{
3234
value: domain,
@@ -59,5 +61,5 @@ export async function createOrganization(req: Request, res: Response): Promise<v
5961
)
6062
})
6163

62-
created(res, { id: organizationId, name })
64+
created(res, { id: organizationId, name, logo })
6365
}

services/libs/data-access-layer/src/organizations/attributesConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ export function findAttribute(name: string): OrgAttributeDef {
229229

230230
export const ORG_DB_ATTRIBUTE_SOURCE_PRIORITY = [
231231
OrganizationAttributeSource.CUSTOM,
232+
OrganizationAttributeSource.LFX_SERVE,
232233
OrganizationAttributeSource.ENRICHMENT_LFX_INTERNAL_API,
233234
OrganizationAttributeSource.ENRICHMENT_PEOPLEDATALABS,
234235
OrganizationAttributeSource.CVENT,

services/libs/types/src/enums/organizations.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export enum OrganizationIdentityType {
3939

4040
export enum OrganizationAttributeSource {
4141
CUSTOM = 'custom',
42+
LFX_SERVE = 'lfx-serve',
4243
ENRICHMENT_LFX_INTERNAL_API = 'enrichment-lfx-internal-api',
4344
ENRICHMENT_PEOPLEDATALABS = 'enrichment-peopledatalabs',
4445
CVENT = 'cvent',

0 commit comments

Comments
 (0)