The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
v1.8.0 — Super partner flag and directory view (#24951)
Rashad Karanouhc5f12d7a44ff
diff --git a/packages/twenty-apps/internal/twenty-partners/package.json b/packages/twenty-apps/internal/twenty-partners/package.jsonindex 03fcfa203b1..b54b2a7ef58 100644--- a/packages/twenty-apps/internal/twenty-partners/package.json+++ b/packages/twenty-apps/internal/twenty-partners/package.json@@ -1,6 +1,6 @@{"name": "twenty-partners",- "version": "1.7.2",+ "version": "1.8.0","license": "MIT","engines": {"node": "^24.5.0",diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/__tests__/submit-partner-application.integration-test.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/__tests__/submit-partner-application.integration-test.tsindex ba6a9bdb9c5..b4de4507c6b 100644--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/__tests__/submit-partner-application.integration-test.ts+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/__tests__/submit-partner-application.integration-test.ts@@ -102,6 +102,7 @@ describe('submit-partner-application handler — upsert', () => {name: true,slug: true,validationStage: true,+ superPartner: true,partnerTier: true,company: { id: true, name: true },persons: { edges: { node: { id: true, name: { firstName: true, lastName: true }, emails: { primaryEmail: true } } } },@@ -111,6 +112,7 @@ describe('submit-partner-application handler — upsert', () => {expect(node?.name).toBe('YC Agency');expect(node?.slug).toBe('yc-agency');expect(node?.validationStage).toBe('APPLICATION');+ expect(node?.superPartner).toBe(false);expect(node?.partnerTier).toBe('NEW');expect(node?.company?.name).toBe('YC Agency');expect(node?.persons?.edges).toHaveLength(1);@@ -205,7 +207,7 @@ describe('submit-partner-application handler — upsert', () => {expect(node?.hourlyRate).toEqual({ amountMicros: 175_000_000, currencyCode: 'USD' });});- it('preserves staff-owned columns (validationStage) on resubmission', async () => {+ it('preserves staff-owned columns (validationStage, superPartner) on resubmission', async () => {const first = await handler(authedEvent(baseInput({ email: '[email protected]' })));await trackCreated(first);expect(first.ok).toBe(true);@@ -215,7 +217,7 @@ describe('submit-partner-application handler — upsert', () => {updatePartner: {__args: {id: first.partnerId,- data: { validationStage: 'VALIDATED' },+ data: { validationStage: 'VALIDATED', superPartner: true },},id: true,},@@ -229,11 +231,13 @@ describe('submit-partner-application handler — upsert', () => {partner: {__args: { filter: { id: { eq: second.partnerId } } },validationStage: true,+ superPartner: true,city: true,},});const node = partner.partner;expect(node?.validationStage).toBe('VALIDATED');+ expect(node?.superPartner).toBe(true);expect(node?.city).toBe('Berlin');});diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/mappers/build-partner-fields.mapper.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/mappers/build-partner-fields.mapper.tsindex b7770545c5e..689de985451 100644--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/mappers/build-partner-fields.mapper.ts+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/mappers/build-partner-fields.mapper.ts@@ -84,6 +84,7 @@ export function buildPartnerCreateData(...partnerFields,slug: slugify(input.companyName),validationStage: 'APPLICATION',+ superPartner: false,partnerTier: 'NEW',companyId,deploymentExpertise: deriveDeploymentExpertise(input.partnerScope) as CoreSchema.PartnerDeploymentExpertiseEnum[],diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/constants/partner-field-universal-identifiers.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/constants/partner-field-universal-identifiers.tsindex 752f4cd10cc..5e74fa61d7f 100644--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/constants/partner-field-universal-identifiers.ts+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/constants/partner-field-universal-identifiers.ts@@ -17,6 +17,9 @@ export const PARTNER_REGION_FIELD_UNIVERSAL_IDENTIFIER =export const PARTNER_TIER_FIELD_UNIVERSAL_IDENTIFIER ='d4fa6461-37b6-49ee-9181-dd482e74a70b';+export const PARTNER_SUPER_PARTNER_FIELD_UNIVERSAL_IDENTIFIER =+ '44cc91d2-5da1-4442-aa92-726124351029';+export const PARTNER_PROFILE_PICTURE_FILE_FIELD_UNIVERSAL_IDENTIFIER ='076b81f2-2398-4ece-a352-d7a6f6a89cae';diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/navigation-menu-items/super-partners.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/navigation-menu-items/super-partners.navigation-menu-item.tsnew file mode 100644index 00000000000..ef4fb927f2c--- /dev/null+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/navigation-menu-items/super-partners.navigation-menu-item.ts@@ -0,0 +1,12 @@+import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';++import { SUPER_PARTNERS_VIEW_UNIVERSAL_IDENTIFIER } from 'src/modules/partner/directory/views/super-partners.view';++export default defineNavigationMenuItem({+ universalIdentifier: 'f79c4981-c50a-47f7-8577-35eb46434eb7',+ type: NavigationMenuItemType.VIEW,+ icon: 'IconStar',+ position: 5,+ folderUniversalIdentifier: '857be3b5-82c6-45f7-b546-e20a8a97be8d',+ viewUniversalIdentifier: SUPER_PARTNERS_VIEW_UNIVERSAL_IDENTIFIER,+});diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/views/partner-record-page-fields.view.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/views/partner-record-page-fields.view.tsindex fe82cc13124..136f96bf40a 100644--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/views/partner-record-page-fields.view.ts+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/views/partner-record-page-fields.view.ts@@ -17,6 +17,7 @@ import {PARTNER_REGION_FIELD_UNIVERSAL_IDENTIFIER,PARTNER_SCOPE_FIELD_UNIVERSAL_IDENTIFIER,PARTNER_SKILLS_FIELD_UNIVERSAL_IDENTIFIER,+ PARTNER_SUPER_PARTNER_FIELD_UNIVERSAL_IDENTIFIER,PARTNER_TIER_FIELD_UNIVERSAL_IDENTIFIER,PARTNER_TWENTY_EXPERIENCE_FIELD_UNIVERSAL_IDENTIFIER,PARTNER_TWENTY_EXPERIENCE_NOTES_FIELD_UNIVERSAL_IDENTIFIER,@@ -46,6 +47,7 @@ export const PARTNER_RECORD_PAGE_FIELDS_VIEW_ID =// in the fields widget when an explicit view marks them visible — this is that view.// Validation Stage and Partner Tier stay listed for admins but are read-locked for// the Partner role (see partner.role.ts), so partners don't see them on My Profile.+// Super partner stays listed and is update-locked only: partners can see it, cannot set it.// Introduction is omitted here (marketplace bio lives on My Profile / public site);// Twenty experience fields are first-class for triage.export default defineView({@@ -223,16 +225,23 @@ export default defineView({position: 25,isVisible: true,},+ {+ universalIdentifier: '70a176f0-c1ff-40c2-ab88-95ad8f964d67',+ fieldMetadataUniversalIdentifier:+ PARTNER_SUPER_PARTNER_FIELD_UNIVERSAL_IDENTIFIER,+ position: 26,+ isVisible: true,+ },{universalIdentifier: 'ec1148d4-01ff-4128-9863-0ac42ea8eb47',fieldMetadataUniversalIdentifier: PARTNER_USER_ON_PARTNER_FIELD_ID,- position: 26,+ position: 27,isVisible: true,},{universalIdentifier: '3ec293a1-da90-4104-a22e-771c0059e9b5',fieldMetadataUniversalIdentifier: PARTNER_COMPANY_FIELD_ID,- position: 27,+ position: 28,isVisible: true,},],diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/views/super-partners.view.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/views/super-partners.view.tsnew file mode 100644index 00000000000..cddb08fd19e--- /dev/null+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/views/super-partners.view.ts@@ -0,0 +1,86 @@+import { ViewFilterOperand, ViewType, defineView } from 'twenty-sdk/define';++import {+ PARTNER_AVAILABILITY_FIELD_UNIVERSAL_IDENTIFIER,+ PARTNER_NAME_FIELD_UNIVERSAL_IDENTIFIER,+ PARTNER_REGION_FIELD_UNIVERSAL_IDENTIFIER,+ PARTNER_SCOPE_FIELD_UNIVERSAL_IDENTIFIER,+ PARTNER_SUPER_PARTNER_FIELD_UNIVERSAL_IDENTIFIER,+ PARTNER_TIER_FIELD_UNIVERSAL_IDENTIFIER,+} from 'src/modules/partner/constants/partner-field-universal-identifiers';+import { PARTNER_OBJECT_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';+import { PARTNER_USER_ON_PARTNER_FIELD_ID } from 'src/modules/partner/fields/partner-user-on-partner.field';++export const SUPER_PARTNERS_VIEW_UNIVERSAL_IDENTIFIER =+ 'e46cac46-8447-463f-8e8d-51c5eed15740';++export default defineView({+ universalIdentifier: SUPER_PARTNERS_VIEW_UNIVERSAL_IDENTIFIER,+ name: 'Super partners',+ icon: 'IconStar',+ objectUniversalIdentifier: PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,+ type: ViewType.TABLE,+ position: 4,+ fields: [+ {+ universalIdentifier: '9498fd34-4a80-4458-af20-476150ffbec8',+ fieldMetadataUniversalIdentifier: PARTNER_NAME_FIELD_UNIVERSAL_IDENTIFIER,+ position: 0,+ isVisible: true,+ size: 200,+ },+ {+ universalIdentifier: 'f2820fb1-a578-44ce-872c-f8df3470f777',+ fieldMetadataUniversalIdentifier:+ PARTNER_SUPER_PARTNER_FIELD_UNIVERSAL_IDENTIFIER,+ position: 1,+ isVisible: true,+ size: 90,+ },+ {+ universalIdentifier: 'b947351a-a461-4bc3-a7a9-25e6f0fdd551',+ fieldMetadataUniversalIdentifier: PARTNER_TIER_FIELD_UNIVERSAL_IDENTIFIER,+ position: 2,+ isVisible: true,+ },+ {+ universalIdentifier: '4ca37446-0d4b-4dd2-b964-b431ef4e5e48',+ fieldMetadataUniversalIdentifier:+ PARTNER_AVAILABILITY_FIELD_UNIVERSAL_IDENTIFIER,+ position: 3,+ isVisible: true,+ },+ {+ universalIdentifier: '83e5d3e6-38c3-4f56-adeb-2265ec61201f',+ fieldMetadataUniversalIdentifier: PARTNER_SCOPE_FIELD_UNIVERSAL_IDENTIFIER,+ position: 4,+ isVisible: true,+ size: 200,+ },+ {+ universalIdentifier: '98de8562-2d00-4965-8963-872d4e5cdff9',+ fieldMetadataUniversalIdentifier: PARTNER_REGION_FIELD_UNIVERSAL_IDENTIFIER,+ position: 5,+ isVisible: true,+ size: 200,+ },+ {+ universalIdentifier: '3b653e5e-538d-4380-a144-c348b3a01523',+ fieldMetadataUniversalIdentifier: PARTNER_USER_ON_PARTNER_FIELD_ID,+ position: 6,+ isVisible: true,+ size: 200,+ },+ ],+ filters: [+ // BOOLEAN fields use ViewFilterOperand.IS with the string value 'true' —+ // the same representation the Twenty frontend stores and reads for boolean IS filters.+ {+ universalIdentifier: '783d033a-935b-4a75-bb5a-d578a5aa6d22',+ fieldMetadataUniversalIdentifier:+ PARTNER_SUPER_PARTNER_FIELD_UNIVERSAL_IDENTIFIER,+ operand: ViewFilterOperand.IS,+ value: 'true',+ },+ ],+});diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/__tests__/marketplace-api.integration-test.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/__tests__/marketplace-api.integration-test.tsindex f0b11e84dc3..be655ecfea5 100644--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/__tests__/marketplace-api.integration-test.ts+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/__tests__/marketplace-api.integration-test.ts@@ -16,6 +16,7 @@ async function ensureMarketplacePartnerExists(): Promise<void> {id: true,validationStage: true,availability: true,+ superPartner: true,},},},@@ -26,7 +27,8 @@ async function ensureMarketplacePartnerExists(): Promise<void> {if (node) {if (node.validationStage === 'VALIDATED' &&- node.availability === 'AVAILABLE'+ node.availability === 'AVAILABLE' &&+ node.superPartner === true) {return;}@@ -38,6 +40,7 @@ async function ensureMarketplacePartnerExists(): Promise<void> {data: {validationStage: 'VALIDATED',availability: 'AVAILABLE',+ superPartner: true,},},id: true,@@ -58,6 +61,7 @@ async function ensureMarketplacePartnerExists(): Promise<void> {calendarLink: { primaryLinkUrl: 'https://calendly.com/placeholder' },validationStage: 'VALIDATED',availability: 'AVAILABLE',+ superPartner: true,},},id: true,@@ -96,6 +100,7 @@ describe('list-available-partners handler', () => {expect(['ADVANCED', 'INTERMEDIATE', 'NEW', null]).toContain(partner.partnerTier,);+ expect(partner.superPartner).toBe(true);expect(partner.serviceCount).toBeGreaterThanOrEqual(0);expect(partner.approvedCaseStudyCount).toBeGreaterThanOrEqual(0);expect(partner.approvedCaseStudyWithCoverCount).toBeLessThanOrEqual(@@ -131,6 +136,7 @@ describe('get-partner-by-slug handler', () => {const { partner } = result;expect(partner.slug).toBe(KNOWN_SLUG);expect(partner.introduction.length).toBeGreaterThan(0);+ expect(partner.superPartner).toBe(true);expect('projectBudgetTypical' in partner).toBe(true);expect(Array.isArray(partner.profileLinks)).toBe(true);expect(Array.isArray(partner.services)).toBe(true);diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/graphql/queries/get-partner-by-slug.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/graphql/queries/get-partner-by-slug.tsindex 53b4e137928..3105698fd12 100644--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/graphql/queries/get-partner-by-slug.ts+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/graphql/queries/get-partner-by-slug.ts@@ -18,6 +18,7 @@ export const queryPartnerBySlug = (client: CoreApiClient, slug: string) =>id: true,name: true,slug: true,+ superPartner: true,introduction: true,languagesSpoken: true,deploymentExpertise: true,diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/graphql/queries/list-available-partners.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/graphql/queries/list-available-partners.tsindex 1b44ca10571..2ca9421d4dd 100644--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/graphql/queries/list-available-partners.ts+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/graphql/queries/list-available-partners.ts@@ -25,6 +25,7 @@ export const queryAvailablePartners = (client: CoreApiClient) =>languagesSpoken: true,deploymentExpertise: true,partnerTier: true,+ superPartner: true,partnerScope: true,region: true,calendarLink: { primaryLinkUrl: true },diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/mappers/map-partner-for-marketplace.mapper.test.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/mappers/map-partner-for-marketplace.mapper.test.tsindex 9363426e539..4d30c3d3b46 100644--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/mappers/map-partner-for-marketplace.mapper.test.ts+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/mappers/map-partner-for-marketplace.mapper.test.ts@@ -20,6 +20,7 @@ const makeNode = () => ({skills: ['Salesforce', 'HubSpot'],city: 'Paris',country: 'France',+ superPartner: false,partnerLinks: {edges: [] as Array<{node: {@@ -287,4 +288,19 @@ describe('mapPartnerForMarketplace', () => {},]);});++ it('copies superPartner onto list and profile payloads', () => {+ const node = makeNode();+ node.superPartner = true;++ expect(mapPartnerForMarketplace(node, 'list').superPartner).toBe(true);+ expect(mapPartnerForMarketplace(node, 'profile').superPartner).toBe(true);+ });++ it('coerces a missing superPartner to false', () => {+ const node = makeNode();+ delete (node as { superPartner?: boolean }).superPartner;++ expect(mapPartnerForMarketplace(node, 'list').superPartner).toBe(false);+ });});diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/mappers/map-partner-for-marketplace.mapper.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/mappers/map-partner-for-marketplace.mapper.tsindex 0939ac249e3..872d5c09fe8 100644--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/mappers/map-partner-for-marketplace.mapper.ts+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/mappers/map-partner-for-marketplace.mapper.ts@@ -63,6 +63,7 @@ export type PartnerMarketplaceQueryNode = {skills: string[] | null;city: string | null;country: string | null;+ superPartner?: boolean | null;partnerLinks?: { edges: ReadonlyArray<PartnerLinkEdge> } | null;partnerServices?: { edges: ReadonlyArray<PartnerServiceEdge> } | null;partnerContents?: { edges: ReadonlyArray<PartnerContentEdge> } | null;@@ -85,6 +86,7 @@ export type MarketplaceListPartner = {skills: string[] | null;city: string | null;country: string | null;+ superPartner: boolean;};export type MarketplaceProfilePartner = MarketplaceListPartner & {@@ -240,6 +242,7 @@ const mapBasePartner = (skills: node.skills,city: node.city,country: node.country,+ superPartner: node.superPartner === true,});export function mapPartnerForMarketplace(diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/services/list-available-partners.service.test.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/services/list-available-partners.service.test.tsindex 4c33c4ac917..6f33eb260ae 100644--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/services/list-available-partners.service.test.ts+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/services/list-available-partners.service.test.ts@@ -33,6 +33,7 @@ describe('listAvailablePartners', () => {languagesSpoken: ['ENGLISH'],deploymentExpertise: ['CLOUD'],partnerTier: 'ADVANCED',+ superPartner: true,partnerScope: ['SOLUTIONING'],region: ['EUROPE'],calendarLink: { primaryLinkUrl: 'https://cal.example.com/acme' },@@ -108,6 +109,7 @@ describe('listAvailablePartners', () => {expect(result.partners[0]).toMatchObject({partnerTier: 'ADVANCED',+ superPartner: true,serviceCount: 2,approvedCaseStudyCount: 3,approvedCaseStudyWithCoverCount: 2,@@ -129,6 +131,7 @@ describe('listAvailablePartners', () => {languagesSpoken: [],deploymentExpertise: [],partnerTier: null,+ superPartner: false,partnerScope: [],region: [],calendarLink: { primaryLinkUrl: null },@@ -156,6 +159,7 @@ describe('listAvailablePartners', () => {expect(result.partners[0]).toMatchObject({partnerTier: null,+ superPartner: false,serviceCount: 0,approvedCaseStudyCount: 0,approvedCaseStudyWithCoverCount: 0,diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/objects/partner.object.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/objects/partner.object.tsindex 107b58ad64d..8cca386eea5 100644--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/objects/partner.object.ts+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/objects/partner.object.ts@@ -44,6 +44,16 @@ export default defineObject({{ id: '19dc4929-735a-4b64-8f57-f34f3eaa3a73', value: 'REJECTED', label: 'Rejected', position: 4, color: 'red' },],},+ {+ universalIdentifier: '44cc91d2-5da1-4442-aa92-726124351029',+ type: FieldType.BOOLEAN,+ name: 'superPartner',+ label: 'Super partner',+ description:+ 'Admin-only trust flag. Pins the partner at the top of the public marketplace. Partners cannot set this.',+ icon: 'IconStar',+ defaultValue: false,+ },{universalIdentifier: 'd4fa6461-37b6-49ee-9181-dd482e74a70b',type: FieldType.SELECT,diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/self-service/mappers/save-my-partner-profile.mapper.test.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/self-service/mappers/save-my-partner-profile.mapper.test.tsindex 29b5c40f6c8..dbb4e6eb688 100644--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/self-service/mappers/save-my-partner-profile.mapper.test.ts+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/self-service/mappers/save-my-partner-profile.mapper.test.ts@@ -26,6 +26,11 @@ describe('saveProfileSchema', () => {expect(parsed.success).toBe(false);});+ it('rejects an unknown key (superPartner)', () => {+ const parsed = saveProfileSchema.safeParse({ superPartner: true });+ expect(parsed.success).toBe(false);+ });+it('rejects a malformed url', () => {const parsed = saveProfileSchema.safeParse({ website: 'not-a-url' });expect(parsed.success).toBe(false);diff --git a/packages/twenty-apps/internal/twenty-partners/src/roles/partner.role.ts b/packages/twenty-apps/internal/twenty-partners/src/roles/partner.role.tsindex 43dabfbc2fa..90ade5cc1a5 100644--- a/packages/twenty-apps/internal/twenty-partners/src/roles/partner.role.ts+++ b/packages/twenty-apps/internal/twenty-partners/src/roles/partner.role.ts@@ -12,6 +12,7 @@ import {PARTNER_ROLE_UNIVERSAL_IDENTIFIER,PARTNER_SERVICE_OBJECT_UNIVERSAL_IDENTIFIER,} from 'src/constants/universal-identifiers';+import { PARTNER_SUPER_PARTNER_FIELD_UNIVERSAL_IDENTIFIER } from 'src/modules/partner/constants/partner-field-universal-identifiers';import {APPLICATION_NAME_FIELD_ID,APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,@@ -309,6 +310,12 @@ export default defineRole({canReadFieldValue: false,canUpdateFieldValue: false,},+ {+ // Super partner — listed on the record page; partners can see it, cannot set it.+ objectUniversalIdentifier: PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,+ fieldUniversalIdentifier: PARTNER_SUPER_PARTNER_FIELD_UNIVERSAL_IDENTIFIER,+ canUpdateFieldValue: false,+ },{// Partner Tier — read-locked too: admin-only on the record page, hidden from partners.objectUniversalIdentifier: PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,diff --git a/packages/twenty-apps/internal/twenty-partners/src/scripts/seed.ts b/packages/twenty-apps/internal/twenty-partners/src/scripts/seed.tsindex 5804f414444..f13572e775b 100644--- a/packages/twenty-apps/internal/twenty-partners/src/scripts/seed.ts+++ b/packages/twenty-apps/internal/twenty-partners/src/scripts/seed.ts@@ -79,6 +79,36 @@ Meridian Craft is an **APAC implementation studio** for fintech and logistics opOur senior engineers have shipped regulated workloads across Singapore, Hong Kong, and Kuala Lumpur — we know where CRM projects break at scale.`;+const W3VILLA_DESCRIPTION_MARKDOWN = `## About W3Villa Technologies++W3Villa runs **large self-hosted Twenty deployments** for regulated industries across APAC and the Gulf. The team owns Kubernetes hardening, custom integrations, and 24/7 support contracts.++### What we typically deliver++- Hardened self-host installs with backup, observability, and upgrade runbooks+- Custom integrations against finance, identity, and internal APIs+- Follow-the-sun support for production workspaces++### Why clients pick us++We treat Twenty as infrastructure, not a weekend project. Clients stay on a version they can patch, with a team that answers when the cluster pages.`;++const NETZERO_DESCRIPTION_MARKDOWN = `## About NetZero Systems++NetZero is the **LATAM go-to-market partner** for climate-tech and renewable-energy companies. We build bilingual sales pipelines, ESG reporting, and grant-management workflows on Twenty.++### Typical engagement++1. **GTM map** — bilingual objects, stages, and handoffs for US + LATAM teams+2. **Reporting layer** — ESG and grant evidence without a second spreadsheet stack+3. **Handoff** — playbooks your local operators keep after go-live++### Focus areas++- Climate tech and renewable energy+- Spanish / Portuguese / English workspaces+- Grant and compliance tracking next to the pipeline`;+type DemoPartnerService = {title: string;description: string;@@ -180,6 +210,200 @@ const PRIMARY_DEMO_PARTNER_LINKS: DemoPartnerLink[] = [},];+type MarketplaceProfile = {+ introduction: string;+ services: DemoPartnerService[];+ caseStudies: DemoPartnerContent[];+ links: DemoPartnerLink[];+};++const MARKETPLACE_PROFILES: Record<string, MarketplaceProfile> = {+ 'nine-dots-ventures': {+ introduction: PRIMARY_DEMO_DESCRIPTION_MARKDOWN,+ services: PRIMARY_DEMO_PARTNER_SERVICES,+ caseStudies: PRIMARY_DEMO_PARTNER_CASE_STUDIES,+ links: PRIMARY_DEMO_PARTNER_LINKS,+ },+ 'elevate-consulting': {+ introduction: ELEVATE_DESCRIPTION_MARKDOWN,+ services: [+ {+ title: 'Revenue operations audit',+ description:+ 'Maps objects, stages, and reporting gaps across sales, CS, and finance before any migration starts.',+ position: 0,+ },+ {+ title: 'CRM migration sprint',+ description:+ 'Four-week Salesforce or HubSpot cutover with dedupe rules and activity history preserved.',+ position: 1,+ },+ {+ title: 'Forecast and reporting handoff',+ description:+ 'Manager dashboards, forecast cadences, and playbooks the GTM team owns after go-live.',+ position: 2,+ },+ ],+ caseStudies: [+ {+ name: 'Elevate - Acme RE rollout',+ status: 'APPROVED',+ clientName: 'Acme Real Estate',+ headline: 'Salesforce to Twenty in four weeks, reps still selling',+ bodyMarkdown:+ 'Rebuilt the pipeline and cut over 30 seats without a freeze weekend. Forecast lag dropped from days to same-day.',+ caseStudyUrl: 'https://elevate-consulting.example/case-studies/acme',+ position: 0,+ },+ {+ name: 'Elevate - Helix pipeline',+ status: 'APPROVED',+ clientName: 'Helix Bio',+ headline: 'One lifecycle from inbound to renewal',+ bodyMarkdown:+ 'Collapsed three HubSpot pipelines into a single Twenty opportunity flow with CS handoff SLAs.',+ caseStudyUrl: 'https://elevate-consulting.example/case-studies/helix',+ position: 1,+ },+ ],+ links: [+ {+ name: 'Company website',+ url: 'https://elevate-consulting.example',+ position: 0,+ },+ ],+ },+ 'meridian-craft': {+ introduction: MERIDIAN_DESCRIPTION_MARKDOWN,+ services: [+ {+ title: 'High-throughput data models',+ description:+ 'Multi-entity models with strict permission boundaries for fintech and logistics operators.',+ position: 0,+ },+ {+ title: 'Banking and carrier integrations',+ description:+ 'Custom apps against KYC, banking, and carrier APIs on cloud or self-hosted Twenty.',+ position: 1,+ },+ {+ title: 'Self-host performance tuning',+ description:+ 'Throughput baselines, runbooks, and on-call handoff for regulated APAC workloads.',+ position: 2,+ },+ ],+ caseStudies: [+ {+ name: 'Meridian - Sunrise APAC fleet',+ status: 'APPROVED',+ clientName: 'Sunrise Logistics',+ headline: 'Fleet CRM that keeps regional handoffs in one timeline',+ bodyMarkdown:+ 'Rebuilt qualification and renewal so APAC and LATAM teams share one opportunity record at volume.',+ caseStudyUrl: 'https://meridian-craft.example/case-studies/sunrise',+ position: 0,+ },+ ],+ links: [+ {+ name: 'Company website',+ url: 'https://meridian-craft.example',+ position: 0,+ },+ ],+ },+ 'w3villa-technologies': {+ introduction: W3VILLA_DESCRIPTION_MARKDOWN,+ services: [+ {+ title: 'Kubernetes self-host',+ description:+ 'Hardened Twenty installs with backup, observability, and upgrade runbooks.',+ position: 0,+ },+ {+ title: 'Custom integrations',+ description:+ 'Finance, identity, and internal API connectors built for regulated tenants.',+ position: 1,+ },+ {+ title: 'Enterprise support',+ description:+ '24/7 follow-the-sun coverage for production workspaces in APAC and the Gulf.',+ position: 2,+ },+ ],+ caseStudies: [+ {+ name: 'W3Villa - Acme annual review',+ status: 'APPROVED',+ clientName: 'Acme Real Estate',+ headline: 'Self-host cutover with zero lost history',+ bodyMarkdown:+ 'Moved a production workspace onto hardened Kubernetes and kept activity history intact through the upgrade.',+ caseStudyUrl: 'https://w3villa-technologies.example/case-studies/acme',+ position: 0,+ },+ ],+ links: [+ {+ name: 'Company website',+ url: 'https://w3villa-technologies.example',+ position: 0,+ },+ ],+ },+ 'netzero-systems': {+ introduction: NETZERO_DESCRIPTION_MARKDOWN,+ services: [+ {+ title: 'Bilingual GTM pipelines',+ description:+ 'Spanish, Portuguese, and English objects and stages for US + LATAM teams.',+ position: 0,+ },+ {+ title: 'ESG reporting',+ description:+ 'Grant and compliance evidence next to the pipeline, without a second spreadsheet stack.',+ position: 1,+ },+ {+ title: 'Climate-tech go-to-market',+ description:+ 'Playbooks for renewable-energy and climate operators from first lead to grant close.',+ position: 2,+ },+ ],+ caseStudies: [+ {+ name: 'NetZero - Helix clinical',+ status: 'APPROVED',+ clientName: 'Helix Bio',+ headline: 'Bilingual pipeline with grant evidence in one workspace',+ bodyMarkdown:+ 'US and LATAM teams now share one opportunity timeline, with ESG fields the board can export.',+ caseStudyUrl: 'https://netzero-systems.example/case-studies/helix',+ position: 0,+ },+ ],+ links: [+ {+ name: 'Company website',+ url: 'https://netzero-systems.example',+ position: 0,+ },+ ],+ },+};+const usd = (dollars: number) => ({amountMicros: dollars * 1_000_000,currencyCode: 'USD',@@ -205,15 +429,16 @@ type Partner = {hourlyRateUsd: number | null;projectBudgetMinUsd: number | null;skills: string[];+ superPartner?: boolean;};const PARTNERS: Partner[] = [- { slug: 'nine-dots-ventures', name: 'Nine Dots Ventures', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'Boutique CRM implementer for real-estate workflows and WhatsApp automation. Nine Dots runs end-to-end Twenty rollouts for property managers and brokerages across Europe and MENA, with deep multi-language data models and AI-assisted lead intake.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['EUROPE', 'MENA'], languagesSpoken: ['ENGLISH', 'FRENCH', 'ARABIC'], partnerTier: 'ADVANCED', partnerScope: ['SOLUTIONING', 'DEVELOPMENT'], typeOfTeam: 'AGENCY', country: 'FRANCE', city: 'Paris', hourlyRateUsd: 250, projectBudgetMinUsd: 15000, skills: ['Real estate', 'WhatsApp', 'Multi-language', 'Workflows', 'Integrations', 'AI'] },+ { slug: 'nine-dots-ventures', name: 'Nine Dots Ventures', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'Boutique CRM implementer for real-estate workflows and WhatsApp automation. Nine Dots runs end-to-end Twenty rollouts for property managers and brokerages across Europe and MENA, with deep multi-language data models and AI-assisted lead intake.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['EUROPE', 'MENA'], languagesSpoken: ['ENGLISH', 'FRENCH', 'ARABIC'], partnerTier: 'ADVANCED', partnerScope: ['SOLUTIONING', 'DEVELOPMENT'], typeOfTeam: 'AGENCY', country: 'FRANCE', city: 'Paris', hourlyRateUsd: 250, projectBudgetMinUsd: 15000, skills: ['Real estate', 'WhatsApp', 'Multi-language', 'Workflows', 'Integrations', 'AI'], superPartner: true },{ slug: 'elevate-consulting', name: 'Elevate Consulting', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'Revenue-operations partner for B2B SaaS teams scaling seed to Series C. Elevate moves teams off legacy CRMs onto Twenty with a four-week migration playbook, pipeline rebuilds, and analytics handoff.', calendarLink: CAL, deploymentExpertise: ['CLOUD'], region: ['US', 'LATAM'], languagesSpoken: ['ENGLISH', 'SPANISH'], partnerTier: 'INTERMEDIATE', partnerScope: ['SOLUTIONING'], typeOfTeam: 'AGENCY', country: 'UNITED_STATES', city: 'Austin', hourlyRateUsd: 200, projectBudgetMinUsd: 20000, skills: ['RevOps', 'B2B SaaS', 'Data migration', 'Pipelines', 'Salesforce migration', 'HubSpot migration'] },{ slug: 'w3villa-technologies', name: 'W3Villa Technologies', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'Engineering-heavy partner running large self-hosted Twenty deployments. Specializes in hardened Kubernetes hosting, custom integrations, and 24/7 support contracts for regulated industries across APAC and the Gulf.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['APAC', 'MENA'], languagesSpoken: ['ENGLISH', 'HINDI'], partnerTier: 'ADVANCED', partnerScope: ['HOSTING', 'DEVELOPMENT', 'SOLUTIONING'], typeOfTeam: 'AGENCY', country: 'INDIA', city: 'Bangalore', hourlyRateUsd: 120, projectBudgetMinUsd: 10000, skills: ['Self-hosting', 'Kubernetes', 'DevOps', 'Integrations', 'Workflows', 'Enterprise support'] },{ slug: 'act-education', name: 'Act Education', validationStage: 'VALIDATED', availability: 'UNAVAILABLE', introduction: 'CRM partner for European education providers; compliance-first self-hosting on EU infrastructure with full GDPR data residency and student-record workflows.', calendarLink: CAL, deploymentExpertise: ['SELF_HOST'], region: ['EUROPE'], languagesSpoken: ['ENGLISH', 'GERMAN'], partnerTier: 'NEW', partnerScope: ['HOSTING', 'SOLUTIONING'], typeOfTeam: 'SOLO', country: 'GERMANY', city: 'Berlin', hourlyRateUsd: 180, projectBudgetMinUsd: 8000, skills: ['Education', 'Compliance', 'Self-hosting', 'GDPR', 'Data privacy'] },{ slug: 'netzero-systems', name: 'NetZero Systems', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'LATAM go-to-market partner for climate-tech and renewable-energy companies. Builds bilingual sales pipelines, ESG reporting, and grant-management workflows on top of Twenty.', calendarLink: CAL, deploymentExpertise: ['CLOUD'], region: ['LATAM', 'US'], languagesSpoken: ['ENGLISH', 'SPANISH', 'PORTUGUESE'], partnerTier: 'INTERMEDIATE', partnerScope: ['SOLUTIONING'], typeOfTeam: 'AGENCY', country: 'BRAZIL', city: 'São Paulo', hourlyRateUsd: 150, projectBudgetMinUsd: 12000, skills: ['Climate tech', 'Renewable energy', 'ESG reporting', 'Bilingual pipelines', 'LATAM go-to-market'] },- { slug: 'meridian-craft', name: 'Meridian Craft', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'APAC implementation studio for fintech and logistics. Senior team of ex-bank engineers building high-throughput Twenty deployments across Singapore, Hong Kong, and Kuala Lumpur.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['APAC', 'AFRICA'], languagesSpoken: ['ENGLISH', 'CHINESE', 'MALAY'], partnerTier: 'ADVANCED', partnerScope: ['DEVELOPMENT', 'SOLUTIONING'], typeOfTeam: 'AGENCY', country: 'SINGAPORE', city: 'Singapore', hourlyRateUsd: 300, projectBudgetMinUsd: 25000, skills: ['Fintech', 'Logistics', 'APAC', 'High throughput', 'Custom apps', 'Performance tuning'] },+ { slug: 'meridian-craft', name: 'Meridian Craft', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'APAC implementation studio for fintech and logistics. Senior team of ex-bank engineers building high-throughput Twenty deployments across Singapore, Hong Kong, and Kuala Lumpur.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['APAC', 'AFRICA'], languagesSpoken: ['ENGLISH', 'CHINESE', 'MALAY'], partnerTier: 'ADVANCED', partnerScope: ['DEVELOPMENT', 'SOLUTIONING'], typeOfTeam: 'AGENCY', country: 'SINGAPORE', city: 'Singapore', hourlyRateUsd: 300, projectBudgetMinUsd: 25000, skills: ['Fintech', 'Logistics', 'APAC', 'High throughput', 'Custom apps', 'Performance tuning'], superPartner: true },{ slug: 'applicant-studio', name: 'Applicant Studio', validationStage: 'APPLICATION', availability: 'UNAVAILABLE', introduction: 'New applicant; awaiting first review.', calendarLink: CAL, deploymentExpertise: ['CLOUD'], region: ['EUROPE'], languagesSpoken: ['ENGLISH', 'FRENCH'], partnerTier: 'NEW', partnerScope: ['SOLUTIONING'], typeOfTeam: 'SOLO', country: 'FRANCE', city: 'Lyon', hourlyRateUsd: null, projectBudgetMinUsd: null, skills: ['Boutique', 'Design'] },{ slug: 'rising-crm', name: 'Rising CRM', validationStage: 'POTENTIAL', availability: 'AVAILABLE', introduction: 'Promising applicant in evaluation.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['US'], languagesSpoken: ['ENGLISH'], partnerTier: 'NEW', partnerScope: ['SOLUTIONING', 'DEVELOPMENT'], typeOfTeam: 'AGENCY', country: 'UNITED_STATES', city: 'New York', hourlyRateUsd: null, projectBudgetMinUsd: null, skills: ['SMB', 'Quick setup'] },{ slug: 'legacy-partners', name: 'Legacy Partners', validationStage: 'FORMER', availability: 'UNAVAILABLE', introduction: 'Former partner; no longer active in the program.', calendarLink: CAL, deploymentExpertise: ['SELF_HOST'], region: ['EUROPE'], languagesSpoken: ['ENGLISH', 'GERMAN'], partnerTier: 'INTERMEDIATE', partnerScope: ['HOSTING'], typeOfTeam: 'AGENCY', country: 'UNITED_KINGDOM', city: 'London', hourlyRateUsd: null, projectBudgetMinUsd: null, skills: ['Enterprise', 'Self-hosting'] },@@ -303,6 +528,162 @@ async function upsertCompanyByName(return r.createCompany.id;}+async function upsertMarketplaceProfile(+ client: CoreApiClient,+ partnerId: string,+ partnerUserId: string | null,+ profile: MarketplaceProfile,+): Promise<void> {+ await client.mutation({+ updatePartner: {+ __args: {+ id: partnerId,+ data: { introduction: profile.introduction },+ },+ id: true,+ },+ });++ for (const service of profile.services) {+ const existing = nodes(+ await client.query({+ partnerServices: {+ __args: {+ filter: {+ title: { eq: service.title },+ partnerId: { eq: partnerId },+ },+ first: 1,+ },+ edges: { node: { id: true } },+ },+ }),+ 'partnerServices',+ );++ const data = withPartnerUserId(+ {+ title: service.title,+ description: service.description,+ sortOrder: service.position,+ position: service.position,+ partnerId,+ },+ partnerUserId,+ );++ if (existing[0]?.id) {+ await client.mutation({+ updatePartnerService: {+ __args: { id: existing[0].id, data },+ id: true,+ },+ });+ } else {+ await client.mutation({+ createPartnerService: {+ __args: { data },+ id: true,+ },+ });+ }+ }++ for (const content of profile.caseStudies) {+ const existing = nodes(+ await client.query({+ partnerContents: {+ __args: {+ filter: {+ name: { eq: content.name },+ partnerId: { eq: partnerId },+ },+ first: 1,+ },+ edges: { node: { id: true } },+ },+ }),+ 'partnerContents',+ );++ const data = withPartnerUserId(+ {+ name: content.name,+ contentType: ['CASE_STUDY'],+ status: content.status,+ clientName: content.clientName,+ headline: content.headline,+ body: { markdown: content.bodyMarkdown },+ caseStudyLink: { primaryLinkUrl: content.caseStudyUrl },+ position: content.position,+ partnerId,+ },+ partnerUserId,+ );++ if (existing[0]?.id) {+ await client.mutation({+ updatePartnerContent: {+ __args: { id: existing[0].id, data },+ id: true,+ },+ });+ } else {+ await client.mutation({+ createPartnerContent: {+ __args: { data },+ id: true,+ },+ });+ }+ }++ for (const link of profile.links) {+ const existing = nodes(+ await client.query({+ partnerLinks: {+ __args: {+ filter: {+ name: { eq: link.name },+ partnerId: { eq: partnerId },+ },+ first: 1,+ },+ edges: { node: { id: true } },+ },+ }),+ 'partnerLinks',+ );++ const data = withPartnerUserId(+ {+ name: link.name,+ url: { primaryLinkUrl: link.url },+ sortOrder: link.position,+ position: link.position,+ partnerId,+ },+ partnerUserId,+ );++ if (existing[0]?.id) {+ await client.mutation({+ updatePartnerLink: {+ __args: { id: existing[0].id, data },+ id: true,+ },+ });+ } else {+ await client.mutation({+ createPartnerLink: {+ __args: { data },+ id: true,+ },+ });+ }+ }+}+async function main() {const client = new CoreApiClient({url: `${requireEnv('TWENTY_PARTNERS_API_URL').replace(/\/$/, '')}/graphql`,@@ -328,6 +709,11 @@ async function main() {country: p.country, city: p.city,skills: p.skills, companyId,linkedin: { primaryLinkUrl: linkedin(p.slug) },+ website: { primaryLinkUrl: partnerDomain(p.slug) },+ profilePicture: {+ primaryLinkUrl: `https://picsum.photos/seed/${p.slug}-team/600/600`,+ },+ superPartner: p.superPartner === true,...(p.hourlyRateUsd != null ? { hourlyRate: usd(p.hourlyRateUsd) } : {}),...(p.projectBudgetMinUsd != null ? { projectBudgetMin: usd(p.projectBudgetMinUsd) } : {}),};@@ -403,221 +789,63 @@ async function main() {}console.log(`[seed] opportunities: ${oppIdByName.size}`);- // -- Primary demo partner marketplace-rich profile --- const primaryDemoPartner = await client.query({- partners: {- __args: {- filter: { slug: { eq: PRIMARY_DEMO_PARTNER_SLUG } },- first: 1,- },- edges: {- node: {- id: true,- partnerUserId: true,- projectBudgetMin: { amountMicros: true },- },- },- },- });- const primaryDemoPartnerNode = nodes(primaryDemoPartner, 'partners')[0] as {- id?: string;- partnerUserId?: string | null;- projectBudgetMin?: { amountMicros?: number | null } | null;- };-- if (primaryDemoPartnerNode?.id) {- const primaryDemoPartnerId = primaryDemoPartnerNode.id;- const primaryDemoPartnerUserId = primaryDemoPartnerNode.partnerUserId ?? null;-- const primaryDemoPartnerData: Record<string, unknown> = {- introduction: PRIMARY_DEMO_DESCRIPTION_MARKDOWN,- };-- const hasProjectBudgetMin =- (primaryDemoPartnerNode.projectBudgetMin?.amountMicros ?? 0) > 0;-- if (!hasProjectBudgetMin) {- primaryDemoPartnerData.projectBudgetMin = usd(PRIMARY_DEMO_BUDGET_USD);- }-- await client.mutation({- updatePartner: {+ // -- Marketplace-rich profiles for every list-visible partner --+ const marketplacePartnerRows = nodes(+ await client.query({+ partners: {__args: {- id: primaryDemoPartnerId,- data: primaryDemoPartnerData,- },- id: true,- },- });-- for (const service of PRIMARY_DEMO_PARTNER_SERVICES) {- const existing = nodes(- await client.query({- partnerServices: {- __args: {- filter: {- title: { eq: service.title },- partnerId: { eq: primaryDemoPartnerId },- },- first: 1,- },- edges: { node: { id: true } },- },- }),- 'partnerServices',- );-- const data = withPartnerUserId(- {- title: service.title,- description: service.description,- sortOrder: service.position,- position: service.position,- partnerId: primaryDemoPartnerId,+ filter: { slug: { in: Object.keys(MARKETPLACE_PROFILES) } },+ first: 50,},- primaryDemoPartnerUserId,- );-- if (existing[0]?.id) {- await client.mutation({- updatePartnerService: {- __args: { id: existing[0].id, data },+ edges: {+ node: {id: true,+ slug: true,+ partnerUserId: true,+ projectBudgetMin: { amountMicros: true },},- });- } else {- await client.mutation({- createPartnerService: {- __args: {- data,- },- id: true,- },- });- }- }-- for (const content of PRIMARY_DEMO_PARTNER_CASE_STUDIES) {- const existing = nodes(- await client.query({- partnerContents: {- __args: {- filter: {- name: { eq: content.name },- partnerId: { eq: primaryDemoPartnerId },- },- first: 1,- },- edges: { node: { id: true } },- },- }),- 'partnerContents',- );-- const data = withPartnerUserId(- {- name: content.name,- contentType: ['CASE_STUDY'],- status: content.status,- clientName: content.clientName,- headline: content.headline,- body: { markdown: content.bodyMarkdown },- caseStudyLink: { primaryLinkUrl: content.caseStudyUrl },- position: content.position,- partnerId: primaryDemoPartnerId,},- primaryDemoPartnerUserId,- );+ },+ }),+ 'partners',+ ) as Array<{+ id: string;+ slug: string;+ partnerUserId: string | null;+ projectBudgetMin?: { amountMicros?: number | null } | null;+ }>;- if (existing[0]?.id) {- await client.mutation({- updatePartnerContent: {- __args: { id: existing[0].id, data },- id: true,- },- });- } else {- await client.mutation({- createPartnerContent: {- __args: {- data,- },- id: true,- },- });- }+ for (const partnerRow of marketplacePartnerRows) {+ const profile = MARKETPLACE_PROFILES[partnerRow.slug];+ if (!profile) {+ continue;}- for (const link of PRIMARY_DEMO_PARTNER_LINKS) {- const existing = nodes(- await client.query({- partnerLinks: {- __args: {- filter: {- name: { eq: link.name },- partnerId: { eq: primaryDemoPartnerId },- },- first: 1,- },- edges: { node: { id: true } },+ if (+ partnerRow.slug === PRIMARY_DEMO_PARTNER_SLUG &&+ (partnerRow.projectBudgetMin?.amountMicros ?? 0) <= 0+ ) {+ await client.mutation({+ updatePartner: {+ __args: {+ id: partnerRow.id,+ data: { projectBudgetMin: usd(PRIMARY_DEMO_BUDGET_USD) },},- }),- 'partnerLinks',- );-- const data = withPartnerUserId(- {- name: link.name,- url: { primaryLinkUrl: link.url },- sortOrder: link.position,- position: link.position,- partnerId: primaryDemoPartnerId,+ id: true,},- primaryDemoPartnerUserId,- );-- if (existing[0]?.id) {- await client.mutation({- updatePartnerLink: {- __args: { id: existing[0].id, data },- id: true,- },- });- } else {- await client.mutation({- createPartnerLink: {- __args: {- data,- },- id: true,- },- });- }- }- }-- // -- Marketplace profile copy (rich markdown on a few list-visible partners) --- const marketplaceDescriptions: Record<string, string> = {- 'elevate-consulting': ELEVATE_DESCRIPTION_MARKDOWN,- 'meridian-craft': MERIDIAN_DESCRIPTION_MARKDOWN,- };-- for (const [slug, markdown] of Object.entries(marketplaceDescriptions)) {- const partnerId = partnerIdBySlug.get(slug);- if (!partnerId) {- continue;+ });}- await client.mutation({- updatePartner: {- __args: {- id: partnerId,- data: { introduction: markdown },- },- id: true,- },- });+ await upsertMarketplaceProfile(+ client,+ partnerRow.id,+ partnerRow.partnerUserId ?? null,+ profile,+ );}+ console.log(+ `[seed] marketplace profiles: ${marketplacePartnerRows.length}`,+ );// -- Partner quotes (upsert by name) --const partnerUserIdBySlug = new Map<string, string>(