Skip to content

The open alternative to Salesforce, designed for AI.

feat(twenty-partners): marketplace v2 — Application-driven matching workspace (#21816)

Rashad Karanouh24533b510c5f
diff --git a/packages/twenty-apps/internal/twenty-partners/package.json b/packages/twenty-apps/internal/twenty-partners/package.json
index d441801312b..2e9785fb85f 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": "0.5.5",
+ "version": "1.0.0",
"license": "MIT",
"engines": {
"node": "^24.5.0",
diff --git a/packages/twenty-apps/internal/twenty-partners/src/constants/partner-country-view-groups.ts b/packages/twenty-apps/internal/twenty-partners/src/constants/partner-country-view-groups.ts
new file mode 100644
index 00000000000..938565ee60e
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/constants/partner-country-view-groups.ts
@@ -0,0 +1,200 @@
+// View groups for Partner country SELECT options (used by Partners per Country view).
+export const PARTNER_COUNTRY_VIEW_GROUPS = [
+ { universalIdentifier: 'bec9ce01-82dc-44ea-956c-ec71f98ec9c5', fieldValue: 'AFGHANISTAN', position: 0, isVisible: true },
+ { universalIdentifier: 'cab68d7f-af98-4053-b74f-39b7f8c85085', fieldValue: 'ALBANIA', position: 1, isVisible: true },
+ { universalIdentifier: 'f80516ad-0e2b-48a5-b2f1-fe1ee5a3f167', fieldValue: 'ALGERIA', position: 2, isVisible: true },
+ { universalIdentifier: 'f06c7e69-69ac-4582-9ab7-4f46186881c8', fieldValue: 'ANDORRA', position: 3, isVisible: true },
+ { universalIdentifier: 'fa2ad275-0e16-4292-bec5-532e024abb5e', fieldValue: 'ANGOLA', position: 4, isVisible: true },
+ { universalIdentifier: '78ca3412-1aa7-46b6-99ab-674e67cb744e', fieldValue: 'ANTIGUA_AND_BARBUDA', position: 5, isVisible: true },
+ { universalIdentifier: 'e3b178b4-324a-433e-b115-9c26c25b9319', fieldValue: 'ARGENTINA', position: 6, isVisible: true },
+ { universalIdentifier: '9aaf859f-7373-467b-b596-80ad083ede41', fieldValue: 'ARMENIA', position: 7, isVisible: true },
+ { universalIdentifier: 'a6c2e65c-ae98-44f9-863d-ff028a79fbdc', fieldValue: 'AUSTRALIA', position: 8, isVisible: true },
+ { universalIdentifier: 'ec504505-451e-4754-a563-70ed24df4fc4', fieldValue: 'AUSTRIA', position: 9, isVisible: true },
+ { universalIdentifier: 'd04dfb9b-2be9-4f39-b6a1-1fbb43d63a85', fieldValue: 'AZERBAIJAN', position: 10, isVisible: true },
+ { universalIdentifier: '1daede22-9ef5-494d-837f-4aeb49313f27', fieldValue: 'BAHAMAS', position: 11, isVisible: true },
+ { universalIdentifier: 'ceeb605d-1872-4861-b018-c055e9ffedd6', fieldValue: 'BAHRAIN', position: 12, isVisible: true },
+ { universalIdentifier: '7e3ddf1b-71e8-4614-b4e5-234e1b382ad4', fieldValue: 'BANGLADESH', position: 13, isVisible: true },
+ { universalIdentifier: '1c9e2f46-29f5-428d-88f4-e3918a0d2fb4', fieldValue: 'BARBADOS', position: 14, isVisible: true },
+ { universalIdentifier: 'abc76de1-a845-4cf4-94e7-f7329a2ad9e8', fieldValue: 'BELARUS', position: 15, isVisible: true },
+ { universalIdentifier: 'eec4351f-bbd7-4db5-bb93-376c6665aeac', fieldValue: 'BELGIUM', position: 16, isVisible: true },
+ { universalIdentifier: 'a443da7a-0183-491f-9209-3628a6c5b952', fieldValue: 'BELIZE', position: 17, isVisible: true },
+ { universalIdentifier: 'b571b502-b87f-449c-827c-e9fdc60d90a0', fieldValue: 'BENIN', position: 18, isVisible: true },
+ { universalIdentifier: '01ea25fc-6396-4139-a684-5f8ad079f88a', fieldValue: 'BHUTAN', position: 19, isVisible: true },
+ { universalIdentifier: '59e72a15-4a4b-4b9b-a2c2-0ce72749001d', fieldValue: 'BOLIVIA', position: 20, isVisible: true },
+ { universalIdentifier: '3f09c2bb-e832-4145-b9e2-a7ccd3bb1d80', fieldValue: 'BOSNIA_AND_HERZEGOVINA', position: 21, isVisible: true },
+ { universalIdentifier: 'a3945b75-964f-4f4a-940e-070dd53f4305', fieldValue: 'BOTSWANA', position: 22, isVisible: true },
+ { universalIdentifier: '595c7768-9d21-4c8e-a9d6-481e7d680561', fieldValue: 'BRAZIL', position: 23, isVisible: true },
+ { universalIdentifier: '6119b726-e21a-4488-b510-654f1941fc25', fieldValue: 'BRUNEI', position: 24, isVisible: true },
+ { universalIdentifier: '413688ac-849f-420e-80d5-c784b9da6c5a', fieldValue: 'BULGARIA', position: 25, isVisible: true },
+ { universalIdentifier: '7e1424cd-92b6-4f0a-bf1b-539c02c1a4ca', fieldValue: 'BURKINA_FASO', position: 26, isVisible: true },
+ { universalIdentifier: 'b26dfa82-37f0-4a30-99dd-70048dff75d4', fieldValue: 'BURUNDI', position: 27, isVisible: true },
+ { universalIdentifier: '33f7faaa-d02c-405d-8008-6612b7eae2ea', fieldValue: 'CAMBODIA', position: 28, isVisible: true },
+ { universalIdentifier: 'd59d8e89-85b8-44c6-ae18-cbc6c9c6157a', fieldValue: 'CAMEROON', position: 29, isVisible: true },
+ { universalIdentifier: '238d0439-0abc-4912-879d-c88dac3f25bb', fieldValue: 'CANADA', position: 30, isVisible: true },
+ { universalIdentifier: '9029f890-d971-4a21-8378-4e7b41e69c59', fieldValue: 'CAPE_VERDE', position: 31, isVisible: true },
+ { universalIdentifier: 'e8ae400d-33c3-4076-8d43-8c3d196383b2', fieldValue: 'CENTRAL_AFRICAN_REPUBLIC', position: 32, isVisible: true },
+ { universalIdentifier: '8657ddfa-8720-44db-b023-5f95e2dadea7', fieldValue: 'CHAD', position: 33, isVisible: true },
+ { universalIdentifier: 'df3b7c7f-864c-4275-9dd9-b75390c4ecb6', fieldValue: 'CHILE', position: 34, isVisible: true },
+ { universalIdentifier: '43967606-e659-44ff-b41b-2e8f8735e3ba', fieldValue: 'CHINA', position: 35, isVisible: true },
+ { universalIdentifier: '3241ff55-3a7c-4260-97ee-a161827529e3', fieldValue: 'COLOMBIA', position: 36, isVisible: true },
+ { universalIdentifier: '6f4b1cd2-bdde-40d3-b6ca-364a35b470cd', fieldValue: 'COMOROS', position: 37, isVisible: true },
+ { universalIdentifier: '399d2f2c-9607-4115-8d22-b06143f3c654', fieldValue: 'CONGO', position: 38, isVisible: true },
+ { universalIdentifier: '83b9ebfe-ea23-46e1-a2d9-2ae5c0b0247d', fieldValue: 'DR_CONGO', position: 39, isVisible: true },
+ { universalIdentifier: '4730c5db-e6b9-4c6e-9840-4650c83f6d15', fieldValue: 'COSTA_RICA', position: 40, isVisible: true },
+ { universalIdentifier: '6980c7bc-e433-4014-a60a-1b85fe476329', fieldValue: 'CROATIA', position: 41, isVisible: true },
+ { universalIdentifier: '0487f083-7be7-4f42-9be6-fa264e1fccc1', fieldValue: 'CUBA', position: 42, isVisible: true },
+ { universalIdentifier: '27978a7a-3b4a-4f76-84a4-cf3fc2d8b9d3', fieldValue: 'CYPRUS', position: 43, isVisible: true },
+ { universalIdentifier: '63ecd55b-9e2f-4440-9de9-cee767c1a65f', fieldValue: 'CZECH_REPUBLIC', position: 44, isVisible: true },
+ { universalIdentifier: 'e5237f50-80df-4fa7-be56-3305df24bfa4', fieldValue: 'DENMARK', position: 45, isVisible: true },
+ { universalIdentifier: 'd3796fbe-f883-4545-b694-6675ed18df48', fieldValue: 'DJIBOUTI', position: 46, isVisible: true },
+ { universalIdentifier: '463907d1-2e6b-45d4-a95d-384cc1be135a', fieldValue: 'DOMINICA', position: 47, isVisible: true },
+ { universalIdentifier: '3193e60a-5f96-45a8-9bb1-7f944668e66f', fieldValue: 'DOMINICAN_REPUBLIC', position: 48, isVisible: true },
+ { universalIdentifier: '454ed601-8ba7-43af-8015-8063582a8ee6', fieldValue: 'ECUADOR', position: 49, isVisible: true },
+ { universalIdentifier: '946c67d4-3909-4987-a436-f57c22d25c5b', fieldValue: 'EGYPT', position: 50, isVisible: true },
+ { universalIdentifier: 'cb2ac070-2f7d-4a6f-a5cb-91caa64f02d3', fieldValue: 'EL_SALVADOR', position: 51, isVisible: true },
+ { universalIdentifier: 'adda54b9-688f-44a8-b0e8-d0090ee92730', fieldValue: 'EQUATORIAL_GUINEA', position: 52, isVisible: true },
+ { universalIdentifier: '163dffe3-cffe-40d3-be0d-1b656a74e70a', fieldValue: 'ERITREA', position: 53, isVisible: true },
+ { universalIdentifier: 'ca045699-c53d-4936-863c-92adf9188761', fieldValue: 'ESTONIA', position: 54, isVisible: true },
+ { universalIdentifier: 'b2c3e590-7f74-42b6-aa76-dd59a486df07', fieldValue: 'ESWATINI', position: 55, isVisible: true },
+ { universalIdentifier: 'cdde3faf-852b-4cfe-a2e6-227b3c9597a9', fieldValue: 'ETHIOPIA', position: 56, isVisible: true },
+ { universalIdentifier: '7f18b15c-e259-454e-9d57-3e09ee6b3cae', fieldValue: 'FIJI', position: 57, isVisible: true },
+ { universalIdentifier: '0c079db6-50f0-4d36-860a-709a5bf0eae4', fieldValue: 'FINLAND', position: 58, isVisible: true },
+ { universalIdentifier: '626ca163-5891-4008-bfa0-a45622e9f07b', fieldValue: 'FRANCE', position: 59, isVisible: true },
+ { universalIdentifier: '03775693-fb9a-4669-a483-82602d5f55f3', fieldValue: 'GABON', position: 60, isVisible: true },
+ { universalIdentifier: 'd3635f3e-6411-477f-8cca-a4d89aa3ac72', fieldValue: 'GAMBIA', position: 61, isVisible: true },
+ { universalIdentifier: '6ed7108f-f4dd-468e-a0d0-474b18395d35', fieldValue: 'GEORGIA', position: 62, isVisible: true },
+ { universalIdentifier: 'e46e10d5-2761-423e-9a93-c6ddb6e39bed', fieldValue: 'GERMANY', position: 63, isVisible: true },
+ { universalIdentifier: 'a291a984-df0f-4ec9-bb18-6e72c56abe6f', fieldValue: 'GHANA', position: 64, isVisible: true },
+ { universalIdentifier: '03c206fa-ad03-4c9a-8ae9-449bf2f1b41c', fieldValue: 'GREECE', position: 65, isVisible: true },
+ { universalIdentifier: '3030f50e-93da-404b-b6db-8cc8c95049e7', fieldValue: 'GRENADA', position: 66, isVisible: true },
+ { universalIdentifier: 'ae0def27-cd71-482d-a7ce-5fa198c07865', fieldValue: 'GUATEMALA', position: 67, isVisible: true },
+ { universalIdentifier: '7a377c20-4409-4237-8157-5db03d70924a', fieldValue: 'GUINEA', position: 68, isVisible: true },
+ { universalIdentifier: 'a79e13d5-6fca-44c4-bd32-e92176664d9e', fieldValue: 'GUINEA_BISSAU', position: 69, isVisible: true },
+ { universalIdentifier: 'dbadd3d2-4c7e-4023-8a42-df52e00e1155', fieldValue: 'GUYANA', position: 70, isVisible: true },
+ { universalIdentifier: '33808d5a-0ef4-4187-84e8-c54f4bad3b1c', fieldValue: 'HAITI', position: 71, isVisible: true },
+ { universalIdentifier: '5e67be53-20c4-43e5-9a03-89f2ba62c969', fieldValue: 'HONDURAS', position: 72, isVisible: true },
+ { universalIdentifier: '46ebb616-55c9-449f-984c-75aade26f78e', fieldValue: 'HUNGARY', position: 73, isVisible: true },
+ { universalIdentifier: '97edc7d0-e3a2-4bf2-8cba-f69162c5789b', fieldValue: 'ICELAND', position: 74, isVisible: true },
+ { universalIdentifier: 'f408bb78-90db-4b46-bf0c-b0f42eaf180c', fieldValue: 'INDIA', position: 75, isVisible: true },
+ { universalIdentifier: '4bafacbc-c78d-476b-8b67-44567087c174', fieldValue: 'INDONESIA', position: 76, isVisible: true },
+ { universalIdentifier: 'e0713b85-7062-4e98-b907-19c241d5003d', fieldValue: 'IRAN', position: 77, isVisible: true },
+ { universalIdentifier: '88c211c6-7410-4275-ac91-1fd410cdcc76', fieldValue: 'IRAQ', position: 78, isVisible: true },
+ { universalIdentifier: '3777a8be-0cb6-4388-a666-d1279ea274a7', fieldValue: 'IRELAND', position: 79, isVisible: true },
+ { universalIdentifier: '710c5936-b2bf-4327-a612-3468bbd79fcc', fieldValue: 'ISRAEL', position: 80, isVisible: true },
+ { universalIdentifier: '23c16f00-3cdd-42e6-964f-9fddd25b2977', fieldValue: 'ITALY', position: 81, isVisible: true },
+ { universalIdentifier: '63d408d9-e9d8-49f5-8f64-be99cd43f152', fieldValue: 'IVORY_COAST', position: 82, isVisible: true },
+ { universalIdentifier: 'e412b80c-94bd-4615-9020-cd2c881543b4', fieldValue: 'JAMAICA', position: 83, isVisible: true },
+ { universalIdentifier: '9570bc3f-6fcb-47b1-a5e8-4cfe19eadec0', fieldValue: 'JAPAN', position: 84, isVisible: true },
+ { universalIdentifier: 'ed7b3c7d-22e7-4089-b2ba-04b9dac5a0d4', fieldValue: 'JORDAN', position: 85, isVisible: true },
+ { universalIdentifier: 'c784fbb9-f068-45e4-85f9-6201b9f8f4dc', fieldValue: 'KAZAKHSTAN', position: 86, isVisible: true },
+ { universalIdentifier: '8fa80675-d39a-4eff-819b-fc3a2915ab00', fieldValue: 'KENYA', position: 87, isVisible: true },
+ { universalIdentifier: '541feab5-3335-420b-9a88-2d5c8af512f3', fieldValue: 'KIRIBATI', position: 88, isVisible: true },
+ { universalIdentifier: 'f884db4f-ed0a-45b6-ad8e-3ed25e20ee5e', fieldValue: 'KOSOVO', position: 89, isVisible: true },
+ { universalIdentifier: '516860c7-a95c-4794-9f62-e21e9f2e7c84', fieldValue: 'KUWAIT', position: 90, isVisible: true },
+ { universalIdentifier: '57c9389c-403b-4e2a-ad1b-d00824796c5b', fieldValue: 'KYRGYZSTAN', position: 91, isVisible: true },
+ { universalIdentifier: '426f38a5-27fe-47ef-9c68-0e930df028c7', fieldValue: 'LAOS', position: 92, isVisible: true },
+ { universalIdentifier: 'e7932bb3-f43d-4442-9df8-15e1a5f528d4', fieldValue: 'LATVIA', position: 93, isVisible: true },
+ { universalIdentifier: '5519dbdc-cc26-435b-8953-100778bf0e89', fieldValue: 'LEBANON', position: 94, isVisible: true },
+ { universalIdentifier: '05ba6abc-7c6d-4fb9-8a05-7e4582346ce4', fieldValue: 'LESOTHO', position: 95, isVisible: true },
+ { universalIdentifier: '3056b7c7-e864-40e3-a3cb-8e53dcfe2107', fieldValue: 'LIBERIA', position: 96, isVisible: true },
+ { universalIdentifier: '5214650d-5039-4190-851e-1a8f8befec0f', fieldValue: 'LIBYA', position: 97, isVisible: true },
+ { universalIdentifier: '3efd49bf-e1d1-406b-89b8-0fde5e8daf89', fieldValue: 'LIECHTENSTEIN', position: 98, isVisible: true },
+ { universalIdentifier: 'c3ec85cf-1999-4b09-90d6-df1617720d78', fieldValue: 'LITHUANIA', position: 99, isVisible: true },
+ { universalIdentifier: '5063c42e-6e66-4288-bfa1-cb53488b1777', fieldValue: 'LUXEMBOURG', position: 100, isVisible: true },
+ { universalIdentifier: '0e3dfe47-3aa1-43e3-83ba-ec817cff5e5e', fieldValue: 'MADAGASCAR', position: 101, isVisible: true },
+ { universalIdentifier: 'bfc94100-2383-4d5d-a4e3-2c222865e58b', fieldValue: 'MALAWI', position: 102, isVisible: true },
+ { universalIdentifier: 'd0bcaf24-c514-407d-9832-3cb5bd4eb096', fieldValue: 'MALAYSIA', position: 103, isVisible: true },
+ { universalIdentifier: 'ee8c64f2-51d5-40d1-a390-e5662754396a', fieldValue: 'MALDIVES', position: 104, isVisible: true },
+ { universalIdentifier: '00f9fbc4-c16a-404b-9fef-84e0af27a9e2', fieldValue: 'MALI', position: 105, isVisible: true },
+ { universalIdentifier: 'ad3bcf45-1d9c-49c7-b632-894a368a96ee', fieldValue: 'MALTA', position: 106, isVisible: true },
+ { universalIdentifier: '5aee9765-813e-4ddc-b2e5-331c0f28b844', fieldValue: 'MARSHALL_ISLANDS', position: 107, isVisible: true },
+ { universalIdentifier: 'eddf67e4-2fec-4ca6-8559-94f9e962aa1c', fieldValue: 'MAURITANIA', position: 108, isVisible: true },
+ { universalIdentifier: 'a5b2fd01-26f6-453a-9204-5698ba9892fc', fieldValue: 'MAURITIUS', position: 109, isVisible: true },
+ { universalIdentifier: '79535491-7e96-4aea-800f-58fcdc2b301b', fieldValue: 'MEXICO', position: 110, isVisible: true },
+ { universalIdentifier: 'e0ff2d9d-fb4d-45ef-b630-edc4a3b87aa6', fieldValue: 'MICRONESIA', position: 111, isVisible: true },
+ { universalIdentifier: '1b90ee06-8216-4845-b86f-d3fda73826bf', fieldValue: 'MOLDOVA', position: 112, isVisible: true },
+ { universalIdentifier: '006b65d4-aed8-4a4d-b6b4-0288fafa4e3f', fieldValue: 'MONACO', position: 113, isVisible: true },
+ { universalIdentifier: '93033c57-9254-46a6-8380-7b356d133863', fieldValue: 'MONGOLIA', position: 114, isVisible: true },
+ { universalIdentifier: '2d67c336-a1c6-4305-a599-50438309dd44', fieldValue: 'MONTENEGRO', position: 115, isVisible: true },
+ { universalIdentifier: 'c1f2c641-75ea-402f-a6a5-5a436528988d', fieldValue: 'MOROCCO', position: 116, isVisible: true },
+ { universalIdentifier: '47e96908-62fa-4a87-bacd-d5d91262e3de', fieldValue: 'MOZAMBIQUE', position: 117, isVisible: true },
+ { universalIdentifier: '331dde1b-b3e4-414b-aaa1-0bb41c790f5e', fieldValue: 'MYANMAR', position: 118, isVisible: true },
+ { universalIdentifier: '6df3d4a8-f183-43ad-8385-fc33315c1c6b', fieldValue: 'NAMIBIA', position: 119, isVisible: true },
+ { universalIdentifier: '76e96d43-5efc-4bbf-aa9d-8c7edfe78ef9', fieldValue: 'NAURU', position: 120, isVisible: true },
+ { universalIdentifier: 'c3ac3737-62f5-4725-b644-203f89ece709', fieldValue: 'NEPAL', position: 121, isVisible: true },
+ { universalIdentifier: '7a80a0a2-d753-41fb-a257-338a2ae801bd', fieldValue: 'NETHERLANDS', position: 122, isVisible: true },
+ { universalIdentifier: '91bc37fe-f039-44ed-873b-69ab1d08ae03', fieldValue: 'NEW_ZEALAND', position: 123, isVisible: true },
+ { universalIdentifier: '5c21b7f4-1685-4c20-bc41-3bbcabfcea07', fieldValue: 'NICARAGUA', position: 124, isVisible: true },
+ { universalIdentifier: 'e31564c8-4595-40d9-ad27-83ff8ef40a5c', fieldValue: 'NIGER', position: 125, isVisible: true },
+ { universalIdentifier: 'a2685d3b-ed97-4d89-a195-ba6c5ac391f4', fieldValue: 'NIGERIA', position: 126, isVisible: true },
+ { universalIdentifier: '29271340-e20f-4cfd-ad80-9c7c5000c9a8', fieldValue: 'NORTH_KOREA', position: 127, isVisible: true },
+ { universalIdentifier: 'a8cdf067-9b50-41df-bfc3-3162684d3645', fieldValue: 'NORTH_MACEDONIA', position: 128, isVisible: true },
+ { universalIdentifier: 'ccf9e960-f7ac-4ca3-b533-4ad217b63cf3', fieldValue: 'NORWAY', position: 129, isVisible: true },
+ { universalIdentifier: '5f2a732b-d24e-4e98-8f36-76b213c3d525', fieldValue: 'OMAN', position: 130, isVisible: true },
+ { universalIdentifier: 'be838c6a-cfe7-4213-91e1-0465bd77bb68', fieldValue: 'PAKISTAN', position: 131, isVisible: true },
+ { universalIdentifier: '0d98c911-5cea-48c4-b7e0-2a33f99eda8c', fieldValue: 'PALAU', position: 132, isVisible: true },
+ { universalIdentifier: '0fae476b-504b-4224-a586-2c718f17315b', fieldValue: 'PALESTINE', position: 133, isVisible: true },
+ { universalIdentifier: '3affd474-11f7-4c08-a15e-d46e8a645652', fieldValue: 'PANAMA', position: 134, isVisible: true },
+ { universalIdentifier: '4b5bd270-89ce-4fab-9067-587e60df1ced', fieldValue: 'PAPUA_NEW_GUINEA', position: 135, isVisible: true },
+ { universalIdentifier: '2c50c6f6-1b98-42df-8cd0-953c8e3bfe69', fieldValue: 'PARAGUAY', position: 136, isVisible: true },
+ { universalIdentifier: 'c8db5b67-86f3-4ee7-b902-ea7e48048d3f', fieldValue: 'PERU', position: 137, isVisible: true },
+ { universalIdentifier: '30df30ca-6467-4870-a53b-af489d78ee91', fieldValue: 'PHILIPPINES', position: 138, isVisible: true },
+ { universalIdentifier: '8279524a-f2e0-46cf-a67f-47cf4ba89929', fieldValue: 'POLAND', position: 139, isVisible: true },
+ { universalIdentifier: '57beab1e-0055-4b69-b677-b349ed5adf29', fieldValue: 'PORTUGAL', position: 140, isVisible: true },
+ { universalIdentifier: '0c843bdb-578d-4df5-9e1f-d4821f4ac599', fieldValue: 'QATAR', position: 141, isVisible: true },
+ { universalIdentifier: '877c29f4-90a9-4790-9a7a-bc88719311ce', fieldValue: 'ROMANIA', position: 142, isVisible: true },
+ { universalIdentifier: '1ac3228f-4dd0-47c1-86ff-74fcd850734f', fieldValue: 'RUSSIA', position: 143, isVisible: true },
+ { universalIdentifier: '82237520-5759-4e52-a3ea-e7b4c3d53f99', fieldValue: 'RWANDA', position: 144, isVisible: true },
+ { universalIdentifier: '5639c663-897f-4276-99dc-8f8f1bd36cc5', fieldValue: 'SAINT_KITTS_AND_NEVIS', position: 145, isVisible: true },
+ { universalIdentifier: 'ae39a8ed-75a0-4278-9d18-9a7b21ec1aee', fieldValue: 'SAINT_LUCIA', position: 146, isVisible: true },
+ { universalIdentifier: '2d1c2b6e-de6c-439e-b764-aabfa0b9d708', fieldValue: 'SAINT_VINCENT', position: 147, isVisible: true },
+ { universalIdentifier: '767ad987-9238-496f-9c91-23ea7f825048', fieldValue: 'SAMOA', position: 148, isVisible: true },
+ { universalIdentifier: '5bf0b730-456b-4b74-8c86-1c574dcf9c4a', fieldValue: 'SAN_MARINO', position: 149, isVisible: true },
+ { universalIdentifier: 'fb574fcf-7c32-4286-a588-149fb7febd53', fieldValue: 'SAO_TOME_AND_PRINCIPE', position: 150, isVisible: true },
+ { universalIdentifier: 'fc8c123a-3976-4b38-a1bd-fa75ffbbea2f', fieldValue: 'SAUDI_ARABIA', position: 151, isVisible: true },
+ { universalIdentifier: '891a686a-6c35-4940-a9d8-350bf414421f', fieldValue: 'SENEGAL', position: 152, isVisible: true },
+ { universalIdentifier: '065a6bc6-07da-46b9-ac58-b9fd14b828b2', fieldValue: 'SERBIA', position: 153, isVisible: true },
+ { universalIdentifier: '0f8160a4-8a95-46a8-902b-d998ea3ddaf7', fieldValue: 'SEYCHELLES', position: 154, isVisible: true },
+ { universalIdentifier: '9cf38c93-536a-4e6d-a552-e82b4c7c6edf', fieldValue: 'SIERRA_LEONE', position: 155, isVisible: true },
+ { universalIdentifier: '58607f5c-6ddc-4f8a-a866-7314c145e53a', fieldValue: 'SINGAPORE', position: 156, isVisible: true },
+ { universalIdentifier: 'd591dc9e-76c4-405f-b548-657d8fe9721a', fieldValue: 'SLOVAKIA', position: 157, isVisible: true },
+ { universalIdentifier: 'dfcffa17-85b4-4635-99fd-c96ef124531e', fieldValue: 'SLOVENIA', position: 158, isVisible: true },
+ { universalIdentifier: 'dd65e06e-c4dc-454d-8728-2dcec04d5f80', fieldValue: 'SOLOMON_ISLANDS', position: 159, isVisible: true },
+ { universalIdentifier: '458f0d37-7905-41bc-93b7-1591072c8d60', fieldValue: 'SOMALIA', position: 160, isVisible: true },
+ { universalIdentifier: 'e10ec565-6dea-479c-9105-7ebf11522a51', fieldValue: 'SOUTH_AFRICA', position: 161, isVisible: true },
+ { universalIdentifier: 'c71d7fe0-e000-4180-b943-ceb00f4a8355', fieldValue: 'SOUTH_KOREA', position: 162, isVisible: true },
+ { universalIdentifier: '073df894-207b-4375-b70c-7289c7a513b9', fieldValue: 'SOUTH_SUDAN', position: 163, isVisible: true },
+ { universalIdentifier: '746102f0-656d-4cb9-9193-4d8d7855dead', fieldValue: 'SPAIN', position: 164, isVisible: true },
+ { universalIdentifier: '1fb4d075-f777-4dd8-ba7c-6bd666338656', fieldValue: 'SRI_LANKA', position: 165, isVisible: true },
+ { universalIdentifier: '74e3afbd-c31d-4580-a815-ccd839b65f8c', fieldValue: 'SUDAN', position: 166, isVisible: true },
+ { universalIdentifier: 'a7c8fd33-5f0d-43a2-9edc-7c39b70b0a40', fieldValue: 'SURINAME', position: 167, isVisible: true },
+ { universalIdentifier: '2214a204-60f3-423c-a753-3f7b4748a177', fieldValue: 'SWEDEN', position: 168, isVisible: true },
+ { universalIdentifier: 'ca7163b9-7c4d-42fe-ad79-c6b2caabf312', fieldValue: 'SWITZERLAND', position: 169, isVisible: true },
+ { universalIdentifier: 'ab5681cc-703f-4697-9960-b2cb20aafda1', fieldValue: 'SYRIA', position: 170, isVisible: true },
+ { universalIdentifier: '2f2f947d-7729-4717-bf76-3be0ea0748a8', fieldValue: 'TAIWAN', position: 171, isVisible: true },
+ { universalIdentifier: '4f33a711-0b6f-4442-9a29-9c02784464cb', fieldValue: 'TAJIKISTAN', position: 172, isVisible: true },
+ { universalIdentifier: 'e150d07b-efd0-47d5-9fdb-b6c0c0ac72ff', fieldValue: 'TANZANIA', position: 173, isVisible: true },
+ { universalIdentifier: '5aecbf00-b573-493a-9114-0df621195107', fieldValue: 'THAILAND', position: 174, isVisible: true },
+ { universalIdentifier: '7cf3c8b6-745a-4f05-9bfb-4adc8593c34d', fieldValue: 'TIMOR_LESTE', position: 175, isVisible: true },
+ { universalIdentifier: 'd163fc20-fd5c-4020-a748-352698decd64', fieldValue: 'TOGO', position: 176, isVisible: true },
+ { universalIdentifier: '94599257-2c1e-4d8c-bb13-f749b35c523a', fieldValue: 'TONGA', position: 177, isVisible: true },
+ { universalIdentifier: '0d6a9601-b360-4539-ac00-a691f15866d0', fieldValue: 'TRINIDAD_AND_TOBAGO', position: 178, isVisible: true },
+ { universalIdentifier: '8c0ee850-dc66-4237-a94f-c7d9b474b02d', fieldValue: 'TUNISIA', position: 179, isVisible: true },
+ { universalIdentifier: 'b0bf5dd2-2908-4135-8cc7-c76fc75eec2d', fieldValue: 'TURKEY', position: 180, isVisible: true },
+ { universalIdentifier: 'e1a09e61-4cf4-42fc-bf1f-67bb5af80ed6', fieldValue: 'TURKMENISTAN', position: 181, isVisible: true },
+ { universalIdentifier: '81cabf65-f215-432a-a5ca-6e65ed1b2686', fieldValue: 'TUVALU', position: 182, isVisible: true },
+ { universalIdentifier: 'ca416d97-a9a0-42ed-bb84-e833f10996f3', fieldValue: 'UGANDA', position: 183, isVisible: true },
+ { universalIdentifier: '458b313d-18e1-4e07-bf65-95e2e3f8a527', fieldValue: 'UKRAINE', position: 184, isVisible: true },
+ { universalIdentifier: 'cdc5e5bb-04b4-4f43-9fd2-1db7d9f34ce3', fieldValue: 'UNITED_ARAB_EMIRATES', position: 185, isVisible: true },
+ { universalIdentifier: 'd18fb05d-5dd6-4f1d-9955-037234e01302', fieldValue: 'UNITED_KINGDOM', position: 186, isVisible: true },
+ { universalIdentifier: '4529bb2e-2bf3-434e-b301-7e23f5c3e7ad', fieldValue: 'UNITED_STATES', position: 187, isVisible: true },
+ { universalIdentifier: 'a6fda962-38ad-4299-a691-73d2cdc56f4d', fieldValue: 'URUGUAY', position: 188, isVisible: true },
+ { universalIdentifier: 'a757ba93-8506-42c7-91a7-c470e7c2b5f2', fieldValue: 'UZBEKISTAN', position: 189, isVisible: true },
+ { universalIdentifier: '0d01c658-5acf-4257-9610-5580cfed2bd2', fieldValue: 'VANUATU', position: 190, isVisible: true },
+ { universalIdentifier: '4dbd7dca-0a25-4107-ae1f-767e262b0bb5', fieldValue: 'VATICAN', position: 191, isVisible: true },
+ { universalIdentifier: '10c569d7-e1f2-425f-bff7-dbbc341714df', fieldValue: 'VENEZUELA', position: 192, isVisible: true },
+ { universalIdentifier: '9feb92da-6868-4dad-9b26-a07500043664', fieldValue: 'VIETNAM', position: 193, isVisible: true },
+ { universalIdentifier: 'a713fd87-218c-4dea-a34e-20ee55e645d0', fieldValue: 'YEMEN', position: 194, isVisible: true },
+ { universalIdentifier: '740315fd-282f-40aa-aafe-32b177327c09', fieldValue: 'ZAMBIA', position: 195, isVisible: true },
+ { universalIdentifier: '26f8df31-6977-4cea-8e2d-11f414a53e62', fieldValue: 'ZIMBABWE', position: 196, isVisible: true },
+] as const;
diff --git a/packages/twenty-apps/internal/twenty-partners/src/constants/universal-identifiers.ts b/packages/twenty-apps/internal/twenty-partners/src/constants/universal-identifiers.ts
index 1a95912da59..934580b7c63 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/constants/universal-identifiers.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/constants/universal-identifiers.ts
@@ -6,10 +6,8 @@ export const PARTNER_OBJECT_UNIVERSAL_IDENTIFIER = '39101b39-1c16-4148-9e82-45dc
export const PARTNER_CONTENT_OBJECT_UNIVERSAL_IDENTIFIER = '65172140-d377-41c1-a2ae-190e96fb79dd';
export const ALL_PARTNERS_VIEW_UNIVERSAL_IDENTIFIER = '379b11d5-44d5-476b-ba7d-31d5f515c9b4';
export const PARTNERS_NAV_UNIVERSAL_IDENTIFIER = '3fe15ab5-e38b-4914-af17-2270b210aeb2';
-export const ON_OPP_AUTO_MATCH_FN_UNIVERSAL_IDENTIFIER = 'eb8d4d26-8103-4b66-9026-6a86556f7ca5';
export const POST_INSTALL_FN_UNIVERSAL_IDENTIFIER = 'f92bad2e-5905-4757-96ee-af9869d4ca0c';
export const ON_PARTNER_APPLICATION_CREATED_FN_UNIVERSAL_IDENTIFIER = '43888cce-a2aa-4100-afbc-59a4f978ce53';
-export const MATCH_STATUS_FIELD_UNIVERSAL_IDENTIFIER = 'd8dd0623-3a4c-4ab3-a1e0-4ece7df24fb2';
export const INTRO_SENT_AT_FIELD_UNIVERSAL_IDENTIFIER = 'fcf39b0c-0547-415e-806d-b238131ad7cc';
// Roles (Task 2)
diff --git a/packages/twenty-apps/internal/twenty-partners/src/fields/applications-as-partner-user-on-workspace-member.field.ts b/packages/twenty-apps/internal/twenty-partners/src/fields/applications-as-partner-user-on-workspace-member.field.ts
new file mode 100644
index 00000000000..ecbfce87611
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/fields/applications-as-partner-user-on-workspace-member.field.ts
@@ -0,0 +1,27 @@
+import {
+ FieldType,
+ RelationType,
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+ defineField,
+} from 'twenty-sdk/define';
+
+import {
+ APPLICATIONS_AS_PARTNER_USER_FIELD_ID,
+ APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ APPLICATION_PARTNER_USER_FIELD_ID,
+} from 'src/objects/application.object';
+
+export default defineField({
+ universalIdentifier: APPLICATIONS_AS_PARTNER_USER_FIELD_ID,
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.workspaceMember.universalIdentifier,
+ type: FieldType.RELATION,
+ name: 'partnerApplications',
+ label: 'Partner Applications',
+ isNullable: true,
+ relationTargetObjectMetadataUniversalIdentifier:
+ APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ relationTargetFieldMetadataUniversalIdentifier:
+ APPLICATION_PARTNER_USER_FIELD_ID,
+ universalSettings: { relationType: RelationType.ONE_TO_MANY },
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/fields/applications-on-opportunity.field.ts b/packages/twenty-apps/internal/twenty-partners/src/fields/applications-on-opportunity.field.ts
new file mode 100644
index 00000000000..6c0e803dc13
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/fields/applications-on-opportunity.field.ts
@@ -0,0 +1,27 @@
+import {
+ FieldType,
+ RelationType,
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+ defineField,
+} from 'twenty-sdk/define';
+
+import {
+ APPLICATIONS_ON_OPPORTUNITY_FIELD_ID,
+ APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ APPLICATION_OPPORTUNITY_FIELD_ID,
+} from 'src/objects/application.object';
+
+export default defineField({
+ universalIdentifier: APPLICATIONS_ON_OPPORTUNITY_FIELD_ID,
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ type: FieldType.RELATION,
+ name: 'applications',
+ label: 'Applications',
+ isNullable: true,
+ relationTargetObjectMetadataUniversalIdentifier:
+ APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ relationTargetFieldMetadataUniversalIdentifier:
+ APPLICATION_OPPORTUNITY_FIELD_ID,
+ universalSettings: { relationType: RelationType.ONE_TO_MANY },
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/fields/applications-on-partner.field.ts b/packages/twenty-apps/internal/twenty-partners/src/fields/applications-on-partner.field.ts
new file mode 100644
index 00000000000..b0fb878c318
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/fields/applications-on-partner.field.ts
@@ -0,0 +1,21 @@
+import { FieldType, RelationType, defineField } from 'twenty-sdk/define';
+
+import { PARTNER_OBJECT_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import {
+ APPLICATIONS_ON_PARTNER_FIELD_ID,
+ APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ APPLICATION_PARTNER_FIELD_ID,
+} from 'src/objects/application.object';
+
+export default defineField({
+ universalIdentifier: APPLICATIONS_ON_PARTNER_FIELD_ID,
+ objectUniversalIdentifier: PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,
+ type: FieldType.RELATION,
+ name: 'applications',
+ label: 'Applications',
+ isNullable: true,
+ relationTargetObjectMetadataUniversalIdentifier:
+ APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ relationTargetFieldMetadataUniversalIdentifier: APPLICATION_PARTNER_FIELD_ID,
+ universalSettings: { relationType: RelationType.ONE_TO_MANY },
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/fields/opportunity-is-listed.field.ts b/packages/twenty-apps/internal/twenty-partners/src/fields/opportunity-is-listed.field.ts
new file mode 100644
index 00000000000..f34cef6c3f0
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/fields/opportunity-is-listed.field.ts
@@ -0,0 +1,21 @@
+import {
+ FieldType,
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+ defineField,
+} from 'twenty-sdk/define';
+
+export const OPPORTUNITY_IS_LISTED_FIELD_ID =
+ '0384ac3e-7aaa-4f32-bc6c-a6de8ebdd6c3';
+
+// Marketplace flag: a listed brief is visible to all partners. The RLS predicate that exposes
+// listed opportunities is wired in a later block; here it is just the field.
+export default defineField({
+ universalIdentifier: OPPORTUNITY_IS_LISTED_FIELD_ID,
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ type: FieldType.BOOLEAN,
+ name: 'isListed',
+ label: 'Listed',
+ icon: 'IconBuildingStore',
+ isNullable: true,
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/fields/opportunity-match-status.field.ts b/packages/twenty-apps/internal/twenty-partners/src/fields/opportunity-match-status.field.ts
deleted file mode 100644
index 69b958e0dd8..00000000000
--- a/packages/twenty-apps/internal/twenty-partners/src/fields/opportunity-match-status.field.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { MATCH_STATUS_FIELD_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
-import { FieldType, STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS, defineField } from 'twenty-sdk/define';
-
-export default defineField({
- universalIdentifier: MATCH_STATUS_FIELD_UNIVERSAL_IDENTIFIER,
- objectUniversalIdentifier: STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
- type: FieldType.SELECT,
- name: 'matchStatus',
- label: 'Match Status',
- icon: 'IconProgressCheck',
- isNullable: false,
- defaultValue: "'TO_BE_MATCHED'",
- options: [
- // Pre-match (new). NEW UUIDs generated with `uuidgen` (v4).
- { id: '8b3a1c0e-2f64-4a87-9d2b-1e3c4f5a6b78', value: 'TO_BE_MATCHED', label: 'To Be Matched', position: 0, color: 'grey' },
- { id: '4c5d6e7f-8a9b-4c0d-9e1f-2a3b4c5d6e7f', value: 'MANUAL_MATCH', label: 'Manual Match', position: 1, color: 'grey' },
- { id: '7e8f9a0b-1c2d-4e3f-8a4b-5c6d7e8f9a0b', value: 'AUTO_MATCH', label: 'Auto Match', position: 2, color: 'yellow' },
- // Post-match. Reuse DELIVERED's UUID for MATCHED so existing rows auto-relabel.
- { id: '095428d8-4680-4a2c-af83-7809dcb3f194', value: 'MATCHED', label: 'Matched', position: 3, color: 'blue' },
- { id: '2f1c79a1-ca91-4937-a4c0-6422f6534d34', value: 'INTRODUCED_TO_A_PARTNER', label: 'Introduced to a partner', position: 4, color: 'sky' },
- { id: '45cdf6ef-8672-40d5-b71f-1e5687ba5776', value: 'WORKING_WITH_A_PARTNER', label: 'Working with a partner', position: 5, color: 'turquoise' },
- { id: '7189b18d-b0f7-435a-9272-f812cba5d13d', value: 'IMPLEMENTING', label: 'Implementing', position: 6, color: 'green' },
- { id: '54cd33bc-11ea-42f1-87c8-cd9d32d2c266', value: 'WON', label: 'Won', position: 7, color: 'purple' },
- { id: '505433e8-5367-4dfb-a89a-708d5182165b', value: 'RECONNECT_LATER', label: 'Reconnect later', position: 8, color: 'orange' },
- { id: '572a9ad2-e0a6-49f2-b1f5-e36c75cc5176', value: 'LOST', label: 'Lost', position: 9, color: 'red' },
- ],
-});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/fields/opportunity-need.field.ts b/packages/twenty-apps/internal/twenty-partners/src/fields/opportunity-need.field.ts
new file mode 100644
index 00000000000..27d3d4a08fd
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/fields/opportunity-need.field.ts
@@ -0,0 +1,19 @@
+import {
+ FieldType,
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+ defineField,
+} from 'twenty-sdk/define';
+
+export const OPPORTUNITY_NEED_FIELD_ID =
+ 'fce63509-40c6-43e4-9def-d532c29cc0b8';
+
+export default defineField({
+ universalIdentifier: OPPORTUNITY_NEED_FIELD_ID,
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ type: FieldType.TEXT,
+ name: 'need',
+ label: 'Need',
+ icon: 'IconTargetArrow',
+ isNullable: true,
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/fields/opportunity-requirements.field.ts b/packages/twenty-apps/internal/twenty-partners/src/fields/opportunity-requirements.field.ts
new file mode 100644
index 00000000000..2780b1621c1
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/fields/opportunity-requirements.field.ts
@@ -0,0 +1,19 @@
+import {
+ FieldType,
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+ defineField,
+} from 'twenty-sdk/define';
+
+export const OPPORTUNITY_REQUIREMENTS_FIELD_ID =
+ '68a8e0f1-6b68-4f99-9bad-9a78c21fc56d';
+
+export default defineField({
+ universalIdentifier: OPPORTUNITY_REQUIREMENTS_FIELD_ID,
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ type: FieldType.TEXT,
+ name: 'requirements',
+ label: 'Requirements',
+ icon: 'IconListCheck',
+ isNullable: true,
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/__tests__/on-application-created.test.ts b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/__tests__/on-application-created.test.ts
new file mode 100644
index 00000000000..f8cd9179a58
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/__tests__/on-application-created.test.ts
@@ -0,0 +1,146 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+const { queryMock, mutationMock } = vi.hoisted(() => ({
+ queryMock: vi.fn(),
+ mutationMock: vi.fn(),
+}));
+
+vi.mock('twenty-client-sdk/core', () => ({
+ CoreApiClient: vi.fn(function () {
+ return { query: queryMock, mutation: mutationMock };
+ }),
+}));
+
+import { handler } from '../on-application-created';
+
+const MEMBER_ID = 'aaaaaaaa-1111-1111-1111-111111111111';
+const PARTNER_ID = 'bbbbbbbb-2222-2222-2222-222222222222';
+const APPLICATION_ID = 'cccccccc-3333-3333-3333-333333333333';
+const OPPORTUNITY_ID = 'dddddddd-4444-4444-4444-444444444444';
+const EXISTING_APPLICATION_ID = 'eeeeeeee-5555-5555-5555-555555555555';
+
+const event = (after: Record<string, unknown>) =>
+ ({ properties: { after } }) as never;
+
+describe('on-application-created', () => {
+ beforeEach(() => {
+ queryMock.mockReset();
+ mutationMock.mockReset();
+ mutationMock.mockResolvedValue({ updateApplication: { id: APPLICATION_ID } });
+ });
+
+ it('does nothing when partnerId is already set (admin path)', async () => {
+ const result = await handler(
+ event({ id: APPLICATION_ID, partnerId: PARTNER_ID }),
+ );
+ expect(result).toEqual({});
+ expect(queryMock).not.toHaveBeenCalled();
+ expect(mutationMock).not.toHaveBeenCalled();
+ });
+
+ it('does nothing when createdBy.workspaceMemberId is missing', async () => {
+ const result = await handler(
+ event({ id: APPLICATION_ID, createdBy: {} }),
+ );
+ expect(result).toEqual({});
+ expect(queryMock).not.toHaveBeenCalled();
+ expect(mutationMock).not.toHaveBeenCalled();
+ });
+
+ it('does nothing when the member maps to no Partner', async () => {
+ queryMock.mockResolvedValue({ partners: { edges: [] } });
+
+ const result = await handler(
+ event({
+ id: APPLICATION_ID,
+ createdBy: { workspaceMemberId: MEMBER_ID },
+ }),
+ );
+ expect(result).toEqual({});
+ expect(queryMock).toHaveBeenCalledTimes(1);
+ expect(mutationMock).not.toHaveBeenCalled();
+ });
+
+ it('updates application with partnerId on the happy path', async () => {
+ queryMock.mockResolvedValue({
+ partners: { edges: [{ node: { id: PARTNER_ID } }] },
+ });
+
+ const result = await handler(
+ event({
+ id: APPLICATION_ID,
+ createdBy: { workspaceMemberId: MEMBER_ID },
+ }),
+ );
+
+ expect(result).toEqual({ applied: true, partnerId: PARTNER_ID });
+ expect(queryMock).toHaveBeenCalledTimes(1);
+ expect(mutationMock).toHaveBeenCalledTimes(1);
+ const call = mutationMock.mock.calls[0][0];
+ const args = call.updateApplication.__args;
+ expect(args.id).toBe(APPLICATION_ID);
+ expect(args.data.partnerId).toBe(PARTNER_ID);
+ expect(args.data.partnerUserId).toBe(MEMBER_ID);
+ expect(args.data.state).toBe('APPLIED');
+ expect(typeof args.data.lastActivityAt).toBe('string');
+ });
+
+ it('stamps normally when no duplicate exists for the same opportunity and partner', async () => {
+ queryMock
+ .mockResolvedValueOnce({
+ partners: { edges: [{ node: { id: PARTNER_ID } }] },
+ })
+ .mockResolvedValueOnce({ applications: { edges: [] } });
+
+ const result = await handler(
+ event({
+ id: APPLICATION_ID,
+ opportunityId: OPPORTUNITY_ID,
+ createdBy: { workspaceMemberId: MEMBER_ID },
+ }),
+ );
+
+ expect(result).toEqual({ applied: true, partnerId: PARTNER_ID });
+ expect(queryMock).toHaveBeenCalledTimes(2);
+ expect(mutationMock).toHaveBeenCalledTimes(1);
+ const call = mutationMock.mock.calls[0][0];
+ expect(call.updateApplication.__args.id).toBe(APPLICATION_ID);
+ expect(call.updateApplication.__args.data.partnerId).toBe(PARTNER_ID);
+ expect(call.updateApplication.__args.data.partnerUserId).toBe(MEMBER_ID);
+ expect(call.updateApplication.__args.data.state).toBe('APPLIED');
+ });
+
+ it('soft-deletes a duplicate application and keeps the existing one', async () => {
+ queryMock
+ .mockResolvedValueOnce({
+ partners: { edges: [{ node: { id: PARTNER_ID } }] },
+ })
+ .mockResolvedValueOnce({
+ applications: { edges: [{ node: { id: EXISTING_APPLICATION_ID } }] },
+ });
+ mutationMock.mockResolvedValue({
+ deleteApplication: { id: APPLICATION_ID },
+ });
+
+ const result = await handler(
+ event({
+ id: APPLICATION_ID,
+ opportunityId: OPPORTUNITY_ID,
+ createdBy: { workspaceMemberId: MEMBER_ID },
+ }),
+ );
+
+ expect(result).toEqual({
+ duplicate: true,
+ keptExisting: EXISTING_APPLICATION_ID,
+ });
+ expect(queryMock).toHaveBeenCalledTimes(2);
+ expect(mutationMock).toHaveBeenCalledTimes(1);
+ expect(mutationMock.mock.calls[0][0].deleteApplication.__args.id).toBe(
+ APPLICATION_ID,
+ );
+ expect(
+ mutationMock.mock.calls.find((call) => call[0].updateApplication),
+ ).toBeUndefined();
+ });
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/__tests__/on-application-set-name.test.ts b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/__tests__/on-application-set-name.test.ts
new file mode 100644
index 00000000000..3bf5fc7da8d
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/__tests__/on-application-set-name.test.ts
@@ -0,0 +1,50 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+const { queryMock, mutationMock } = vi.hoisted(() => ({
+ queryMock: vi.fn(),
+ mutationMock: vi.fn(),
+}));
+
+vi.mock('twenty-client-sdk/core', () => ({
+ CoreApiClient: vi.fn(function () {
+ return { query: queryMock, mutation: mutationMock };
+ }),
+}));
+
+import { handler } from '../on-application-set-name';
+
+const event = (after: Record<string, unknown>, updatedFields: string[]) =>
+ ({ properties: { after, updatedFields } }) as never;
+
+describe('on-application-set-name', () => {
+ beforeEach(() => {
+ queryMock.mockReset();
+ mutationMock.mockReset();
+ mutationMock.mockResolvedValue({ updateApplication: { id: 'a1' } });
+ });
+
+ it('labels the application from partner + opportunity names', async () => {
+ queryMock.mockResolvedValue({
+ application: {
+ id: 'a1',
+ partner: { name: 'Acme Partners' },
+ opportunity: { name: 'Q3 Renewal' },
+ },
+ });
+
+ await handler(event({ id: 'a1' }, ['partnerId']));
+
+ expect(mutationMock).toHaveBeenCalledWith({
+ updateApplication: {
+ __args: { id: 'a1', data: { name: 'Acme Partners · Q3 Renewal' } },
+ id: true,
+ },
+ });
+ });
+
+ it('ignores updates that touch neither relation', async () => {
+ await handler(event({ id: 'a1' }, ['pitch']));
+ expect(queryMock).not.toHaveBeenCalled();
+ expect(mutationMock).not.toHaveBeenCalled();
+ });
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/__tests__/on-opportunity-auto-match.integration-test.ts b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/__tests__/on-opportunity-auto-match.integration-test.ts
deleted file mode 100644
index 762f15f2456..00000000000
--- a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/__tests__/on-opportunity-auto-match.integration-test.ts
+++ /dev/null
@@ -1,220 +0,0 @@
-import { CoreApiClient } from 'twenty-client-sdk/core';
-import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest';
-
-// Helpers
-async function createOpp(client: CoreApiClient, name: string) {
- const r = await client.mutation({
- createOpportunity: {
- __args: { data: { name } },
- id: true,
- matchStatus: true,
- },
- } as any);
- return (r as any).createOpportunity as { id: string; matchStatus: string };
-}
-
-async function destroyOpp(client: CoreApiClient, id: string) {
- await client
- .mutation({ destroyOpportunity: { __args: { id }, id: true } } as any)
- .catch(() => {});
-}
-
-async function getOpp(client: CoreApiClient, id: string) {
- const r = await client.query({
- opportunity: {
- __args: { filter: { id: { eq: id } } },
- id: true,
- matchStatus: true,
- partner: { id: true },
- },
- } as any);
- return (r as any).opportunity as {
- id: string;
- matchStatus: string;
- partner: { id: string } | null;
- };
-}
-
-async function sleep(ms: number) {
- return new Promise((r) => setTimeout(r, ms));
-}
-
-describe('on-opportunity-auto-match (success path)', () => {
- let client: CoreApiClient;
- const created: string[] = [];
- let seededPartnerId: string | null = null;
-
- beforeAll(async () => {
- client = new CoreApiClient();
- // Ensure at least one ACTIVE+AVAILABLE partner exists for the function to pick.
- const existing = await client.query({
- partners: {
- __args: {
- filter: { validationStage: { eq: 'VALIDATED' }, availability: { eq: 'AVAILABLE' } },
- first: 1,
- },
- edges: { node: { id: true } },
- },
- } as any);
- if ((existing as any).partners.edges.length === 0) {
- const r = await client.mutation({
- createPartner: {
- __args: {
- data: {
- name: '[test] auto-match seed partner',
- slug: 'test-auto-match-seed',
- validationStage: 'VALIDATED',
- availability: 'AVAILABLE',
- },
- },
- id: true,
- },
- } as any);
- seededPartnerId = (r as any).createPartner.id;
- }
- });
-
- afterAll(async () => {
- if (seededPartnerId) {
- await client
- .mutation({ destroyPartner: { __args: { id: seededPartnerId }, id: true } } as any)
- .catch(() => {});
- }
- });
-
- beforeEach(() => {
- client = new CoreApiClient();
- });
-
- afterEach(async () => {
- for (const id of created) await destroyOpp(client, id);
- created.length = 0;
- });
-
- it('defaults a new opportunity to TO_BE_MATCHED', async () => {
- const opp = await createOpp(client, `[test] default status ${Date.now()}`);
- created.push(opp.id);
- expect(opp.matchStatus).toBe('TO_BE_MATCHED');
- });
-
- it('assigns a partner and flips to MATCHED when set to AUTO_MATCH', async () => {
- const opp = await createOpp(client, `[test] auto match ${Date.now()}`);
- created.push(opp.id);
-
- await client.mutation({
- updateOpportunity: {
- __args: { id: opp.id, data: { matchStatus: 'AUTO_MATCH' } },
- id: true,
- },
- } as any);
-
- // Logic function runs async (~2s per spec). Poll up to 10s.
- let final = await getOpp(client, opp.id);
- for (let i = 0; i < 20 && final.matchStatus === 'AUTO_MATCH'; i++) {
- await sleep(500);
- final = await getOpp(client, opp.id);
- }
-
- expect(final.matchStatus).toBe('MATCHED');
- expect(final.partner?.id).toBeDefined();
- });
-});
-
-describe('on-opportunity-auto-match (failure path)', () => {
- let client: CoreApiClient;
- const createdOpps: string[] = [];
- const flippedPartners: Array<{ id: string; prevAvailability: string }> = [];
-
- beforeEach(() => {
- client = new CoreApiClient();
- });
-
- afterEach(async () => {
- // Restore partner availabilities first so other tests find a partner.
- for (const p of flippedPartners) {
- await client
- .mutation({
- updatePartner: {
- __args: { id: p.id, data: { availability: p.prevAvailability } },
- id: true,
- },
- } as any)
- .catch(() => {});
- }
- flippedPartners.length = 0;
-
- for (const id of createdOpps) await destroyOpp(client, id);
- createdOpps.length = 0;
- });
-
- it('hands off to MANUAL_MATCH with a Note when no partner is available', async () => {
- // Make every AVAILABLE partner UNAVAILABLE for the duration of this test.
- const all = await client.query({
- partners: {
- __args: {
- filter: { availability: { eq: 'AVAILABLE' } },
- first: 100,
- },
- edges: { node: { id: true, availability: true } },
- },
- } as any);
-
- const edges = ((all as any)?.partners?.edges ?? []) as Array<{
- node: { id: string; availability: string };
- }>;
-
- for (const e of edges) {
- flippedPartners.push({ id: e.node.id, prevAvailability: e.node.availability });
- await client.mutation({
- updatePartner: {
- __args: { id: e.node.id, data: { availability: 'UNAVAILABLE' } },
- id: true,
- },
- } as any);
- }
-
- const opp = await createOpp(client, `[test] no-partner ${Date.now()}`);
- createdOpps.push(opp.id);
-
- await client.mutation({
- updateOpportunity: {
- __args: { id: opp.id, data: { matchStatus: 'AUTO_MATCH' } },
- id: true,
- },
- } as any);
-
- let final = await getOpp(client, opp.id);
- for (let i = 0; i < 20 && final.matchStatus === 'AUTO_MATCH'; i++) {
- await sleep(500);
- final = await getOpp(client, opp.id);
- }
-
- expect(final.matchStatus).toBe('MANUAL_MATCH');
- expect(final.partner).toBeNull();
-
- // Confirm a Note was attached.
- const notes = await client.query({
- noteTargets: {
- __args: {
- filter: { targetOpportunityId: { eq: opp.id } },
- first: 10,
- },
- edges: {
- node: {
- id: true,
- note: { id: true, title: true, bodyV2: { markdown: true } },
- },
- },
- },
- } as any);
- const noteEdges = ((notes as any)?.noteTargets?.edges ?? []) as Array<{
- node: { note: { title: string; bodyV2: { markdown: string } } };
- }>;
-
- const autoMatchNote = noteEdges.find((e) =>
- e.node.note.title.toLowerCase().includes('auto-match'),
- );
- expect(autoMatchNote).toBeDefined();
- expect(autoMatchNote!.node.note.bodyV2.markdown).toContain('No partners');
- });
-});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/__tests__/on-opportunity-partner-won.test.ts b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/__tests__/on-opportunity-partner-won.test.ts
new file mode 100644
index 00000000000..d5a0462df5e
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/__tests__/on-opportunity-partner-won.test.ts
@@ -0,0 +1,81 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+const { queryMock, mutationMock } = vi.hoisted(() => ({
+ queryMock: vi.fn(),
+ mutationMock: vi.fn(),
+}));
+vi.mock('twenty-client-sdk/core', () => ({
+ CoreApiClient: vi.fn(function () {
+ return { query: queryMock, mutation: mutationMock };
+ }),
+}));
+
+import { handler } from '../on-opportunity-partner-won';
+
+const OPP = 'aaaaaaaa-0000-0000-0000-000000000001';
+const P_WIN = 'bbbbbbbb-0000-0000-0000-000000000001';
+const P_OTHER = 'bbbbbbbb-0000-0000-0000-000000000002';
+
+const event = (after: Record<string, unknown>, updatedFields: string[]) =>
+ ({ properties: { after, updatedFields } }) as never;
+
+const apps = (...nodes: Array<Record<string, unknown>>) =>
+ ({ applications: { edges: nodes.map((node) => ({ node })) } });
+
+const stateUpdates = () =>
+ mutationMock.mock.calls.map((c) => {
+ const a = c[0].updateApplication.__args;
+ return { id: a.id, state: a.data.state };
+ });
+
+describe('on-opportunity-partner-won cascade', () => {
+ beforeEach(() => {
+ queryMock.mockReset();
+ mutationMock.mockReset();
+ mutationMock.mockResolvedValue({ updateApplication: { id: 'x' } });
+ });
+
+ it('ignores updates that do not touch partnerId', async () => {
+ const result = await handler(event({ id: OPP, partnerId: P_WIN }, ['stage']));
+ expect(result).toEqual({});
+ expect(queryMock).not.toHaveBeenCalled();
+ });
+
+ it('on assign: winner -> WON, other active apps -> BACKUP, DECLINED untouched', async () => {
+ queryMock.mockResolvedValue(
+ apps(
+ { id: 'app-win', partnerId: P_WIN, state: 'APPLIED' },
+ { id: 'app-other', partnerId: P_OTHER, state: 'APPLIED' },
+ { id: 'app-declined', partnerId: 'p3', state: 'DECLINED' },
+ ),
+ );
+ await handler(event({ id: OPP, partnerId: P_WIN }, ['partnerId']));
+ const updates = stateUpdates();
+ expect(updates).toContainEqual({ id: 'app-win', state: 'WON' });
+ expect(updates).toContainEqual({ id: 'app-other', state: 'BACKUP' });
+ expect(updates.find((u) => u.id === 'app-declined')).toBeUndefined();
+ });
+
+ it('on unassign: WON and BACKUP -> APPLIED, DECLINED untouched', async () => {
+ queryMock.mockResolvedValue(
+ apps(
+ { id: 'app-win', partnerId: P_WIN, state: 'WON' },
+ { id: 'app-bk', partnerId: P_OTHER, state: 'BACKUP' },
+ { id: 'app-declined', partnerId: 'p3', state: 'DECLINED' },
+ ),
+ );
+ await handler(event({ id: OPP, partnerId: null }, ['partnerId']));
+ const updates = stateUpdates();
+ expect(updates).toContainEqual({ id: 'app-win', state: 'APPLIED' });
+ expect(updates).toContainEqual({ id: 'app-bk', state: 'APPLIED' });
+ expect(updates.find((u) => u.id === 'app-declined')).toBeUndefined();
+ });
+
+ it('does not rewrite an app already in its target state', async () => {
+ queryMock.mockResolvedValue(
+ apps({ id: 'app-win', partnerId: P_WIN, state: 'WON' }),
+ );
+ await handler(event({ id: OPP, partnerId: P_WIN }, ['partnerId']));
+ expect(stateUpdates().find((u) => u.id === 'app-win')).toBeUndefined();
+ });
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/on-application-created.ts b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/on-application-created.ts
new file mode 100644
index 00000000000..bb10cb67639
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/on-application-created.ts
@@ -0,0 +1,89 @@
+import { CoreApiClient, type CoreSchema } from 'twenty-client-sdk/core';
+import {
+ type DatabaseEventPayload,
+ defineLogicFunction,
+ type ObjectRecordCreateEvent,
+} from 'twenty-sdk/define';
+
+const ON_APPLICATION_CREATED_FN_ID = '0e055a1c-b8b3-4572-89f3-e76e37bc3f9e';
+
+// A partner self-applies via the "Apply to brief as partner" workflow: a Create Record action
+// makes an Application with the opportunity set and createdBy = the clicking member, but no
+// partner. Resolve the partner from createdBy and complete the candidacy. Admin-created
+// applications (partner already set, or the creator is not a partner) are left untouched. The
+// name is set by on-application-set-name, which fires on the partnerId update below.
+export const handler = async (
+ payload: DatabaseEventPayload<ObjectRecordCreateEvent<CoreSchema.Application>>,
+): Promise<Record<string, unknown>> => {
+ const after = payload.properties.after;
+ const applicationId = after?.id;
+ if (!applicationId) return {};
+ if (after.partnerId) return {}; // already linked (admin path) — leave it
+
+ const memberId = after.createdBy?.workspaceMemberId;
+ if (!memberId) return {}; // no member actor (system/import) — not a self-apply
+
+ const client = new CoreApiClient();
+ const partnerRes = await client.query({
+ partners: {
+ __args: { filter: { partnerUserId: { eq: memberId } }, first: 1 },
+ edges: { node: { id: true } },
+ },
+ });
+ const partnerId = partnerRes.partners?.edges?.[0]?.node?.id;
+ if (!partnerId) return {}; // creator isn't a partner (e.g. admin) — leave it
+
+ const opportunityId = after.opportunityId;
+ if (opportunityId) {
+ const existingRes = await client.query({
+ applications: {
+ __args: {
+ filter: {
+ opportunityId: { eq: opportunityId },
+ partnerId: { eq: partnerId },
+ },
+ first: 1,
+ },
+ edges: { node: { id: true } },
+ },
+ });
+ const existingId = existingRes.applications?.edges?.find(
+ (edge) => edge.node?.id && edge.node.id !== applicationId,
+ )?.node?.id;
+ if (existingId) {
+ await client.mutation({
+ deleteApplication: {
+ __args: { id: applicationId },
+ id: true,
+ },
+ });
+ return { duplicate: true, keptExisting: existingId };
+ }
+ }
+
+ const now = new Date().toISOString();
+ await client.mutation({
+ updateApplication: {
+ __args: {
+ id: applicationId,
+ data: {
+ partnerId,
+ partnerUserId: memberId,
+ state: 'APPLIED',
+ lastActivityAt: now,
+ },
+ },
+ id: true,
+ },
+ });
+ // ponytail: dedupe by (opportunity, partner) above; two near-simultaneous creates could still both pass before either stamps — acceptable.
+ return { applied: true, partnerId };
+};
+
+export default defineLogicFunction({
+ universalIdentifier: ON_APPLICATION_CREATED_FN_ID,
+ name: 'on-application-created',
+ timeoutSeconds: 15,
+ handler,
+ databaseEventTriggerSettings: { eventName: 'application.created' },
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/on-application-set-name.ts b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/on-application-set-name.ts
new file mode 100644
index 00000000000..ccfe1d613d3
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/on-application-set-name.ts
@@ -0,0 +1,48 @@
+import { CoreApiClient, type CoreSchema } from 'twenty-client-sdk/core';
+import {
+ type DatabaseEventPayload,
+ defineLogicFunction,
+ type ObjectRecordUpdateEvent,
+} from 'twenty-sdk/define';
+
+const ON_APPLICATION_SET_NAME_FN_ID = '8f123b54-a7c5-42d3-8049-a240930257a7';
+
+// Re-label an Application "<partner> · <opportunity>" whenever either relation changes.
+export const handler = async (
+ payload: DatabaseEventPayload<ObjectRecordUpdateEvent<CoreSchema.Application>>,
+): Promise<Record<string, unknown>> => {
+ const { after, updatedFields } = payload.properties;
+ const touchedRelation =
+ updatedFields?.includes('partnerId') ||
+ updatedFields?.includes('opportunityId');
+ if (!touchedRelation) return {};
+ const id = after?.id;
+ if (!id) return {};
+
+ const client = new CoreApiClient();
+ const result = await client.query({
+ application: {
+ __args: { filter: { id: { eq: id } } },
+ id: true,
+ partner: { name: true },
+ opportunity: { name: true },
+ },
+ });
+
+ const partnerName = result.application?.partner?.name ?? 'Unassigned';
+ const opportunityName = result.application?.opportunity?.name ?? 'No brief';
+ const name = `${partnerName} · ${opportunityName}`;
+
+ await client.mutation({
+ updateApplication: { __args: { id, data: { name } }, id: true },
+ });
+ return { labelled: name };
+};
+
+export default defineLogicFunction({
+ universalIdentifier: ON_APPLICATION_SET_NAME_FN_ID,
+ name: 'on-application-set-name',
+ timeoutSeconds: 15,
+ handler,
+ databaseEventTriggerSettings: { eventName: 'application.updated' },
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/on-opportunity-auto-match.ts b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/on-opportunity-auto-match.ts
deleted file mode 100644
index 88400ce386a..00000000000
--- a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/on-opportunity-auto-match.ts
+++ /dev/null
@@ -1,105 +0,0 @@
-import { type DatabaseEventPayload, defineLogicFunction } from 'twenty-sdk/define';
-import { CoreApiClient } from 'twenty-client-sdk/core';
-
-import { ON_OPP_AUTO_MATCH_FN_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
-
-// Fires when an opportunity's matchStatus is set to 'AUTO_MATCH'.
-// Happy path: picks the longest-idle ACTIVE+AVAILABLE partner, assigns it, flips to 'MATCHED'.
-// Failure path: no partner available → flips to 'MANUAL_MATCH' and creates an audit Note.
-const handler = async (payload: DatabaseEventPayload) => {
- const props = payload.properties as {
- after?: { id: string; matchStatus?: string; partnerId?: string | null };
- before?: { matchStatus?: string };
- updatedFields?: string[];
- };
-
- if (!props.updatedFields?.includes('matchStatus')) return {};
- if (props.after?.matchStatus !== 'AUTO_MATCH') return {};
- if (props.before?.matchStatus === 'AUTO_MATCH') return {};
- if (props.after.partnerId) return {};
-
- const client = new CoreApiClient();
-
- const partnersResult = await client.query({
- partners: {
- __args: {
- filter: {
- validationStage: { eq: 'VALIDATED' },
- availability: { eq: 'AVAILABLE' },
- },
- orderBy: [{ lastMatchAt: 'AscNullsFirst' }],
- first: 1,
- },
- edges: { node: { id: true, lastMatchAt: true } },
- },
- } as any);
-
- const topPartner = (partnersResult.partners as any).edges[0]?.node;
- if (!topPartner) {
- const noteBody =
- `Auto-match attempted ${new Date().toISOString()}.\n` +
- `No partners matched (status=ACTIVE, availability=AVAILABLE).\n` +
- `Status moved to Manual Match — pick a partner manually or ` +
- `update partner availability and retry by setting status back to Auto Match.`;
-
- try {
- const noteResult = await client.mutation({
- createNote: {
- __args: { data: { title: 'Auto-match failed', bodyV2: { markdown: noteBody } } },
- id: true,
- },
- } as any);
- const noteId = (noteResult as any).createNote.id as string;
-
- await client.mutation({
- createNoteTarget: {
- __args: { data: { noteId, targetOpportunityId: props.after.id } },
- id: true,
- },
- } as any);
- } catch {
- // Note creation is best-effort; status flip is the critical action.
- }
-
- await client.mutation({
- updateOpportunity: {
- __args: { id: props.after.id, data: { matchStatus: 'MANUAL_MATCH' } },
- id: true,
- },
- } as any);
-
- return { matched: false, reason: 'no_partner_available' };
- }
-
- await client.mutation({
- updateOpportunity: {
- __args: {
- id: props.after.id,
- data: { partnerId: topPartner.id, matchStatus: 'MATCHED' },
- },
- id: true,
- },
- } as any);
-
- await client.mutation({
- updatePartner: {
- __args: {
- id: topPartner.id,
- data: { lastMatchAt: new Date().toISOString() },
- },
- id: true,
- },
- } as any);
-
- return { matched: true, partnerId: topPartner.id };
-};
-
-export default defineLogicFunction({
- universalIdentifier: ON_OPP_AUTO_MATCH_FN_UNIVERSAL_IDENTIFIER,
- name: 'on-opportunity-auto-match',
- timeoutSeconds: 10,
- handler,
- databaseEventTriggerSettings: {
- eventName: 'opportunity.updated',
- },
-});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/on-opportunity-partner-won.ts b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/on-opportunity-partner-won.ts
new file mode 100644
index 00000000000..5da37a7a54c
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/on-opportunity-partner-won.ts
@@ -0,0 +1,94 @@
+import { CoreApiClient, type CoreSchema } from 'twenty-client-sdk/core';
+import {
+ type DatabaseEventPayload,
+ defineLogicFunction,
+ type ObjectRecordUpdateEvent,
+} from 'twenty-sdk/define';
+
+const ON_OPP_PARTNER_WON_FN_ID = '683f407e-e7a0-435d-a380-e51e536770f8';
+
+const APPLICATIONS_PAGE_SIZE = 200;
+
+// Every application on the brief, paginated fully — a single capped page would strand overflow
+// applications in a stale WON/BACKUP/APPLIED state out of sync with Opportunity.partner.
+async function collectApplications(client: CoreApiClient, opportunityId: string) {
+ const query = (after?: string) =>
+ client.query({
+ applications: {
+ __args: {
+ filter: { opportunityId: { eq: opportunityId } },
+ first: APPLICATIONS_PAGE_SIZE,
+ ...(after ? { after } : {}),
+ },
+ edges: { node: { id: true, partnerId: true, state: true } },
+ pageInfo: { hasNextPage: true, endCursor: true },
+ },
+ });
+ type ApplicationNode = NonNullable<
+ NonNullable<
+ Awaited<ReturnType<typeof query>>['applications']
+ >['edges'][number]['node']
+ >;
+ const applications: ApplicationNode[] = [];
+ let after: string | undefined;
+ for (;;) {
+ const page = await query(after);
+ for (const edge of page.applications?.edges ?? []) {
+ if (edge?.node) applications.push(edge.node);
+ }
+ if (!page.applications?.pageInfo?.hasNextPage) break;
+ after = page.applications.pageInfo.endCursor ?? undefined;
+ }
+ return applications;
+}
+
+// WON/BACKUP mirror of Opportunity.partner: on assign, winner -> WON and other active apps ->
+// BACKUP; on unassign, WON/BACKUP -> APPLIED. DECLINED is never touched. Runs under the app
+// identity, bypassing partner locks.
+export const handler = async (
+ payload: DatabaseEventPayload<ObjectRecordUpdateEvent<CoreSchema.Opportunity>>,
+): Promise<Record<string, unknown>> => {
+ const { after, updatedFields } = payload.properties;
+ if (!updatedFields?.includes('partnerId')) return {};
+ const opportunityId = after?.id;
+ if (!opportunityId) return {};
+ const newPartnerId = after?.partnerId ?? null;
+
+ const client = new CoreApiClient();
+ const applications = await collectApplications(client, opportunityId);
+
+ const setState = async (id: string, state: string) => {
+ await client.mutation({
+ updateApplication: { __args: { id, data: { state } }, id: true },
+ });
+ };
+
+ if (newPartnerId) {
+ // Winner -> WON; every other active (non-DECLINED) application -> BACKUP.
+ for (const node of applications) {
+ if (node.state === 'DECLINED') continue;
+ const target = node.partnerId === newPartnerId ? 'WON' : 'BACKUP';
+ if (node.state !== target) await setState(node.id, target);
+ }
+ const winner = applications.find(
+ (node) => node.partnerId === newPartnerId,
+ );
+ return { won: winner?.id ?? null };
+ }
+
+ // Unassigned: WON and BACKUP applications re-open to APPLIED. DECLINED untouched.
+ for (const node of applications) {
+ if (node.state === 'WON' || node.state === 'BACKUP') {
+ await setState(node.id, 'APPLIED');
+ }
+ }
+ return { won: null, cleared: true };
+};
+
+export default defineLogicFunction({
+ universalIdentifier: ON_OPP_PARTNER_WON_FN_ID,
+ name: 'on-opportunity-partner-won',
+ timeoutSeconds: 15,
+ handler,
+ databaseEventTriggerSettings: { eventName: 'opportunity.updated' },
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/all-opportunities.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/all-opportunities.navigation-menu-item.ts
index 6728a99188b..02abaddcdf3 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/all-opportunities.navigation-menu-item.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/all-opportunities.navigation-menu-item.ts
@@ -9,7 +9,7 @@ export default defineNavigationMenuItem({
universalIdentifier: ALL_OPPORTUNITIES_NAV_UNIVERSAL_IDENTIFIER,
type: NavigationMenuItemType.VIEW,
icon: 'IconTargetArrow',
- position: 3,
+ position: 5,
folderUniversalIdentifier: '0b2e499a-ae74-45e0-af08-243e19fc56aa',
viewUniversalIdentifier: ALL_OPPORTUNITIES_VIEW_UNIVERSAL_IDENTIFIER,
});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/applications-by-opportunity.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/applications-by-opportunity.navigation-menu-item.ts
new file mode 100644
index 00000000000..5de3d7bf256
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/applications-by-opportunity.navigation-menu-item.ts
@@ -0,0 +1,12 @@
+import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+
+import { APPLICATIONS_BY_OPPORTUNITY_VIEW_UNIVERSAL_IDENTIFIER } from 'src/views/applications-by-opportunity.view';
+
+export default defineNavigationMenuItem({
+ universalIdentifier: 'e80057bf-9b46-4502-8ccd-b25870ec293c',
+ type: NavigationMenuItemType.VIEW,
+ icon: 'IconTargetArrow',
+ position: 6,
+ folderUniversalIdentifier: '0b2e499a-ae74-45e0-af08-243e19fc56aa',
+ viewUniversalIdentifier: APPLICATIONS_BY_OPPORTUNITY_VIEW_UNIVERSAL_IDENTIFIER,
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/applications-review.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/applications-review.navigation-menu-item.ts
new file mode 100644
index 00000000000..04b29ecd23e
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/applications-review.navigation-menu-item.ts
@@ -0,0 +1,12 @@
+import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+
+import { APPLICATIONS_REVIEW_VIEW_UNIVERSAL_IDENTIFIER } from 'src/views/applications-review.view';
+
+export default defineNavigationMenuItem({
+ universalIdentifier: 'fcf7e5e8-9ec2-4f08-898a-39e51a2787d0',
+ type: NavigationMenuItemType.VIEW,
+ icon: 'IconUserPlus',
+ position: 4,
+ folderUniversalIdentifier: '0b2e499a-ae74-45e0-af08-243e19fc56aa',
+ viewUniversalIdentifier: APPLICATIONS_REVIEW_VIEW_UNIVERSAL_IDENTIFIER,
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/briefs-to-match.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/briefs-to-match.navigation-menu-item.ts
new file mode 100644
index 00000000000..897f4c4a5f4
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/briefs-to-match.navigation-menu-item.ts
@@ -0,0 +1,12 @@
+import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+
+import { BRIEFS_TO_MATCH_VIEW_UNIVERSAL_IDENTIFIER } from 'src/views/briefs-to-match.view';
+
+export default defineNavigationMenuItem({
+ universalIdentifier: 'c46f6b03-ee43-4799-9615-270ad28d2848',
+ type: NavigationMenuItemType.VIEW,
+ icon: 'IconUserOff',
+ position: 0,
+ folderUniversalIdentifier: '0b2e499a-ae74-45e0-af08-243e19fc56aa',
+ viewUniversalIdentifier: BRIEFS_TO_MATCH_VIEW_UNIVERSAL_IDENTIFIER,
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/deals-board.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/deals-board.navigation-menu-item.ts
new file mode 100644
index 00000000000..35e3894ce99
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/deals-board.navigation-menu-item.ts
@@ -0,0 +1,12 @@
+import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+
+import { DEALS_BOARD_VIEW_UNIVERSAL_IDENTIFIER } from 'src/views/deals-board.view';
+
+export default defineNavigationMenuItem({
+ universalIdentifier: '9e4dde3a-46f1-431c-b682-2e1fa8a5622c',
+ type: NavigationMenuItemType.VIEW,
+ icon: 'IconLayoutKanban',
+ position: 1,
+ folderUniversalIdentifier: '0b2e499a-ae74-45e0-af08-243e19fc56aa',
+ viewUniversalIdentifier: DEALS_BOARD_VIEW_UNIVERSAL_IDENTIFIER,
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/followup-applications.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/followup-applications.navigation-menu-item.ts
new file mode 100644
index 00000000000..6f7f9372b08
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/followup-applications.navigation-menu-item.ts
@@ -0,0 +1,12 @@
+import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+
+import { FOLLOWUP_APPLICATIONS_VIEW_UNIVERSAL_IDENTIFIER } from 'src/views/followup-applications.view';
+
+export default defineNavigationMenuItem({
+ universalIdentifier: '636cddf9-b104-432d-a5d3-3bad36b7a54a',
+ type: NavigationMenuItemType.VIEW,
+ icon: 'IconClock',
+ position: 7,
+ folderUniversalIdentifier: '0b2e499a-ae74-45e0-af08-243e19fc56aa',
+ viewUniversalIdentifier: FOLLOWUP_APPLICATIONS_VIEW_UNIVERSAL_IDENTIFIER,
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/followup-briefs.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/followup-briefs.navigation-menu-item.ts
new file mode 100644
index 00000000000..916cf17b93a
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/followup-briefs.navigation-menu-item.ts
@@ -0,0 +1,12 @@
+import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+
+import { FOLLOWUP_BRIEFS_VIEW_UNIVERSAL_IDENTIFIER } from 'src/views/followup-briefs.view';
+
+export default defineNavigationMenuItem({
+ universalIdentifier: 'd4017fb3-0bfd-4099-94e8-e1ceffa8faca',
+ type: NavigationMenuItemType.VIEW,
+ icon: 'IconClockExclamation',
+ position: 8,
+ folderUniversalIdentifier: '0b2e499a-ae74-45e0-af08-243e19fc56aa',
+ viewUniversalIdentifier: FOLLOWUP_BRIEFS_VIEW_UNIVERSAL_IDENTIFIER,
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/my-applications.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/my-applications.navigation-menu-item.ts
new file mode 100644
index 00000000000..11dc58bf3f7
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/my-applications.navigation-menu-item.ts
@@ -0,0 +1,14 @@
+import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+
+import { MY_APPLICATIONS_VIEW_UNIVERSAL_IDENTIFIER } from 'src/views/my-applications.view';
+
+import { PARTNER_WORKSPACE_FOLDER_UNIVERSAL_IDENTIFIER } from './partner-workspace-folder.navigation-menu-item';
+
+export default defineNavigationMenuItem({
+ universalIdentifier: '71c418f0-5761-4797-830a-2cae6d4bdd49',
+ type: NavigationMenuItemType.VIEW,
+ icon: 'IconSend',
+ position: 1,
+ folderUniversalIdentifier: PARTNER_WORKSPACE_FOLDER_UNIVERSAL_IDENTIFIER,
+ viewUniversalIdentifier: MY_APPLICATIONS_VIEW_UNIVERSAL_IDENTIFIER,
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/my-deals.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/my-deals.navigation-menu-item.ts
new file mode 100644
index 00000000000..fb400e3662c
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/my-deals.navigation-menu-item.ts
@@ -0,0 +1,14 @@
+import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+
+import { MY_DEALS_VIEW_UNIVERSAL_IDENTIFIER } from 'src/views/my-deals.view';
+
+import { PARTNER_WORKSPACE_FOLDER_UNIVERSAL_IDENTIFIER } from './partner-workspace-folder.navigation-menu-item';
+
+export default defineNavigationMenuItem({
+ universalIdentifier: '783d4920-6bf6-4dbf-b705-228ffcc9a7d7',
+ type: NavigationMenuItemType.VIEW,
+ icon: 'IconHandshake',
+ position: 2,
+ folderUniversalIdentifier: PARTNER_WORKSPACE_FOLDER_UNIVERSAL_IDENTIFIER,
+ viewUniversalIdentifier: MY_DEALS_VIEW_UNIVERSAL_IDENTIFIER,
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/my-profile.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/my-profile.navigation-menu-item.ts
new file mode 100644
index 00000000000..022a894449f
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/my-profile.navigation-menu-item.ts
@@ -0,0 +1,14 @@
+import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+
+import { MY_PROFILE_VIEW_UNIVERSAL_IDENTIFIER } from 'src/views/my-profile.view';
+
+import { PARTNER_WORKSPACE_FOLDER_UNIVERSAL_IDENTIFIER } from './partner-workspace-folder.navigation-menu-item';
+
+export default defineNavigationMenuItem({
+ universalIdentifier: '85c69095-516d-40b8-864d-f0a20f1ad88f',
+ type: NavigationMenuItemType.VIEW,
+ icon: 'IconUser',
+ position: 3,
+ folderUniversalIdentifier: PARTNER_WORKSPACE_FOLDER_UNIVERSAL_IDENTIFIER,
+ viewUniversalIdentifier: MY_PROFILE_VIEW_UNIVERSAL_IDENTIFIER,
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/open-briefs.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/open-briefs.navigation-menu-item.ts
new file mode 100644
index 00000000000..54e0bd9b87d
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/open-briefs.navigation-menu-item.ts
@@ -0,0 +1,14 @@
+import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+
+import { OPEN_BRIEFS_VIEW_UNIVERSAL_IDENTIFIER } from 'src/views/open-briefs.view';
+
+import { PARTNER_WORKSPACE_FOLDER_UNIVERSAL_IDENTIFIER } from './partner-workspace-folder.navigation-menu-item';
+
+export default defineNavigationMenuItem({
+ universalIdentifier: '1392ad4d-3792-4187-a1c5-ee05815dcfde',
+ type: NavigationMenuItemType.VIEW,
+ icon: 'IconBuildingStore',
+ position: 0,
+ folderUniversalIdentifier: PARTNER_WORKSPACE_FOLDER_UNIVERSAL_IDENTIFIER,
+ viewUniversalIdentifier: OPEN_BRIEFS_VIEW_UNIVERSAL_IDENTIFIER,
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/opportunities-with-partner-board.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/opportunities-with-partner-board.navigation-menu-item.ts
deleted file mode 100644
index 41ee4d9cea6..00000000000
--- a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/opportunities-with-partner-board.navigation-menu-item.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
-
-import {
- OPPORTUNITIES_WITH_PARTNER_BOARD_NAV_UNIVERSAL_IDENTIFIER,
- OPPORTUNITIES_WITH_PARTNER_BOARD_VIEW_UNIVERSAL_IDENTIFIER,
-} from 'src/constants/universal-identifiers';
-
-export default defineNavigationMenuItem({
- universalIdentifier: OPPORTUNITIES_WITH_PARTNER_BOARD_NAV_UNIVERSAL_IDENTIFIER,
- type: NavigationMenuItemType.VIEW,
- icon: 'IconLayoutKanban',
- position: 2,
- folderUniversalIdentifier: '0b2e499a-ae74-45e0-af08-243e19fc56aa',
- viewUniversalIdentifier: OPPORTUNITIES_WITH_PARTNER_BOARD_VIEW_UNIVERSAL_IDENTIFIER,
-});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/opportunities-with-partner.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/opportunities-with-partner.navigation-menu-item.ts
deleted file mode 100644
index 49fac5574bb..00000000000
--- a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/opportunities-with-partner.navigation-menu-item.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
-
-import {
- OPPORTUNITIES_WITH_PARTNER_NAV_UNIVERSAL_IDENTIFIER,
- OPPORTUNITIES_WITH_PARTNER_VIEW_UNIVERSAL_IDENTIFIER,
-} from 'src/constants/universal-identifiers';
-
-export default defineNavigationMenuItem({
- universalIdentifier: OPPORTUNITIES_WITH_PARTNER_NAV_UNIVERSAL_IDENTIFIER,
- type: NavigationMenuItemType.VIEW,
- icon: 'IconUserCheck',
- position: 1,
- folderUniversalIdentifier: '0b2e499a-ae74-45e0-af08-243e19fc56aa',
- viewUniversalIdentifier: OPPORTUNITIES_WITH_PARTNER_VIEW_UNIVERSAL_IDENTIFIER,
-});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/opportunities-without-partner.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/opportunities-without-partner.navigation-menu-item.ts
deleted file mode 100644
index ced1b6d1b56..00000000000
--- a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/opportunities-without-partner.navigation-menu-item.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
-
-import {
- OPPORTUNITIES_NO_PARTNER_NAV_UNIVERSAL_IDENTIFIER,
- OPPORTUNITIES_NO_PARTNER_VIEW_UNIVERSAL_IDENTIFIER,
-} from 'src/constants/universal-identifiers';
-
-export default defineNavigationMenuItem({
- universalIdentifier: OPPORTUNITIES_NO_PARTNER_NAV_UNIVERSAL_IDENTIFIER,
- type: NavigationMenuItemType.VIEW,
- icon: 'IconUserOff',
- position: 0,
- folderUniversalIdentifier: '0b2e499a-ae74-45e0-af08-243e19fc56aa',
- viewUniversalIdentifier: OPPORTUNITIES_NO_PARTNER_VIEW_UNIVERSAL_IDENTIFIER,
-});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partner-applications.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partner-applications.navigation-menu-item.ts
index 8150f40049e..66b7df6429c 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partner-applications.navigation-menu-item.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partner-applications.navigation-menu-item.ts
@@ -1,14 +1,12 @@
import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
-import {
- PARTNER_APPLICATIONS_NAV_UNIVERSAL_IDENTIFIER,
- PARTNER_APPLICATIONS_VIEW_UNIVERSAL_IDENTIFIER,
-} from 'src/constants/universal-identifiers';
+import { PARTNER_APPLICATIONS_NAV_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { PARTNER_APPLICATIONS_VIEW_UNIVERSAL_IDENTIFIER } from 'src/views/partner-applications.view';
export default defineNavigationMenuItem({
universalIdentifier: PARTNER_APPLICATIONS_NAV_UNIVERSAL_IDENTIFIER,
type: NavigationMenuItemType.VIEW,
- icon: 'IconUserPlus',
+ icon: 'IconInbox',
position: 0,
folderUniversalIdentifier: '857be3b5-82c6-45f7-b546-e20a8a97be8d',
viewUniversalIdentifier: PARTNER_APPLICATIONS_VIEW_UNIVERSAL_IDENTIFIER,
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partner-content.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partner-content.navigation-menu-item.ts
index f2f97053835..33998cb46f0 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partner-content.navigation-menu-item.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partner-content.navigation-menu-item.ts
@@ -9,7 +9,7 @@ export default defineNavigationMenuItem({
universalIdentifier: PARTNER_CONTENT_NAV_UNIVERSAL_IDENTIFIER,
type: NavigationMenuItemType.VIEW,
icon: 'IconQuote',
- position: 3,
+ position: 4,
folderUniversalIdentifier: '857be3b5-82c6-45f7-b546-e20a8a97be8d',
viewUniversalIdentifier: PARTNER_CONTENT_VIEW_UNIVERSAL_IDENTIFIER,
});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partner-workspace-folder.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partner-workspace-folder.navigation-menu-item.ts
new file mode 100644
index 00000000000..1c0e66567b9
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partner-workspace-folder.navigation-menu-item.ts
@@ -0,0 +1,12 @@
+import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+
+export const PARTNER_WORKSPACE_FOLDER_UNIVERSAL_IDENTIFIER =
+ '8e416e6f-8c5d-47d6-ad39-d1f882904c73';
+
+export default defineNavigationMenuItem({
+ universalIdentifier: PARTNER_WORKSPACE_FOLDER_UNIVERSAL_IDENTIFIER,
+ type: NavigationMenuItemType.FOLDER,
+ name: 'Partner Workspace',
+ icon: 'IconUser',
+ position: -3,
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partners-per-country.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partners-per-country.navigation-menu-item.ts
new file mode 100644
index 00000000000..b9fe7b4fd1c
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partners-per-country.navigation-menu-item.ts
@@ -0,0 +1,12 @@
+import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+
+import { PARTNERS_PER_COUNTRY_VIEW_UNIVERSAL_IDENTIFIER } from 'src/views/partners-per-country.view';
+
+export default defineNavigationMenuItem({
+ universalIdentifier: '284df145-0d35-4733-92ea-89aff788d6a9',
+ type: NavigationMenuItemType.VIEW,
+ icon: 'IconMap',
+ position: 2,
+ folderUniversalIdentifier: '857be3b5-82c6-45f7-b546-e20a8a97be8d',
+ viewUniversalIdentifier: PARTNERS_PER_COUNTRY_VIEW_UNIVERSAL_IDENTIFIER,
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partners-per-stage.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partners-per-stage.navigation-menu-item.ts
new file mode 100644
index 00000000000..c6356e2ee78
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partners-per-stage.navigation-menu-item.ts
@@ -0,0 +1,12 @@
+import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+
+import { PARTNERS_PER_STAGE_VIEW_UNIVERSAL_IDENTIFIER } from 'src/views/partners-per-stage.view';
+
+export default defineNavigationMenuItem({
+ universalIdentifier: 'fa1d850b-358c-45a4-a0af-a2fb4c06e129',
+ type: NavigationMenuItemType.VIEW,
+ icon: 'IconColumns',
+ position: 1,
+ folderUniversalIdentifier: '857be3b5-82c6-45f7-b546-e20a8a97be8d',
+ viewUniversalIdentifier: PARTNERS_PER_STAGE_VIEW_UNIVERSAL_IDENTIFIER,
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partners-validated.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partners-validated.navigation-menu-item.ts
new file mode 100644
index 00000000000..c0d03ef3170
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partners-validated.navigation-menu-item.ts
@@ -0,0 +1,12 @@
+import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+
+import { PARTNERS_VALIDATED_VIEW_UNIVERSAL_IDENTIFIER } from 'src/views/partners-validated.view';
+
+export default defineNavigationMenuItem({
+ universalIdentifier: 'c9cbe1b6-7c07-4327-bd7a-018d0ed0db33',
+ type: NavigationMenuItemType.VIEW,
+ icon: 'IconCircleCheck',
+ position: 3,
+ folderUniversalIdentifier: '857be3b5-82c6-45f7-b546-e20a8a97be8d',
+ viewUniversalIdentifier: PARTNERS_VALIDATED_VIEW_UNIVERSAL_IDENTIFIER,
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partners.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partners.navigation-menu-item.ts
deleted file mode 100644
index 0ea6a843498..00000000000
--- a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/partners.navigation-menu-item.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
-
-import {
- ALL_PARTNERS_VIEW_UNIVERSAL_IDENTIFIER,
- PARTNERS_NAV_UNIVERSAL_IDENTIFIER,
-} from 'src/constants/universal-identifiers';
-
-export default defineNavigationMenuItem({
- universalIdentifier: PARTNERS_NAV_UNIVERSAL_IDENTIFIER,
- type: NavigationMenuItemType.VIEW,
- icon: 'IconBuildingStore',
- position: 2,
- folderUniversalIdentifier: '857be3b5-82c6-45f7-b546-e20a8a97be8d',
- viewUniversalIdentifier: ALL_PARTNERS_VIEW_UNIVERSAL_IDENTIFIER,
-});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/pipeline-folder.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/pipeline-folder.navigation-menu-item.ts
index 820a293f450..4ab87cf20a4 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/pipeline-folder.navigation-menu-item.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/pipeline-folder.navigation-menu-item.ts
@@ -3,7 +3,7 @@ import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/def
export default defineNavigationMenuItem({
universalIdentifier: '0b2e499a-ae74-45e0-af08-243e19fc56aa',
type: NavigationMenuItemType.FOLDER,
- name: 'Pipeline',
+ name: 'Matching Admin Workspace',
icon: 'IconTargetArrow',
position: -2,
});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/validated-partners.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/validated-partners.navigation-menu-item.ts
deleted file mode 100644
index 86c8b845680..00000000000
--- a/packages/twenty-apps/internal/twenty-partners/src/navigation-menu-items/validated-partners.navigation-menu-item.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
-
-import {
- VALIDATED_PARTNERS_NAV_UNIVERSAL_IDENTIFIER,
- VALIDATED_PARTNERS_VIEW_UNIVERSAL_IDENTIFIER,
-} from 'src/constants/universal-identifiers';
-
-export default defineNavigationMenuItem({
- universalIdentifier: VALIDATED_PARTNERS_NAV_UNIVERSAL_IDENTIFIER,
- type: NavigationMenuItemType.VIEW,
- icon: 'IconCircleCheck',
- position: 1,
- folderUniversalIdentifier: '857be3b5-82c6-45f7-b546-e20a8a97be8d',
- viewUniversalIdentifier: VALIDATED_PARTNERS_VIEW_UNIVERSAL_IDENTIFIER,
-});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/objects/application.object.ts b/packages/twenty-apps/internal/twenty-partners/src/objects/application.object.ts
new file mode 100644
index 00000000000..87bae2acb04
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/objects/application.object.ts
@@ -0,0 +1,144 @@
+import {
+ FieldType,
+ OnDeleteAction,
+ RelationType,
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+ defineObject,
+} from 'twenty-sdk/define';
+
+import { PARTNER_OBJECT_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+
+export const APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER =
+ 'f17ec4d0-00c5-4137-9c8b-5507934d80cf';
+
+export const APPLICATION_NAME_FIELD_ID = '51ff5f75-9df2-485f-8852-22484ae0cc3e';
+export const APPLICATION_OPPORTUNITY_FIELD_ID =
+ '8aba48ca-1bfb-4141-b64d-b23d7f5fc41f';
+export const APPLICATIONS_ON_OPPORTUNITY_FIELD_ID =
+ '4a6ce47b-a56b-4b21-81f4-83021fb0e09d';
+export const APPLICATION_PARTNER_FIELD_ID =
+ '2ab5b079-fef3-452c-b4c0-a32ca1709157';
+export const APPLICATIONS_ON_PARTNER_FIELD_ID =
+ 'e36002c5-f71b-4048-953a-79f68baba4e2';
+export const APPLICATION_PARTNER_USER_FIELD_ID =
+ '2895bcbb-df5a-4faa-af70-097729c1dd01';
+export const APPLICATIONS_AS_PARTNER_USER_FIELD_ID =
+ '1010f214-ab3f-43aa-a19e-d351bddc2d61';
+export const APPLICATION_STATE_FIELD_ID =
+ 'c686db4f-f0e9-41a0-bdb3-3b4024ff59b6';
+export const APPLICATION_PITCH_FIELD_ID =
+ '0a6cd9c9-e1e9-4315-8356-b72077443805';
+export const APPLICATION_LAST_ACTIVITY_AT_FIELD_ID =
+ 'b184ac02-51b2-4442-9505-2b06f5c94112';
+
+export default defineObject({
+ universalIdentifier: APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ nameSingular: 'application',
+ namePlural: 'applications',
+ labelSingular: 'Application',
+ labelPlural: 'Applications',
+ description: 'A partner in play on an opportunity-brief — invited or applied',
+ icon: 'IconSend',
+ isSearchable: false,
+ labelIdentifierFieldMetadataUniversalIdentifier: APPLICATION_NAME_FIELD_ID,
+ fields: [
+ {
+ universalIdentifier: APPLICATION_NAME_FIELD_ID,
+ type: FieldType.TEXT,
+ name: 'name',
+ label: 'Name',
+ icon: 'IconTag',
+ defaultValue: "''",
+ },
+ {
+ universalIdentifier: APPLICATION_OPPORTUNITY_FIELD_ID,
+ type: FieldType.RELATION,
+ name: 'opportunity',
+ label: 'Opportunity',
+ icon: 'IconTargetArrow',
+ isNullable: true,
+ relationTargetObjectMetadataUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ relationTargetFieldMetadataUniversalIdentifier:
+ APPLICATIONS_ON_OPPORTUNITY_FIELD_ID,
+ universalSettings: {
+ relationType: RelationType.MANY_TO_ONE,
+ onDelete: OnDeleteAction.SET_NULL,
+ joinColumnName: 'opportunityId',
+ },
+ },
+ {
+ universalIdentifier: APPLICATION_PARTNER_FIELD_ID,
+ type: FieldType.RELATION,
+ name: 'partner',
+ label: 'Partner',
+ icon: 'IconBuildingStore',
+ isNullable: true,
+ relationTargetObjectMetadataUniversalIdentifier:
+ PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,
+ relationTargetFieldMetadataUniversalIdentifier:
+ APPLICATIONS_ON_PARTNER_FIELD_ID,
+ universalSettings: {
+ relationType: RelationType.MANY_TO_ONE,
+ onDelete: OnDeleteAction.SET_NULL,
+ joinColumnName: 'partnerId',
+ },
+ },
+ {
+ // RLS pivot (B7): the applying member. Populated by the apply logic-function (B4);
+ // left null for admin-created invites until then. Locked from partner edits in B7.
+ universalIdentifier: APPLICATION_PARTNER_USER_FIELD_ID,
+ type: FieldType.RELATION,
+ name: 'partnerUser',
+ label: 'Partner User',
+ isNullable: true,
+ relationTargetObjectMetadataUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.workspaceMember.universalIdentifier,
+ relationTargetFieldMetadataUniversalIdentifier:
+ APPLICATIONS_AS_PARTNER_USER_FIELD_ID,
+ universalSettings: {
+ relationType: RelationType.MANY_TO_ONE,
+ onDelete: OnDeleteAction.SET_NULL,
+ joinColumnName: 'partnerUserId',
+ },
+ },
+ {
+ // Candidacy funnel. WON is set ONLY by on-opportunity-partner-won (Task 3) — a locked
+ // mirror of Opportunity.partner, never a user-set value.
+ universalIdentifier: APPLICATION_STATE_FIELD_ID,
+ type: FieldType.SELECT,
+ name: 'state',
+ label: 'State',
+ icon: 'IconProgressCheck',
+ isNullable: false,
+ // Self-apply is the primary path → default APPLIED so a partner who applies never sees a
+ // misleading "Invited" flicker while on-application-created (async) stamps the candidacy.
+ // Admin invites are a manual action that explicitly sets INVITED.
+ defaultValue: "'APPLIED'",
+ options: [
+ { id: '7f9d5ae7-64be-4269-8fab-3cfeaf352bcb', value: 'APPLIED', label: 'Applied', position: 0, color: 'blue' },
+ { id: '2ce94524-4ac3-4a4a-a87c-5c9841eced7c', value: 'INVITED', label: 'Invited', position: 1, color: 'gray' },
+ { id: 'e4e3d579-17ef-4ef8-b9be-54f7d361ad51', value: 'INTRODUCED', label: 'Introduced', position: 2, color: 'purple' },
+ { id: '66ff342c-577b-4a84-bbdc-4ffbfa0bdd0e', value: 'WON', label: 'Won', position: 3, color: 'green' },
+ { id: '83846e19-5008-4f06-b62d-7a1f0dad23e2', value: 'DECLINED', label: 'Declined', position: 4, color: 'red' },
+ { id: '124f7e81-39b4-47cc-83f7-7dfb81ea751d', value: 'BACKUP', label: 'Backup', position: 5, color: 'orange' },
+ ],
+ },
+ {
+ universalIdentifier: APPLICATION_PITCH_FIELD_ID,
+ type: FieldType.TEXT,
+ name: 'pitch',
+ label: 'Pitch',
+ icon: 'IconMessage',
+ isNullable: true,
+ },
+ {
+ universalIdentifier: APPLICATION_LAST_ACTIVITY_AT_FIELD_ID,
+ type: FieldType.DATE_TIME,
+ name: 'lastActivityAt',
+ label: 'Last Activity At',
+ icon: 'IconClock',
+ isNullable: true,
+ },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/page-layouts/application.page-layout.ts b/packages/twenty-apps/internal/twenty-partners/src/page-layouts/application.page-layout.ts
new file mode 100644
index 00000000000..171f92a9198
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/page-layouts/application.page-layout.ts
@@ -0,0 +1,49 @@
+import { PageLayoutTabLayoutMode, definePageLayout } from 'twenty-sdk/define';
+
+import { APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER } from 'src/objects/application.object';
+import { APPLICATION_RECORD_PAGE_FIELDS_VIEW_ID } from 'src/views/application-record-page-fields.view';
+
+// Application is a custom (app-owned) object, so we fully control its record page (unlike the
+// standard Opportunity). The Fields widget points at the FIELDS_WIDGET view so the opportunity +
+// partner relations show in the side panel.
+export default definePageLayout({
+ universalIdentifier: '7280910c-a409-4afc-9dac-ae9a8b3ca244',
+ name: 'Default Application Layout',
+ type: 'RECORD_PAGE',
+ objectUniversalIdentifier: APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ tabs: [
+ {
+ universalIdentifier: '14270284-dbd2-4d03-b9cd-a8e78c325394',
+ title: 'Home',
+ position: 10,
+ icon: 'IconHome',
+ layoutMode: PageLayoutTabLayoutMode.VERTICAL_LIST,
+ widgets: [
+ {
+ universalIdentifier: '7f4a57f9-44f8-4fa4-bcdb-b25055c33db0',
+ title: 'Fields',
+ type: 'FIELDS',
+ configuration: {
+ configurationType: 'FIELDS',
+ viewUniversalIdentifier: APPLICATION_RECORD_PAGE_FIELDS_VIEW_ID,
+ },
+ },
+ ],
+ },
+ {
+ universalIdentifier: '8f09a425-95ce-44a3-92af-7b37a1842851',
+ title: 'Timeline',
+ position: 20,
+ icon: 'IconTimelineEvent',
+ layoutMode: PageLayoutTabLayoutMode.CANVAS,
+ widgets: [
+ {
+ universalIdentifier: '3e9acb85-9445-40d5-9c65-57461df8483c',
+ title: 'Timeline',
+ type: 'TIMELINE',
+ configuration: { configurationType: 'TIMELINE' },
+ },
+ ],
+ },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/page-layouts/opportunity.page-layout.ts b/packages/twenty-apps/internal/twenty-partners/src/page-layouts/opportunity.page-layout.ts
new file mode 100644
index 00000000000..d59a947b56b
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/page-layouts/opportunity.page-layout.ts
@@ -0,0 +1,53 @@
+import {
+ PageLayoutTabLayoutMode,
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+ definePageLayout,
+} from 'twenty-sdk/define';
+
+import { OPPORTUNITY_RECORD_PAGE_FIELDS_VIEW_ID } from 'src/views/opportunity-record-page-fields.view';
+
+// Opportunity is a standard object, but we override its record page so the Fields widget
+// points at a FIELDS_WIDGET view — surfacing partner + applications relations in the side
+// panel (hidden by the platform default).
+export default definePageLayout({
+ universalIdentifier: 'cf2c66e4-0a4b-48ce-8669-fdf39dd64148',
+ name: 'Default Opportunity Layout',
+ type: 'RECORD_PAGE',
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ tabs: [
+ {
+ universalIdentifier: '81985727-42a1-469e-b001-fb74dd1f7112',
+ title: 'Home',
+ position: 10,
+ icon: 'IconHome',
+ layoutMode: PageLayoutTabLayoutMode.VERTICAL_LIST,
+ widgets: [
+ {
+ universalIdentifier: 'dd849e57-42b8-48bc-afd1-c942baab2bf4',
+ title: 'Fields',
+ type: 'FIELDS',
+ configuration: {
+ configurationType: 'FIELDS',
+ viewUniversalIdentifier: OPPORTUNITY_RECORD_PAGE_FIELDS_VIEW_ID,
+ },
+ },
+ ],
+ },
+ {
+ universalIdentifier: '92e47687-6446-47d0-a3a7-31a012e2c4cd',
+ title: 'Timeline',
+ position: 20,
+ icon: 'IconTimelineEvent',
+ layoutMode: PageLayoutTabLayoutMode.CANVAS,
+ widgets: [
+ {
+ universalIdentifier: '98c9aac6-5a93-4725-84c7-15c5db445ea3',
+ title: 'Timeline',
+ type: 'TIMELINE',
+ configuration: { configurationType: 'TIMELINE' },
+ },
+ ],
+ },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/page-layouts/partner.page-layout.ts b/packages/twenty-apps/internal/twenty-partners/src/page-layouts/partner.page-layout.ts
new file mode 100644
index 00000000000..b07c7bbde1b
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/page-layouts/partner.page-layout.ts
@@ -0,0 +1,49 @@
+import { PageLayoutTabLayoutMode, definePageLayout } from 'twenty-sdk/define';
+
+import { PARTNER_OBJECT_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { PARTNER_RECORD_PAGE_FIELDS_VIEW_ID } from 'src/views/partner-record-page-fields.view';
+
+// Partner is a custom (app-owned) object, so we fully control its record page. The
+// Fields widget points at the FIELDS_WIDGET view so the partnerUser relation shows in
+// the side panel.
+export default definePageLayout({
+ universalIdentifier: 'd3257b1c-42eb-4b75-a4db-c966ef946b91',
+ name: 'Default Partner Layout',
+ type: 'RECORD_PAGE',
+ objectUniversalIdentifier: PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,
+ tabs: [
+ {
+ universalIdentifier: '89b89326-d112-4356-8c62-899fced67fb1',
+ title: 'Home',
+ position: 10,
+ icon: 'IconHome',
+ layoutMode: PageLayoutTabLayoutMode.VERTICAL_LIST,
+ widgets: [
+ {
+ universalIdentifier: '1811fed7-c97e-4640-900e-0ea4939b1eea',
+ title: 'Fields',
+ type: 'FIELDS',
+ configuration: {
+ configurationType: 'FIELDS',
+ viewUniversalIdentifier: PARTNER_RECORD_PAGE_FIELDS_VIEW_ID,
+ },
+ },
+ ],
+ },
+ {
+ universalIdentifier: '2f59d88d-d07b-4a34-9e95-c8c6eea2522b',
+ title: 'Timeline',
+ position: 20,
+ icon: 'IconTimelineEvent',
+ layoutMode: PageLayoutTabLayoutMode.CANVAS,
+ widgets: [
+ {
+ universalIdentifier: '38372f08-6b5b-4e87-aa0d-d515d72f5a5d',
+ title: 'Timeline',
+ type: 'TIMELINE',
+ configuration: { configurationType: 'TIMELINE' },
+ },
+ ],
+ },
+ ],
+});
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.ts
index 73ede8c3c27..20d661b8741 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
@@ -2,15 +2,26 @@ import { STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS, defineRole } from 'twenty-sdk/de
import {
INTRO_SENT_AT_FIELD_UNIVERSAL_IDENTIFIER,
- MATCH_STATUS_FIELD_UNIVERSAL_IDENTIFIER,
PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,
PARTNER_ROLE_UNIVERSAL_IDENTIFIER,
} from 'src/constants/universal-identifiers';
+import {
+ APPLICATION_LAST_ACTIVITY_AT_FIELD_ID,
+ APPLICATION_NAME_FIELD_ID,
+ APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ APPLICATION_PARTNER_FIELD_ID,
+ APPLICATION_PARTNER_USER_FIELD_ID,
+ APPLICATION_STATE_FIELD_ID,
+ APPLICATIONS_ON_OPPORTUNITY_FIELD_ID,
+} from 'src/objects/application.object';
import { OPPORTUNITY_DESIGN_DOC_STATUS_FIELD_ID } from 'src/fields/opportunity-design-doc-status.field';
import { OPPORTUNITY_DESIGN_DOC_URL_FIELD_ID } from 'src/fields/opportunity-design-doc-url.field';
import { OPPORTUNITY_HOSTING_TYPE_FIELD_ID } from 'src/fields/opportunity-hosting-type.field';
+import { OPPORTUNITY_IS_LISTED_FIELD_ID } from 'src/fields/opportunity-is-listed.field';
import { OPPORTUNITY_LOST_REASON_FIELD_ID } from 'src/fields/opportunity-lost-reason.field';
+import { OPPORTUNITY_NEED_FIELD_ID } from 'src/fields/opportunity-need.field';
import { OPPORTUNITY_NUMBER_OF_SEATS_FIELD_ID } from 'src/fields/opportunity-number-of-seats.field';
+import { OPPORTUNITY_REQUIREMENTS_FIELD_ID } from 'src/fields/opportunity-requirements.field';
import { OPPORTUNITY_SUBSCRIPTION_FREQUENCY_FIELD_ID } from 'src/fields/opportunity-subscription-frequency.field';
import { OPPORTUNITY_SUBSCRIPTION_TYPE_FIELD_ID } from 'src/fields/opportunity-subscription-type.field';
import { OPPORTUNITY_TFT_ID_FIELD_ID } from 'src/fields/opportunity-tft-id.field';
@@ -24,8 +35,10 @@ import { PARTNER_USER_ON_PARTNER_FIELD_ID } from 'src/fields/partner-user-on-par
export const PARTNER_ROLE_LABEL = 'Partner';
// External partner self-service role: a partner sees only its own records, can edit its
-// own Partner profile and an Opportunity's stage + amount; Company/Person are read-only.
-// Row-level predicates can't ship in the manifest, so run `yarn rls:configure` after install.
+// own Partner profile and an Application's pitch (and set opportunity on apply/create); Company/
+// Person are read-only. Opportunity stage/amount are admin-only (read-only for partners).
+// Application rows are scoped to own partnerUser (RLS). Row-level predicates can't ship in
+// the manifest, so run `yarn rls:configure` after install.
//
// `updatedBy` and `position` must stay editable even though they're not partner-facing: the
// server injects `updatedBy` into every update (ActorFromAuthContextService) and co-writes
@@ -37,7 +50,7 @@ export default defineRole({
universalIdentifier: PARTNER_ROLE_UNIVERSAL_IDENTIFIER,
label: PARTNER_ROLE_LABEL,
description:
- 'External partner self-service role. Sees only its own Partner/Person/Company/Opportunity records (row-level). Can edit its own Partner profile and an Opportunity’s stage + amount; Company and Person are read-only. Configure predicates with `yarn rls:configure` after install.',
+ 'External partner self-service role. Sees only its own Partner/Person/Company/Opportunity/Application records (row-level). Can edit its own Partner profile and an Application’s pitch; Opportunity stage/amount are read-only. Configure predicates with `yarn rls:configure` after install.',
icon: 'IconBuildingStore',
canBeAssignedToUsers: true,
canUpdateAllSettings: false,
@@ -45,8 +58,13 @@ export default defineRole({
canUpdateAllObjectRecords: false,
canSoftDeleteAllObjectRecords: false,
canDestroyAllObjectRecords: false,
- // Lock every Opportunity field except stage/amount (editable) and the system/
- // server-managed fields left out here (id, timestamps, updatedBy, position — see header).
+ // No permission flags: partners apply by CREATING an Application directly (a normal record
+ // write, governed by the Application object permission), which fires on-application-created.
+ // They never run a manual workflow, so the WORKFLOWS flag is unnecessary — and it can't be
+ // granted on an app-owned role anyway (the manifest sync drops role→permissionFlag links).
+ permissionFlagUniversalIdentifiers: [],
+ // Lock every Opportunity field except the system/server-managed fields left out here
+ // (id, timestamps, updatedBy, position — see header). Stage + amount are locked too.
fieldPermissions: [
{
objectUniversalIdentifier:
@@ -64,6 +82,22 @@ export default defineRole({
.universalIdentifier,
canUpdateFieldValue: false,
},
+ {
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ fieldUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.fields.stage
+ .universalIdentifier,
+ canUpdateFieldValue: false,
+ },
+ {
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ fieldUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.fields.amount
+ .universalIdentifier,
+ canUpdateFieldValue: false,
+ },
{
objectUniversalIdentifier:
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
@@ -149,12 +183,6 @@ export default defineRole({
fieldUniversalIdentifier: PARTNER_USER_ON_OPPORTUNITY_FIELD_ID,
canUpdateFieldValue: false,
},
- {
- objectUniversalIdentifier:
- STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
- fieldUniversalIdentifier: MATCH_STATUS_FIELD_UNIVERSAL_IDENTIFIER,
- canUpdateFieldValue: false,
- },
{
objectUniversalIdentifier:
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
@@ -215,6 +243,31 @@ export default defineRole({
fieldUniversalIdentifier: OPPORTUNITY_DESIGN_DOC_STATUS_FIELD_ID,
canUpdateFieldValue: false,
},
+ // Marketplace brief fields — read-only for partners (listed briefs visible via RLS OR predicate).
+ {
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ fieldUniversalIdentifier: OPPORTUNITY_IS_LISTED_FIELD_ID,
+ canUpdateFieldValue: false,
+ },
+ {
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ fieldUniversalIdentifier: APPLICATIONS_ON_OPPORTUNITY_FIELD_ID,
+ canUpdateFieldValue: false,
+ },
+ {
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ fieldUniversalIdentifier: OPPORTUNITY_REQUIREMENTS_FIELD_ID,
+ canUpdateFieldValue: false,
+ },
+ {
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ fieldUniversalIdentifier: OPPORTUNITY_NEED_FIELD_ID,
+ canUpdateFieldValue: false,
+ },
// Partner object — lock admin-managed fields so partners can't self-promote or alter ops data.
{
objectUniversalIdentifier: PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,
@@ -265,6 +318,35 @@ export default defineRole({
fieldUniversalIdentifier: PARTNER_COMPANY_FIELD_ID,
canUpdateFieldValue: false,
},
+ // Application — lock every field except pitch and opportunity (partner sets opportunity
+ // on apply/create; state/partnerUser are populated by on-application-created as the app).
+ // System/server-managed fields (id, timestamps, updatedBy, position, searchVector) stay
+ // out — locking updatedBy/position breaks every update (same trap as Opportunity above).
+ {
+ objectUniversalIdentifier: APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ fieldUniversalIdentifier: APPLICATION_NAME_FIELD_ID,
+ canUpdateFieldValue: false,
+ },
+ {
+ objectUniversalIdentifier: APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ fieldUniversalIdentifier: APPLICATION_PARTNER_FIELD_ID,
+ canUpdateFieldValue: false,
+ },
+ {
+ objectUniversalIdentifier: APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ fieldUniversalIdentifier: APPLICATION_PARTNER_USER_FIELD_ID,
+ canUpdateFieldValue: false,
+ },
+ {
+ objectUniversalIdentifier: APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ fieldUniversalIdentifier: APPLICATION_STATE_FIELD_ID,
+ canUpdateFieldValue: false,
+ },
+ {
+ objectUniversalIdentifier: APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ fieldUniversalIdentifier: APPLICATION_LAST_ACTIVITY_AT_FIELD_ID,
+ canUpdateFieldValue: false,
+ },
],
objectPermissions: [
{
@@ -298,6 +380,13 @@ export default defineRole({
canSoftDeleteObjectRecords: false,
canDestroyObjectRecords: false,
},
+ {
+ objectUniversalIdentifier: APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ canReadObjectRecords: true,
+ canUpdateObjectRecords: true,
+ canSoftDeleteObjectRecords: false,
+ canDestroyObjectRecords: false,
+ },
{
// Read-only so the UI can resolve member-typed relations (own partnerUser link,
// owner/createdBy). An RLS predicate scopes this to the partner's own member record
diff --git a/packages/twenty-apps/internal/twenty-partners/src/scripts/configure-partner-rls.ts b/packages/twenty-apps/internal/twenty-partners/src/scripts/configure-partner-rls.ts
index b2a472751b7..705b0ddb4c1 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/scripts/configure-partner-rls.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/scripts/configure-partner-rls.ts
@@ -1,16 +1,28 @@
// Idempotent. Re-run after every install/reinstall — the app manifest can't ship RLS
-// predicates. Does two things:
+// predicates. Does three things:
//
-// 1. Upserts row-level-permission predicates on the Partner role: "partnerUser IS the
-// current member" on each of partner/person/company/opportunity, plus "id IS the
-// current member" on workspaceMember so the partner sees only its own member record
-// (member-typed relations still resolve; the internal roster stays hidden).
+// 1. Upserts row-level-permission predicates on the Partner role:
+// - "partnerUser IS the current member" on partner/person/company
+// - "(partnerUser IS me) OR (lastActivityAt IS EMPTY)" on application. RLS is validated on
+// INSERT against the row exactly as submitted, but a partner's Apply workflow creates the
+// row with partnerUser=null (on-application-created stamps it AFTER insert, as the app).
+// A strict "partnerUser IS me" would reject every apply, so the OR adds an escape hatch:
+// a freshly-created row (lastActivityAt null, set by the same handler) passes insert and
+// is readable by its creator until the handler stamps it.
+// ponytail: trade-off — an unstamped row is briefly readable by ANY partner (sub-second
+// window; permanent only if the handler fails to stamp). Acceptable for an internal
+// partner marketplace; tighten by setting partnerUser at insert if a current-member
+// workflow variable ever lands.
+// - "(partnerUser IS me) OR (isListed = true)" on opportunity (marketplace briefs)
+// - "id IS the current member" on workspaceMember (self-scope; internal roster hidden)
//
// 2. Verifies (does NOT set) the Opportunity field permissions from `partner.role.ts`.
// upsertFieldPermissions rejects out-of-band changes to app-owned roles
// (ROLE_BELONGS_TO_ANOTHER_APPLICATION), so those must come from the manifest; if any
// expected lock is missing, the script exits non-zero and tells you to re-sync.
//
+// 3. Verifies Application field permissions the same way (pitch editable; rest locked).
+//
// Usage:
// yarn rls:configure # against .env.local
// yarn rls:configure:prod # against .env.prod
@@ -27,12 +39,24 @@ const requireEnv = (name: string): string => {
return value;
};
-const TARGET_OBJECTS = ['partner', 'person', 'company', 'opportunity'] as const;
-type TargetObject = (typeof TARGET_OBJECTS)[number];
+const SIMPLE_TARGET_OBJECTS = ['partner', 'person', 'company'] as const;
+type SimpleTargetObject = (typeof SIMPLE_TARGET_OBJECTS)[number];
+
+// application + opportunity use OR groups (handled separately), but still need existence checks.
+const ALL_TARGET_OBJECTS = [
+ ...SIMPLE_TARGET_OBJECTS,
+ 'application',
+ 'opportunity',
+] as const;
+
+// Stable ids for the OR predicate groups — re-runs upsert in place instead of creating
+// duplicate groups.
+const OPPORTUNITY_RLS_OR_GROUP_ID = 'b7e7f3a0-4c5d-4e8f-9a1b-2c3d4e5f6789';
+const APPLICATION_RLS_OR_GROUP_ID = 'a9c1f3d2-5b6e-4a7c-8d9f-1e2b3c4d5e6f';
-// Opportunity fields that must NOT be locked: system columns, the editable business
-// fields (stage, amount), and updatedBy/position (server-managed — locking them breaks
-// every update; see src/roles/partner.role.ts). Everything else is expected to be locked.
+// Opportunity fields that must NOT be locked: system columns and updatedBy/position
+// (server-managed — locking them breaks every update; see src/roles/partner.role.ts).
+// Stage + amount are expected locked (admin-only for partners). Everything else too.
const OPPORTUNITY_FIELD_LOCK_SKIP = new Set([
'id',
'createdAt',
@@ -40,8 +64,29 @@ const OPPORTUNITY_FIELD_LOCK_SKIP = new Set([
'deletedAt',
'updatedBy',
'position',
- 'stage',
- 'amount',
+]);
+
+// Application fields that must be locked (pitch + opportunity are partner-editable).
+const APPLICATION_FIELD_LOCK_EXPECTED = new Set([
+ 'name',
+ 'partner',
+ 'partnerUser',
+ 'state',
+ 'lastActivityAt',
+]);
+
+// Application fields that must NOT be locked: system columns, pitch + opportunity
+// (editable), and updatedBy/position (server-managed — locking them breaks every update).
+const APPLICATION_FIELD_LOCK_SKIP = new Set([
+ 'id',
+ 'createdAt',
+ 'updatedAt',
+ 'deletedAt',
+ 'updatedBy',
+ 'position',
+ 'searchVector',
+ 'pitch',
+ 'opportunity',
]);
type ObjectInfo = {
@@ -213,6 +258,27 @@ type PredicateResult = {
operand: string;
workspaceMemberFieldMetadataId: string | null;
roleId: string;
+ rowLevelPermissionPredicateGroupId: string | null;
+ positionInRowLevelPermissionPredicateGroup: number | null;
+};
+
+type UpsertPredicatesInput = {
+ roleId: string;
+ objectMetadataId: string;
+ predicates: {
+ fieldMetadataId: string;
+ operand: string;
+ workspaceMemberFieldMetadataId?: string | null;
+ value?: boolean | null;
+ rowLevelPermissionPredicateGroupId?: string | null;
+ positionInRowLevelPermissionPredicateGroup?: number | null;
+ }[];
+ predicateGroups: {
+ id?: string;
+ objectMetadataId: string;
+ logicalOperator: string;
+ parentRowLevelPermissionPredicateGroupId?: string | null;
+ }[];
};
async function main() {
@@ -236,7 +302,7 @@ async function main() {
objectsData.objects.edges.map((e) => [e.node.nameSingular, e.node.id]),
);
- for (const name of TARGET_OBJECTS) {
+ for (const name of ALL_TARGET_OBJECTS) {
if (!objectIdByName.has(name)) {
throw new Error(
`Object "${name}" not found in workspace metadata. ` +
@@ -251,9 +317,9 @@ async function main() {
const workspaceMemberId = objectIdByName.get('workspaceMember') as string;
- const objectInfoByName = new Map<TargetObject, ObjectInfo>();
+ const objectInfoByName = new Map<SimpleTargetObject, ObjectInfo>();
- for (const name of TARGET_OBJECTS) {
+ for (const name of SIMPLE_TARGET_OBJECTS) {
const objectId = objectIdByName.get(name) as string;
const partnerUserFieldMetadataId = await findFieldByName(
metadataUrl,
@@ -268,6 +334,40 @@ async function main() {
});
}
+ const opportunityObjectId = objectIdByName.get('opportunity') as string;
+ const opportunityPartnerUserFieldId = await findFieldByName(
+ metadataUrl,
+ apiKey,
+ opportunityObjectId,
+ 'opportunity',
+ 'partnerUser',
+ );
+ const opportunityIsListedFieldId = await findFieldByName(
+ metadataUrl,
+ apiKey,
+ opportunityObjectId,
+ 'opportunity',
+ 'isListed',
+ );
+
+ const applicationObjectIdForPredicate = objectIdByName.get(
+ 'application',
+ ) as string;
+ const applicationPartnerUserFieldId = await findFieldByName(
+ metadataUrl,
+ apiKey,
+ applicationObjectIdForPredicate,
+ 'application',
+ 'partnerUser',
+ );
+ const applicationLastActivityAtFieldId = await findFieldByName(
+ metadataUrl,
+ apiKey,
+ applicationObjectIdForPredicate,
+ 'application',
+ 'lastActivityAt',
+ );
+
// ── 2. Resolve workspaceMember.id field metadata id ──────────────────────────
const workspaceMemberIdFieldId = await findFieldByName(
@@ -329,6 +429,8 @@ async function main() {
operand
workspaceMemberFieldMetadataId
roleId
+ rowLevelPermissionPredicateGroupId
+ positionInRowLevelPermissionPredicateGroup
}
}
}
@@ -336,7 +438,7 @@ async function main() {
const results: PredicateResult[] = [];
- for (const name of TARGET_OBJECTS) {
+ for (const name of SIMPLE_TARGET_OBJECTS) {
const info = objectInfoByName.get(name) as ObjectInfo;
const data = await metadataFetch<{
@@ -355,7 +457,7 @@ async function main() {
},
],
predicateGroups: [],
- },
+ } satisfies UpsertPredicatesInput,
});
const predicate =
@@ -374,6 +476,117 @@ async function main() {
);
}
+ // Opportunity: (partnerUser IS me) OR (isListed = true) — listed briefs visible to all partners.
+ {
+ const oppData = await metadataFetch<{
+ upsertRowLevelPermissionPredicates: { predicates: PredicateResult[] };
+ }>(metadataUrl, apiKey, MUTATION, {
+ input: {
+ roleId: partnerRole.id,
+ objectMetadataId: opportunityObjectId,
+ predicateGroups: [
+ {
+ id: OPPORTUNITY_RLS_OR_GROUP_ID,
+ objectMetadataId: opportunityObjectId,
+ logicalOperator: 'OR',
+ parentRowLevelPermissionPredicateGroupId: null,
+ },
+ ],
+ predicates: [
+ {
+ fieldMetadataId: opportunityPartnerUserFieldId,
+ operand: 'IS',
+ workspaceMemberFieldMetadataId: workspaceMemberIdFieldId,
+ rowLevelPermissionPredicateGroupId: OPPORTUNITY_RLS_OR_GROUP_ID,
+ positionInRowLevelPermissionPredicateGroup: 0,
+ },
+ {
+ fieldMetadataId: opportunityIsListedFieldId,
+ operand: 'IS',
+ value: true,
+ rowLevelPermissionPredicateGroupId: OPPORTUNITY_RLS_OR_GROUP_ID,
+ positionInRowLevelPermissionPredicateGroup: 1,
+ },
+ ],
+ } satisfies UpsertPredicatesInput,
+ });
+
+ const oppPredicates =
+ oppData.upsertRowLevelPermissionPredicates.predicates;
+
+ if (oppPredicates.length < 2) {
+ throw new Error(
+ 'upsertRowLevelPermissionPredicates returned fewer than 2 predicates for opportunity OR group',
+ );
+ }
+
+ for (const predicate of oppPredicates) {
+ results.push(predicate);
+ }
+
+ console.log(
+ `[rls:configure] ✓ opportunity: OR group id=${OPPORTUNITY_RLS_OR_GROUP_ID} ` +
+ `(${oppPredicates.length} predicates: partnerUser IS me OR isListed = true)`,
+ );
+ }
+
+ // Application: (partnerUser IS me) OR (lastActivityAt IS EMPTY). The IS-EMPTY branch lets a
+ // partner CREATE their own application — RLS is validated on insert against the row as
+ // submitted (partnerUser is null until on-application-created stamps it). A scalar IS_EMPTY
+ // on lastActivityAt resolves to `{ is: 'NULL' }`, which is unambiguous on both the insert
+ // check and the SQL read path (a relation IS_EMPTY is riskier there). See header for the leak.
+ {
+ const appData = await metadataFetch<{
+ upsertRowLevelPermissionPredicates: { predicates: PredicateResult[] };
+ }>(metadataUrl, apiKey, MUTATION, {
+ input: {
+ roleId: partnerRole.id,
+ objectMetadataId: applicationObjectIdForPredicate,
+ predicateGroups: [
+ {
+ id: APPLICATION_RLS_OR_GROUP_ID,
+ objectMetadataId: applicationObjectIdForPredicate,
+ logicalOperator: 'OR',
+ parentRowLevelPermissionPredicateGroupId: null,
+ },
+ ],
+ predicates: [
+ {
+ fieldMetadataId: applicationPartnerUserFieldId,
+ operand: 'IS',
+ workspaceMemberFieldMetadataId: workspaceMemberIdFieldId,
+ rowLevelPermissionPredicateGroupId: APPLICATION_RLS_OR_GROUP_ID,
+ positionInRowLevelPermissionPredicateGroup: 0,
+ },
+ {
+ fieldMetadataId: applicationLastActivityAtFieldId,
+ operand: 'IS_EMPTY',
+ rowLevelPermissionPredicateGroupId: APPLICATION_RLS_OR_GROUP_ID,
+ positionInRowLevelPermissionPredicateGroup: 1,
+ },
+ ],
+ } satisfies UpsertPredicatesInput,
+ });
+
+ const appPredicates =
+ appData.upsertRowLevelPermissionPredicates.predicates;
+
+ if (appPredicates.length < 2) {
+ throw new Error(
+ 'upsertRowLevelPermissionPredicates returned fewer than 2 predicates for application OR group',
+ );
+ }
+
+ for (const predicate of appPredicates) {
+ results.push(predicate);
+ }
+
+ console.log(
+ `[rls:configure] ✓ application: OR group id=${APPLICATION_RLS_OR_GROUP_ID} ` +
+ `(${appPredicates.length} predicates: partnerUser IS me OR lastActivityAt IS EMPTY)`,
+ );
+ }
+
// workspaceMember predicate: "id IS the current member", scoping the role's read to the
// partner's own record. Other members (e.g. an opportunity's internal owner) resolve to null.
{
@@ -391,7 +604,7 @@ async function main() {
},
],
predicateGroups: [],
- },
+ } satisfies UpsertPredicatesInput,
});
const wmPredicate =
@@ -412,21 +625,19 @@ async function main() {
console.log(
`\n[rls:configure] Done — ${results.length} predicates upserted on Partner role ` +
- `(${TARGET_OBJECTS.length} objects + workspaceMember self-scope)`,
+ `(${SIMPLE_TARGET_OBJECTS.length} simple objects + application OR group + opportunity OR group + workspaceMember self-scope)`,
);
// ── 5. Verify Opportunity field permissions (set via manifest, not here — see header) ─
- // Read back the role's existing fieldPermissions so one run confirms the full state.
- const oppInfo = objectInfoByName.get('opportunity') as ObjectInfo;
- const oppObjectId = oppInfo.objectMetadataId;
+ const oppObjectId = opportunityObjectId;
const allOppFields = await collectAllFields(metadataUrl, apiKey, oppObjectId);
const oppFieldIdToName = new Map<string, string>(
allOppFields.map((f) => [f.id, f.name]),
);
- // Build the expected lock set: every non-system, non-stage Opportunity field.
+ // Build the expected lock set: every non-system Opportunity field (incl. stage + amount).
const expectedLockedNames = new Set<string>(
allOppFields
.filter((f) => !OPPORTUNITY_FIELD_LOCK_SKIP.has(f.name))
@@ -447,22 +658,80 @@ async function main() {
),
);
- const stageIsLocked = oppLockedFps.some(
- (fp) => oppFieldIdToName.get(fp.fieldMetadataId) === 'stage',
+ if (missingLocks.length > 0) {
+ console.error(
+ `\n[rls:configure] DRIFT DETECTED: ${missingLocks.length} Opportunity field(s) ` +
+ `are NOT locked (canUpdateFieldValue: false) on the Partner role:\n` +
+ ` ${missingLocks.join(', ')}\n\n` +
+ `These permissions are declared in partner.role.ts and must be deployed via the\n` +
+ `app manifest. Run the following to deploy them:\n\n` +
+ ` yarn twenty dev --once -r <remote>\n\n` +
+ `(e.g. \`yarn twenty dev --once\` for local, ` +
+ `\`yarn twenty dev --once -r partner-twenty-com\` for prod)\n`,
+ );
+ process.exitCode = 1;
+ return;
+ }
+
+ console.log(
+ `[rls:configure] ✓ ${oppLockedFps.length} Opportunity fields locked (stage + amount read-only) — field permissions verified`,
+ );
+
+ // ── 6. Verify Application field permissions (set via manifest, not here — see header) ─
+
+ const applicationObjectId = objectIdByName.get('application') as string;
+
+ const allAppFields = await collectAllFields(
+ metadataUrl,
+ apiKey,
+ applicationObjectId,
+ );
+ const appFieldIdToName = new Map<string, string>(
+ allAppFields.map((field) => [field.id, field.name]),
+ );
+
+ const appLockedFps = partnerRole.fieldPermissions.filter(
+ (fieldPermission) =>
+ fieldPermission.objectMetadataId === applicationObjectId &&
+ fieldPermission.canUpdateFieldValue === false,
+ );
+
+ const missingAppLocks = [...APPLICATION_FIELD_LOCK_EXPECTED].filter(
+ (name) =>
+ !appLockedFps.some(
+ (fieldPermission) =>
+ appFieldIdToName.get(fieldPermission.fieldMetadataId) === name,
+ ),
+ );
+
+ const unexpectedAppLocks = appLockedFps
+ .map((fieldPermission) =>
+ appFieldIdToName.get(fieldPermission.fieldMetadataId),
+ )
+ .filter(
+ (name): name is string =>
+ name !== undefined &&
+ !APPLICATION_FIELD_LOCK_EXPECTED.has(name) &&
+ !APPLICATION_FIELD_LOCK_SKIP.has(name),
+ );
+
+ const pitchIsLocked = appLockedFps.some(
+ (fieldPermission) =>
+ appFieldIdToName.get(fieldPermission.fieldMetadataId) === 'pitch',
);
- if (stageIsLocked) {
+ if (pitchIsLocked) {
console.warn(
- `[rls:configure] WARNING: stage field is locked — it should be editable. ` +
+ `[rls:configure] WARNING: pitch field is locked — it should be editable. ` +
`Remove it from fieldPermissions in partner.role.ts and re-sync.`,
);
}
- if (missingLocks.length > 0) {
+ if (missingAppLocks.length > 0) {
console.error(
- `\n[rls:configure] DRIFT DETECTED: ${missingLocks.length} Opportunity field(s) ` +
+ `\n[rls:configure] DRIFT DETECTED: ${missingAppLocks.length} Application field(s) ` +
`are NOT locked (canUpdateFieldValue: false) on the Partner role:\n` +
- ` ${missingLocks.join(', ')}\n\n` +
+ ` ${missingAppLocks.join(', ')}\n\n` +
`These permissions are declared in partner.role.ts and must be deployed via the\n` +
`app manifest. Run the following to deploy them:\n\n` +
` yarn twenty dev --once -r <remote>\n\n` +
@@ -473,8 +742,16 @@ async function main() {
return;
}
+ if (unexpectedAppLocks.length > 0) {
+ console.warn(
+ `[rls:configure] NOTE: ${unexpectedAppLocks.length} extra Application field(s) ` +
+ `are locked beyond the expected set (platform fields may be locked intentionally):\n` +
+ ` ${unexpectedAppLocks.join(', ')}`,
+ );
+ }
+
console.log(
- `[rls:configure] ✓ ${oppLockedFps.length} Opportunity fields locked (stage + amount editable) — field permissions verified`,
+ `[rls:configure] ✓ ${appLockedFps.length} Application fields locked (pitch editable) — field permissions verified`,
);
}
diff --git a/packages/twenty-apps/internal/twenty-partners/src/scripts/seed.ts b/packages/twenty-apps/internal/twenty-partners/src/scripts/seed.ts
index 48f5ad7ca68..c3792f802f6 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/scripts/seed.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/scripts/seed.ts
@@ -1,6 +1,6 @@
// Single demo seed for the twenty-partners app. Idempotent UPSERT by natural key.
// Covers: partners across ALL validationStage values, companies + people,
-// opportunities across ALL 10 matchStatus values, and partner quotes across ALL
+// opportunities across ALL stage values, and partner quotes across ALL
// 5 statuses (each linked to a partner + opportunity).
//
// Run from this app directory, against a running Twenty server with the app
@@ -77,7 +77,7 @@ const PERSONS = [
type Opp = {
name: string;
companyName: string;
- matchStatus: string;
+ stage: string;
partnerSlug?: string;
numberOfSeats?: number;
hostingType?: string;
@@ -85,18 +85,18 @@ type Opp = {
subscriptionFrequency?: string;
};
-// One+ opportunity for every matchStatus value (all 10 covered).
+// One+ opportunity for every stage value (all 5 covered).
const OPPORTUNITIES: Opp[] = [
- { name: 'Acme RE — Q3 renewal', companyName: 'Acme Real Estate', matchStatus: 'TO_BE_MATCHED', numberOfSeats: 20, hostingType: 'CLOUD', subscriptionType: 'PRO', subscriptionFrequency: 'ANNUAL' },
- { name: 'Helix Bio — investor reporting', companyName: 'Helix Bio', matchStatus: 'MANUAL_MATCH', numberOfSeats: 12, hostingType: 'CLOUD', subscriptionType: 'ORG', subscriptionFrequency: 'MONTHLY' },
- { name: 'Helix Bio — pipeline review', companyName: 'Helix Bio', matchStatus: 'AUTO_MATCH', numberOfSeats: 8 },
- { name: 'Acme RE — CRM rollout', companyName: 'Acme Real Estate', matchStatus: 'MATCHED', partnerSlug: 'elevate-consulting', numberOfSeats: 30, hostingType: 'CLOUD', subscriptionType: 'ENT', subscriptionFrequency: 'ANNUAL' },
- { name: 'Sunrise — APAC fleet CRM', companyName: 'Sunrise Logistics', matchStatus: 'INTRODUCED_TO_A_PARTNER', partnerSlug: 'nine-dots-ventures', numberOfSeats: 50, hostingType: 'SELF_HOSTING', subscriptionType: 'ENT', subscriptionFrequency: 'ANNUAL' },
- { name: 'Helix Bio — clinical trials CRM', companyName: 'Helix Bio', matchStatus: 'WORKING_WITH_A_PARTNER', partnerSlug: 'netzero-systems', numberOfSeats: 25, hostingType: 'CLOUD', subscriptionType: 'ORG', subscriptionFrequency: 'MONTHLY' },
- { name: 'Helix Bio — self-host evaluation', companyName: 'Helix Bio', matchStatus: 'IMPLEMENTING', partnerSlug: 'meridian-craft', numberOfSeats: 40, hostingType: 'SELF_HOSTING', subscriptionType: 'ENT', subscriptionFrequency: 'ANNUAL' },
- { name: 'Sunrise — LATAM expansion', companyName: 'Sunrise Logistics', matchStatus: 'WON', partnerSlug: 'nine-dots-ventures', numberOfSeats: 60, hostingType: 'CLOUD', subscriptionType: 'ENT', subscriptionFrequency: 'ANNUAL' },
- { name: 'Acme RE — annual review', companyName: 'Acme Real Estate', matchStatus: 'RECONNECT_LATER', partnerSlug: 'w3villa-technologies', numberOfSeats: 15 },
- { name: 'Sunrise — vendor onboarding', companyName: 'Sunrise Logistics', matchStatus: 'LOST', numberOfSeats: 10, hostingType: 'CLOUD', subscriptionType: 'PRO', subscriptionFrequency: 'MONTHLY' },
+ { name: 'Acme RE — Q3 renewal', companyName: 'Acme Real Estate', stage: 'NEW', numberOfSeats: 20, hostingType: 'CLOUD', subscriptionType: 'PRO', subscriptionFrequency: 'ANNUAL' },
+ { name: 'Helix Bio — investor reporting', companyName: 'Helix Bio', stage: 'NEW', numberOfSeats: 12, hostingType: 'CLOUD', subscriptionType: 'ORG', subscriptionFrequency: 'MONTHLY' },
+ { name: 'Helix Bio — pipeline review', companyName: 'Helix Bio', stage: 'SCREENING', numberOfSeats: 8 },
+ { name: 'Acme RE — CRM rollout', companyName: 'Acme Real Estate', stage: 'MEETING', partnerSlug: 'elevate-consulting', numberOfSeats: 30, hostingType: 'CLOUD', subscriptionType: 'ENT', subscriptionFrequency: 'ANNUAL' },
+ { name: 'Sunrise — APAC fleet CRM', companyName: 'Sunrise Logistics', stage: 'MEETING', partnerSlug: 'nine-dots-ventures', numberOfSeats: 50, hostingType: 'SELF_HOSTING', subscriptionType: 'ENT', subscriptionFrequency: 'ANNUAL' },
+ { name: 'Helix Bio — clinical trials CRM', companyName: 'Helix Bio', stage: 'PROPOSAL', partnerSlug: 'netzero-systems', numberOfSeats: 25, hostingType: 'CLOUD', subscriptionType: 'ORG', subscriptionFrequency: 'MONTHLY' },
+ { name: 'Helix Bio — self-host evaluation', companyName: 'Helix Bio', stage: 'PROPOSAL', partnerSlug: 'meridian-craft', numberOfSeats: 40, hostingType: 'SELF_HOSTING', subscriptionType: 'ENT', subscriptionFrequency: 'ANNUAL' },
+ { name: 'Sunrise — LATAM expansion', companyName: 'Sunrise Logistics', stage: 'CUSTOMER', partnerSlug: 'nine-dots-ventures', numberOfSeats: 60, hostingType: 'CLOUD', subscriptionType: 'ENT', subscriptionFrequency: 'ANNUAL' },
+ { name: 'Acme RE — annual review', companyName: 'Acme Real Estate', stage: 'CUSTOMER', partnerSlug: 'w3villa-technologies', numberOfSeats: 15 },
+ { name: 'Sunrise — vendor onboarding', companyName: 'Sunrise Logistics', stage: 'SCREENING', numberOfSeats: 10, hostingType: 'CLOUD', subscriptionType: 'PRO', subscriptionFrequency: 'MONTHLY' },
];
type Quote = { name: string; status: string; partnerSlug: string; contentType: string[] };
@@ -169,7 +169,7 @@ async function main() {
const oppIdByName = new Map<string, string>();
for (const o of OPPORTUNITIES) {
const data: Record<string, unknown> = {
- name: o.name, matchStatus: o.matchStatus, companyId: companyIdByName.get(o.companyName),
+ name: o.name, stage: o.stage, companyId: companyIdByName.get(o.companyName),
...(o.partnerSlug ? { partnerId: partnerIdBySlug.get(o.partnerSlug) } : {}),
...(o.numberOfSeats != null ? { numberOfSeats: o.numberOfSeats } : {}),
...(o.hostingType ? { hostingType: o.hostingType } : {}),
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/all-opportunities.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/all-opportunities.view.ts
index e2110894aa3..a604302a744 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/views/all-opportunities.view.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/all-opportunities.view.ts
@@ -1,42 +1,54 @@
import {
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
- ViewSortDirection,
ViewType,
defineView,
} from 'twenty-sdk/define';
-import {
- ALL_OPPORTUNITIES_VIEW_UNIVERSAL_IDENTIFIER,
- MATCH_STATUS_FIELD_UNIVERSAL_IDENTIFIER,
-} from 'src/constants/universal-identifiers';
+import { ALL_OPPORTUNITIES_VIEW_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { OPPORTUNITY_IS_LISTED_FIELD_ID } from 'src/fields/opportunity-is-listed.field';
+import { PARTNER_ON_OPPORTUNITY_FIELD_ID } from 'src/fields/partner-on-opportunity.field';
-// All opportunities, every stage. Kept last in the Pipeline folder; same column set
-// as the without/with-partner views for consistent reading.
+// All opportunities, every stage. Kept last in the Matching folder.
export default defineView({
universalIdentifier: ALL_OPPORTUNITIES_VIEW_UNIVERSAL_IDENTIFIER,
- name: 'OPP all',
+ name: 'All Opportunities',
icon: 'IconTargetArrow',
objectUniversalIdentifier:
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
type: ViewType.TABLE,
- position: 3,
+ position: 5,
fields: [
- // Name
- { universalIdentifier: '62844317-546c-4b65-a292-917bf0b5bfce', fieldMetadataUniversalIdentifier: '20202020-8609-4f65-a2d9-44009eb422b5', position: 0, isVisible: true, size: 200 },
- // Partner
- { universalIdentifier: '9f72d1ce-7c39-418c-95cb-480d1b176821', fieldMetadataUniversalIdentifier: 'd9eeacaa-2f9e-44cc-b5f6-5e1526256d49', position: 1, isVisible: true, size: 200 },
- // Amount (fresh view-field UID: the reused one still pointed at a removed column)
- { universalIdentifier: 'aa57f807-48aa-4a63-b939-434342ee4bdd', fieldMetadataUniversalIdentifier: '20202020-583e-4642-8533-db761d5fa82f', position: 2, isVisible: true, size: 140 },
- // Match status
- { universalIdentifier: '5db9ee26-8688-4a5c-9fe8-f76b41d8e80b', fieldMetadataUniversalIdentifier: MATCH_STATUS_FIELD_UNIVERSAL_IDENTIFIER, position: 3, isVisible: true, size: 200 },
- ],
- // SELECT fields sort by option position, so this orders rows along the match-status
- // pipeline (To Be Matched → … → Won → Lost), not alphabetically.
- sorts: [
{
- universalIdentifier: 'e7adc9b2-4294-408b-83a0-cece6833ba12',
- fieldMetadataUniversalIdentifier: MATCH_STATUS_FIELD_UNIVERSAL_IDENTIFIER,
- direction: ViewSortDirection.ASC,
+ universalIdentifier: '62844317-546c-4b65-a292-917bf0b5bfce',
+ fieldMetadataUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.fields.name
+ .universalIdentifier,
+ position: 0,
+ isVisible: true,
+ size: 200,
+ },
+ {
+ universalIdentifier: '9f72d1ce-7c39-418c-95cb-480d1b176821',
+ fieldMetadataUniversalIdentifier: PARTNER_ON_OPPORTUNITY_FIELD_ID,
+ position: 1,
+ isVisible: true,
+ size: 200,
+ },
+ {
+ universalIdentifier: 'aa57f807-48aa-4a63-b939-434342ee4bdd',
+ fieldMetadataUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.fields.amount
+ .universalIdentifier,
+ position: 2,
+ isVisible: true,
+ size: 140,
+ },
+ {
+ universalIdentifier: 'be3a28db-152a-48be-ae21-91b175905ce4',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_IS_LISTED_FIELD_ID,
+ position: 3,
+ isVisible: true,
+ size: 90,
},
],
});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/all-partners.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/all-partners.view.ts
deleted file mode 100644
index aa904be3477..00000000000
--- a/packages/twenty-apps/internal/twenty-partners/src/views/all-partners.view.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { ViewType, defineView } from 'twenty-sdk/define';
-
-import {
- ALL_PARTNERS_VIEW_UNIVERSAL_IDENTIFIER,
- PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,
-} from 'src/constants/universal-identifiers';
-import { PARTNER_USER_ON_PARTNER_FIELD_ID } from 'src/fields/partner-user-on-partner.field';
-
-// Every partner, all stages — kept last in the Partners folder. No Last Match column.
-export default defineView({
- universalIdentifier: ALL_PARTNERS_VIEW_UNIVERSAL_IDENTIFIER,
- name: 'All',
- objectUniversalIdentifier: PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,
- type: ViewType.TABLE,
- position: 2,
- fields: [
- // Name (label identifier)
- { universalIdentifier: '21afcc69-09c5-42eb-a609-26c062de3bd3', fieldMetadataUniversalIdentifier: 'a0000001-0000-4000-8000-000000000001', position: 0, isVisible: true, size: 200 },
- // Validation Stage
- { universalIdentifier: '529912f0-38fb-4821-92d3-8a0a68b9f340', fieldMetadataUniversalIdentifier: '2ca9856f-f54a-4326-9ff3-668fd7da0b50', position: 1, isVisible: true },
- // Availability
- { universalIdentifier: '68c6b96d-8c3d-4a3e-b4cd-3751d035b085', fieldMetadataUniversalIdentifier: 'a0000004-0000-4000-8000-000000000004', position: 2, isVisible: true },
- // Languages Spoken
- { universalIdentifier: '8862e4a5-525a-4a0c-8381-93ff0d01ccf0', fieldMetadataUniversalIdentifier: 'a0000007-0000-4000-8000-000000000007', position: 3, isVisible: true },
- // Region
- { universalIdentifier: '52408b5f-5e13-4e3c-af2d-ce50033ec126', fieldMetadataUniversalIdentifier: '560503de-6330-4c1d-af97-a8dee125f2ad', position: 4, isVisible: true },
- // Categories (partnerScope)
- { universalIdentifier: '34d58668-a689-42e2-9aff-3fee315092d6', fieldMetadataUniversalIdentifier: '500021ad-ca42-4fd3-8727-392dd26b722a', position: 5, isVisible: true, size: 260 },
- // partnerUser: the member this partner logs in as — prerequisite for the cascade + RLS visibility.
- { universalIdentifier: '19d1fc62-2486-4f59-8e77-b4ee177481b1', fieldMetadataUniversalIdentifier: PARTNER_USER_ON_PARTNER_FIELD_ID, position: 6, isVisible: true },
- ],
-});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/application-record-page-fields.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/application-record-page-fields.view.ts
new file mode 100644
index 00000000000..07e32911630
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/application-record-page-fields.view.ts
@@ -0,0 +1,30 @@
+import { ViewType, defineView } from 'twenty-sdk/define';
+
+import {
+ APPLICATION_LAST_ACTIVITY_AT_FIELD_ID,
+ APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ APPLICATION_OPPORTUNITY_FIELD_ID,
+ APPLICATION_PARTNER_FIELD_ID,
+ APPLICATION_PITCH_FIELD_ID,
+ APPLICATION_STATE_FIELD_ID,
+} from 'src/objects/application.object';
+
+export const APPLICATION_RECORD_PAGE_FIELDS_VIEW_ID =
+ 'e004c2ff-462a-45d4-8a77-071dcf093879';
+
+// FIELDS_WIDGET view backing the Application record page side panel. Relation fields
+// (opportunity, partner) only render in the fields widget when an explicit view marks them
+// visible — this is that view.
+export default defineView({
+ universalIdentifier: APPLICATION_RECORD_PAGE_FIELDS_VIEW_ID,
+ name: 'Application Record Page Fields',
+ objectUniversalIdentifier: APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ type: ViewType.FIELDS_WIDGET,
+ fields: [
+ { universalIdentifier: '44793f47-5d06-43fa-9d33-23ec7602ecfc', fieldMetadataUniversalIdentifier: APPLICATION_OPPORTUNITY_FIELD_ID, position: 0, isVisible: true },
+ { universalIdentifier: '7d7ef49a-6d30-44de-b4eb-bb77d93b8982', fieldMetadataUniversalIdentifier: APPLICATION_PARTNER_FIELD_ID, position: 1, isVisible: true },
+ { universalIdentifier: 'd0278990-928c-4660-ac27-3abca0e52a5e', fieldMetadataUniversalIdentifier: APPLICATION_STATE_FIELD_ID, position: 2, isVisible: true },
+ { universalIdentifier: '28e0642b-76eb-4d41-83de-b84f07b3aad9', fieldMetadataUniversalIdentifier: APPLICATION_PITCH_FIELD_ID, position: 3, isVisible: true },
+ { universalIdentifier: '97acca2b-bda4-43f3-b58a-3293807fab08', fieldMetadataUniversalIdentifier: APPLICATION_LAST_ACTIVITY_AT_FIELD_ID, position: 4, isVisible: true },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/applications-by-opportunity.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/applications-by-opportunity.view.ts
new file mode 100644
index 00000000000..f33261cfce1
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/applications-by-opportunity.view.ts
@@ -0,0 +1,68 @@
+import { ViewSortDirection, ViewType, defineView } from 'twenty-sdk/define';
+
+import {
+ APPLICATION_LAST_ACTIVITY_AT_FIELD_ID,
+ APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ APPLICATION_OPPORTUNITY_FIELD_ID,
+ APPLICATION_PARTNER_FIELD_ID,
+ APPLICATION_PITCH_FIELD_ID,
+ APPLICATION_STATE_FIELD_ID,
+} from 'src/objects/application.object';
+
+export const APPLICATIONS_BY_OPPORTUNITY_VIEW_UNIVERSAL_IDENTIFIER =
+ 'db489249-284d-41b1-8537-71a655389cb7';
+
+// Relation fields cannot drive TABLE group-by in Twenty (only SELECT + static
+// groups[]). Sort by opportunity so applicants cluster per brief instead.
+export default defineView({
+ universalIdentifier: APPLICATIONS_BY_OPPORTUNITY_VIEW_UNIVERSAL_IDENTIFIER,
+ name: 'Applications by Opportunity',
+ icon: 'IconTargetArrow',
+ objectUniversalIdentifier: APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ type: ViewType.TABLE,
+ position: 4,
+ fields: [
+ {
+ universalIdentifier: '1b6984aa-4011-4b77-8121-9f4d987a2e07',
+ fieldMetadataUniversalIdentifier: APPLICATION_OPPORTUNITY_FIELD_ID,
+ position: 0,
+ isVisible: true,
+ size: 200,
+ },
+ {
+ universalIdentifier: 'f57b1dd2-f415-4c01-8f0a-d55b941b23c7',
+ fieldMetadataUniversalIdentifier: APPLICATION_PARTNER_FIELD_ID,
+ position: 1,
+ isVisible: true,
+ size: 200,
+ },
+ {
+ universalIdentifier: '612db8df-a809-4557-add4-1802a434efb2',
+ fieldMetadataUniversalIdentifier: APPLICATION_STATE_FIELD_ID,
+ position: 2,
+ isVisible: true,
+ size: 140,
+ },
+ {
+ universalIdentifier: 'ba53baa3-4db7-466e-a066-0d9156bc0a82',
+ fieldMetadataUniversalIdentifier: APPLICATION_PITCH_FIELD_ID,
+ position: 3,
+ isVisible: true,
+ size: 280,
+ },
+ {
+ universalIdentifier: '2f570d42-614d-4562-8d12-df5605874b9c',
+ fieldMetadataUniversalIdentifier: APPLICATION_LAST_ACTIVITY_AT_FIELD_ID,
+ position: 4,
+ isVisible: true,
+ size: 180,
+ },
+ ],
+ sorts: [
+ {
+ universalIdentifier: 'ce31ed78-cd7a-410a-8d95-2e10c846d765',
+ fieldMetadataUniversalIdentifier: APPLICATION_OPPORTUNITY_FIELD_ID,
+ direction: ViewSortDirection.ASC,
+ },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/applications-review.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/applications-review.view.ts
new file mode 100644
index 00000000000..792721b9ee1
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/applications-review.view.ts
@@ -0,0 +1,113 @@
+import { ViewSortDirection, ViewType, defineView } from 'twenty-sdk/define';
+
+import {
+ APPLICATION_LAST_ACTIVITY_AT_FIELD_ID,
+ APPLICATION_NAME_FIELD_ID,
+ APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ APPLICATION_OPPORTUNITY_FIELD_ID,
+ APPLICATION_PARTNER_FIELD_ID,
+ APPLICATION_PITCH_FIELD_ID,
+ APPLICATION_STATE_FIELD_ID,
+} from 'src/objects/application.object';
+
+export const APPLICATIONS_REVIEW_VIEW_UNIVERSAL_IDENTIFIER =
+ 'cc652ba3-23e8-4e0e-a616-c9fa50b702a0';
+
+export default defineView({
+ universalIdentifier: APPLICATIONS_REVIEW_VIEW_UNIVERSAL_IDENTIFIER,
+ name: 'Applications',
+ icon: 'IconUserPlus',
+ objectUniversalIdentifier: APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ type: ViewType.TABLE,
+ position: 2,
+ mainGroupByFieldMetadataUniversalIdentifier: APPLICATION_STATE_FIELD_ID,
+ groups: [
+ {
+ universalIdentifier: '332125fd-b69f-4bb8-b33d-a07ead1ca051',
+ fieldValue: 'APPLIED',
+ position: 0,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '90af09ea-806b-446a-9816-91dd878eb485',
+ fieldValue: 'INVITED',
+ position: 1,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: 'e16ad28d-27aa-454f-b9f3-ab35697e0856',
+ fieldValue: 'INTRODUCED',
+ position: 2,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: 'f122dd3d-e660-44da-b250-73cbdc6a1135',
+ fieldValue: 'WON',
+ position: 3,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '22074627-0b0b-4d6d-a377-1cf34cf7bc6c',
+ fieldValue: 'DECLINED',
+ position: 4,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '274c32e1-d149-45ce-9f48-94fa7a42c77a',
+ fieldValue: 'BACKUP',
+ position: 5,
+ isVisible: true,
+ },
+ ],
+ fields: [
+ {
+ universalIdentifier: 'e91b83e8-a774-4057-9068-892463de7366',
+ fieldMetadataUniversalIdentifier: APPLICATION_NAME_FIELD_ID,
+ position: 0,
+ isVisible: true,
+ size: 220,
+ },
+ {
+ universalIdentifier: 'db3ed5b7-468a-468f-a3b6-c482773a7bc1',
+ fieldMetadataUniversalIdentifier: APPLICATION_OPPORTUNITY_FIELD_ID,
+ position: 1,
+ isVisible: true,
+ size: 200,
+ },
+ {
+ universalIdentifier: '0142b9ed-3f9c-4697-ab3f-9240c7812b4d',
+ fieldMetadataUniversalIdentifier: APPLICATION_PARTNER_FIELD_ID,
+ position: 2,
+ isVisible: true,
+ size: 200,
+ },
+ {
+ universalIdentifier: 'a2317ac0-1086-44c5-8f3a-c8a7d9f8edcf',
+ fieldMetadataUniversalIdentifier: APPLICATION_STATE_FIELD_ID,
+ position: 3,
+ isVisible: true,
+ size: 140,
+ },
+ {
+ universalIdentifier: '36a138d6-09dc-4ed9-8517-6b20778f5836',
+ fieldMetadataUniversalIdentifier: APPLICATION_PITCH_FIELD_ID,
+ position: 4,
+ isVisible: true,
+ size: 280,
+ },
+ {
+ universalIdentifier: '651dfe47-a00f-4ad5-9af8-95a656ec0b31',
+ fieldMetadataUniversalIdentifier: APPLICATION_LAST_ACTIVITY_AT_FIELD_ID,
+ position: 5,
+ isVisible: true,
+ size: 180,
+ },
+ ],
+ sorts: [
+ {
+ universalIdentifier: '2ea53941-c791-4684-b328-c3787292dbf4',
+ fieldMetadataUniversalIdentifier: APPLICATION_STATE_FIELD_ID,
+ direction: ViewSortDirection.ASC,
+ },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/briefs-to-match.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/briefs-to-match.view.ts
new file mode 100644
index 00000000000..70d4cd7b94c
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/briefs-to-match.view.ts
@@ -0,0 +1,81 @@
+import {
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+ ViewFilterOperand,
+ ViewType,
+ defineView,
+} from 'twenty-sdk/define';
+
+import { OPPORTUNITY_IS_LISTED_FIELD_ID } from 'src/fields/opportunity-is-listed.field';
+import { OPPORTUNITY_NEED_FIELD_ID } from 'src/fields/opportunity-need.field';
+import { OPPORTUNITY_REQUIREMENTS_FIELD_ID } from 'src/fields/opportunity-requirements.field';
+import { PARTNER_ON_OPPORTUNITY_FIELD_ID } from 'src/fields/partner-on-opportunity.field';
+
+export const BRIEFS_TO_MATCH_VIEW_UNIVERSAL_IDENTIFIER =
+ 'cdf316f2-b79b-4d3a-8091-44d90b77cb8c';
+
+const OPPORTUNITY_CREATED_AT_FIELD_ID =
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.fields.createdAt
+ .universalIdentifier;
+
+export default defineView({
+ universalIdentifier: BRIEFS_TO_MATCH_VIEW_UNIVERSAL_IDENTIFIER,
+ name: 'Briefs to Match',
+ icon: 'IconUserOff',
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ type: ViewType.TABLE,
+ position: 0,
+ fields: [
+ {
+ universalIdentifier: '1a469b6f-0ee9-41bb-9b4e-4fa917ef41aa',
+ fieldMetadataUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.fields.name
+ .universalIdentifier,
+ position: 0,
+ isVisible: true,
+ size: 200,
+ },
+ {
+ universalIdentifier: '006b23b2-0591-4b7c-bec4-f39ef466f76b',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_NEED_FIELD_ID,
+ position: 1,
+ isVisible: true,
+ size: 280,
+ },
+ {
+ universalIdentifier: '94c584d6-382f-415e-b021-127339612dd3',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_REQUIREMENTS_FIELD_ID,
+ position: 2,
+ isVisible: true,
+ size: 280,
+ },
+ {
+ universalIdentifier: 'd11e3ff9-ef1a-4be6-9970-67a565712433',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_CREATED_AT_FIELD_ID,
+ position: 3,
+ isVisible: true,
+ size: 180,
+ },
+ {
+ universalIdentifier: 'b36cb21c-f5d0-4291-bde4-867efafdd689',
+ fieldMetadataUniversalIdentifier: PARTNER_ON_OPPORTUNITY_FIELD_ID,
+ position: 4,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '91c1c03c-049d-4abb-bc14-b78662117f7c',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_IS_LISTED_FIELD_ID,
+ position: 5,
+ isVisible: true,
+ size: 90,
+ },
+ ],
+ filters: [
+ {
+ universalIdentifier: '0030e8ec-b20a-41ad-a684-6e7dc42dc4c3',
+ fieldMetadataUniversalIdentifier: PARTNER_ON_OPPORTUNITY_FIELD_ID,
+ operand: ViewFilterOperand.IS_EMPTY,
+ value: '',
+ },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/deals-board.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/deals-board.view.ts
new file mode 100644
index 00000000000..baa4119cca7
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/deals-board.view.ts
@@ -0,0 +1,110 @@
+import {
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+ ViewFilterOperand,
+ ViewType,
+ defineView,
+} from 'twenty-sdk/define';
+
+import { OPPORTUNITY_IS_LISTED_FIELD_ID } from 'src/fields/opportunity-is-listed.field';
+import { PARTNER_ON_OPPORTUNITY_FIELD_ID } from 'src/fields/partner-on-opportunity.field';
+import { APPLICATIONS_ON_OPPORTUNITY_FIELD_ID } from 'src/objects/application.object';
+
+export const DEALS_BOARD_VIEW_UNIVERSAL_IDENTIFIER =
+ '39c3ffbc-e91a-46b9-a9c6-4d186d5b3dcf';
+
+const OPPORTUNITY_STAGE_FIELD_ID =
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.fields.stage
+ .universalIdentifier;
+
+export default defineView({
+ universalIdentifier: DEALS_BOARD_VIEW_UNIVERSAL_IDENTIFIER,
+ name: 'Deals',
+ icon: 'IconLayoutKanban',
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ type: ViewType.KANBAN,
+ position: 1,
+ mainGroupByFieldMetadataUniversalIdentifier: OPPORTUNITY_STAGE_FIELD_ID,
+ groups: [
+ {
+ universalIdentifier: '3d9ee938-572f-4b46-a78d-25bd971dab48',
+ fieldValue: 'NEW',
+ position: 0,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '2253c89d-385e-4207-8e46-b8afb7544d07',
+ fieldValue: 'SCREENING',
+ position: 1,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: 'becb8cf2-56b2-4f1d-8da4-3856c48a6ea4',
+ fieldValue: 'MEETING',
+ position: 2,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '918de88b-3eae-4f6e-9f75-3341f4567ddf',
+ fieldValue: 'PROPOSAL',
+ position: 3,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '754dc132-94a3-464b-b524-6ae6b4a50e78',
+ fieldValue: 'CUSTOMER',
+ position: 4,
+ isVisible: true,
+ },
+ ],
+ fields: [
+ {
+ universalIdentifier: '98c37e50-cece-4b5c-b83d-225f644a8151',
+ fieldMetadataUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.fields.name
+ .universalIdentifier,
+ position: 0,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '94640b9c-020a-4535-affa-e0b3def4cc2f',
+ fieldMetadataUniversalIdentifier: PARTNER_ON_OPPORTUNITY_FIELD_ID,
+ position: 1,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '5797b801-ce0d-4098-ac9f-f1ad972ebb13',
+ fieldMetadataUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.fields.amount
+ .universalIdentifier,
+ position: 2,
+ isVisible: false,
+ },
+ {
+ universalIdentifier: '65ddf983-822d-4fd7-97a3-6de34527b8de',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_STAGE_FIELD_ID,
+ position: 3,
+ isVisible: false,
+ },
+ {
+ universalIdentifier: '48d052c0-b00f-40e7-81fa-d30d01a5e784',
+ fieldMetadataUniversalIdentifier: APPLICATIONS_ON_OPPORTUNITY_FIELD_ID,
+ position: 4,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '3ec96824-b543-4039-acb4-8e0aff422c90',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_IS_LISTED_FIELD_ID,
+ position: 5,
+ isVisible: true,
+ },
+ ],
+ filters: [
+ {
+ universalIdentifier: 'a536f770-ecc2-4046-822d-5b414ff1a7de',
+ fieldMetadataUniversalIdentifier: PARTNER_ON_OPPORTUNITY_FIELD_ID,
+ operand: ViewFilterOperand.IS_NOT_EMPTY,
+ value: '',
+ },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/followup-applications.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/followup-applications.view.ts
new file mode 100644
index 00000000000..e902cfcc522
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/followup-applications.view.ts
@@ -0,0 +1,77 @@
+import { ViewFilterOperand, ViewType, defineView } from 'twenty-sdk/define';
+
+import {
+ APPLICATION_LAST_ACTIVITY_AT_FIELD_ID,
+ APPLICATION_NAME_FIELD_ID,
+ APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ APPLICATION_OPPORTUNITY_FIELD_ID,
+ APPLICATION_PARTNER_FIELD_ID,
+ APPLICATION_PITCH_FIELD_ID,
+ APPLICATION_STATE_FIELD_ID,
+} from 'src/objects/application.object';
+
+export const FOLLOWUP_APPLICATIONS_VIEW_UNIVERSAL_IDENTIFIER =
+ 'c815e9f5-511b-467f-85b0-08ef341ff856';
+
+export default defineView({
+ universalIdentifier: FOLLOWUP_APPLICATIONS_VIEW_UNIVERSAL_IDENTIFIER,
+ name: 'Follow-up · Applications',
+ icon: 'IconClock',
+ objectUniversalIdentifier: APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ type: ViewType.TABLE,
+ position: 3,
+ fields: [
+ {
+ universalIdentifier: '5f3632ec-797f-4b96-a228-c56830dc75d4',
+ fieldMetadataUniversalIdentifier: APPLICATION_NAME_FIELD_ID,
+ position: 0,
+ isVisible: true,
+ size: 220,
+ },
+ {
+ universalIdentifier: '8844728f-9622-4554-9916-dba8328d3c9c',
+ fieldMetadataUniversalIdentifier: APPLICATION_OPPORTUNITY_FIELD_ID,
+ position: 1,
+ isVisible: true,
+ size: 200,
+ },
+ {
+ universalIdentifier: '678c7516-1436-40fd-b3b4-6e5fefcecf0e',
+ fieldMetadataUniversalIdentifier: APPLICATION_PARTNER_FIELD_ID,
+ position: 2,
+ isVisible: true,
+ size: 200,
+ },
+ {
+ universalIdentifier: '5f7884af-c5a4-4822-b8bf-0fb233e28f2f',
+ fieldMetadataUniversalIdentifier: APPLICATION_STATE_FIELD_ID,
+ position: 3,
+ isVisible: true,
+ size: 140,
+ },
+ {
+ universalIdentifier: 'c1ea77ed-a4ab-4937-929e-d1b719a7a8d8',
+ fieldMetadataUniversalIdentifier: APPLICATION_PITCH_FIELD_ID,
+ position: 4,
+ isVisible: true,
+ size: 280,
+ },
+ {
+ universalIdentifier: '4c5c5fb0-7a32-418e-a190-54d37547ddd3',
+ fieldMetadataUniversalIdentifier: APPLICATION_LAST_ACTIVITY_AT_FIELD_ID,
+ position: 5,
+ isVisible: true,
+ size: 180,
+ },
+ ],
+ filters: [
+ // TODO(B5): add lastActivityAt > 7d relative filter once operand form confirmed
+ // ponytail: 7d literal in the filter, not config.
+ {
+ universalIdentifier: 'b89e349f-7b69-4917-8988-edb22d0314ac',
+ fieldMetadataUniversalIdentifier: APPLICATION_STATE_FIELD_ID,
+ operand: ViewFilterOperand.IS,
+ value: ['APPLIED', 'INVITED', 'INTRODUCED'],
+ },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/followup-briefs.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/followup-briefs.view.ts
new file mode 100644
index 00000000000..8cf3f32086d
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/followup-briefs.view.ts
@@ -0,0 +1,75 @@
+import {
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+ ViewFilterOperand,
+ ViewType,
+ defineView,
+} from 'twenty-sdk/define';
+
+import { OPPORTUNITY_IS_LISTED_FIELD_ID } from 'src/fields/opportunity-is-listed.field';
+import { OPPORTUNITY_NEED_FIELD_ID } from 'src/fields/opportunity-need.field';
+import { OPPORTUNITY_REQUIREMENTS_FIELD_ID } from 'src/fields/opportunity-requirements.field';
+import { PARTNER_ON_OPPORTUNITY_FIELD_ID } from 'src/fields/partner-on-opportunity.field';
+
+export const FOLLOWUP_BRIEFS_VIEW_UNIVERSAL_IDENTIFIER =
+ '208374b1-ab8c-414a-ab6e-cf667e58e82c';
+
+const OPPORTUNITY_CREATED_AT_FIELD_ID =
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.fields.createdAt
+ .universalIdentifier;
+
+export default defineView({
+ universalIdentifier: FOLLOWUP_BRIEFS_VIEW_UNIVERSAL_IDENTIFIER,
+ name: 'Follow-up · Briefs',
+ icon: 'IconClockExclamation',
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ type: ViewType.TABLE,
+ position: 4,
+ fields: [
+ {
+ universalIdentifier: '6c05d4b4-9a9e-4aa6-b3be-b0b2eeec1247',
+ fieldMetadataUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.fields.name
+ .universalIdentifier,
+ position: 0,
+ isVisible: true,
+ size: 200,
+ },
+ {
+ universalIdentifier: '3bb4a39b-db7f-4976-84ce-983263fc1d39',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_NEED_FIELD_ID,
+ position: 1,
+ isVisible: true,
+ size: 280,
+ },
+ {
+ universalIdentifier: 'e74e0e43-ae5f-4548-a9c1-a24775f94650',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_REQUIREMENTS_FIELD_ID,
+ position: 2,
+ isVisible: true,
+ size: 280,
+ },
+ {
+ universalIdentifier: '76005fd9-2501-4004-bc92-bcbe3cb7927f',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_CREATED_AT_FIELD_ID,
+ position: 3,
+ isVisible: true,
+ size: 180,
+ },
+ ],
+ filters: [
+ {
+ universalIdentifier: 'aca50fdf-e3a7-417c-ba28-411ac67c952a',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_IS_LISTED_FIELD_ID,
+ operand: ViewFilterOperand.IS,
+ value: 'true',
+ },
+ {
+ universalIdentifier: 'fb283e36-abab-4764-ba19-c9761eb82e57',
+ fieldMetadataUniversalIdentifier: PARTNER_ON_OPPORTUNITY_FIELD_ID,
+ operand: ViewFilterOperand.IS_EMPTY,
+ value: '',
+ },
+ // TODO(B5): add createdAt > 7d relative filter once operand form confirmed
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/my-applications.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/my-applications.view.ts
new file mode 100644
index 00000000000..bbe4845b6df
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/my-applications.view.ts
@@ -0,0 +1,29 @@
+import { ViewType, defineView } from 'twenty-sdk/define';
+
+import {
+ APPLICATION_LAST_ACTIVITY_AT_FIELD_ID,
+ APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ APPLICATION_OPPORTUNITY_FIELD_ID,
+ APPLICATION_PITCH_FIELD_ID,
+ APPLICATION_STATE_FIELD_ID,
+} from 'src/objects/application.object';
+
+export const MY_APPLICATIONS_VIEW_UNIVERSAL_IDENTIFIER =
+ 'cba45e02-b3a7-420f-ace5-5e2773076080';
+
+// Partner-facing list of the partner's own candidacies on opportunity briefs.
+// partner sees only their own rows once B7 RLS lands; unfiltered pre-B7.
+export default defineView({
+ universalIdentifier: MY_APPLICATIONS_VIEW_UNIVERSAL_IDENTIFIER,
+ name: 'My Applications',
+ icon: 'IconSend',
+ objectUniversalIdentifier: APPLICATION_OBJECT_UNIVERSAL_IDENTIFIER,
+ type: ViewType.TABLE,
+ position: 0,
+ fields: [
+ { universalIdentifier: 'fe004e19-5aee-4716-aa6f-3d27cdc52ae2', fieldMetadataUniversalIdentifier: APPLICATION_OPPORTUNITY_FIELD_ID, position: 0, isVisible: true, size: 200 },
+ { universalIdentifier: '9cf77b15-fdd6-4123-bdbf-a50e422417c2', fieldMetadataUniversalIdentifier: APPLICATION_STATE_FIELD_ID, position: 1, isVisible: true, size: 140 },
+ { universalIdentifier: '321a7f6c-0207-47c2-860f-706eaa5c2fa9', fieldMetadataUniversalIdentifier: APPLICATION_PITCH_FIELD_ID, position: 2, isVisible: true, size: 280 },
+ { universalIdentifier: '5f862e3f-3db0-408a-9268-c04d5ee18a91', fieldMetadataUniversalIdentifier: APPLICATION_LAST_ACTIVITY_AT_FIELD_ID, position: 3, isVisible: true, size: 180 },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/my-deals.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/my-deals.view.ts
new file mode 100644
index 00000000000..c61afd447c3
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/my-deals.view.ts
@@ -0,0 +1,40 @@
+import {
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+ ViewFilterOperand,
+ ViewType,
+ defineView,
+} from 'twenty-sdk/define';
+
+import { PARTNER_ON_OPPORTUNITY_FIELD_ID } from 'src/fields/partner-on-opportunity.field';
+
+export const MY_DEALS_VIEW_UNIVERSAL_IDENTIFIER =
+ '09c9b985-6dce-43ec-a6b3-5e878e1aec74';
+
+const OPPORTUNITY_NAME_FIELD_ID = '20202020-8609-4f65-a2d9-44009eb422b5';
+const OPPORTUNITY_STAGE_FIELD_ID = '20202020-6f76-477d-8551-28cd65b2b4b9';
+const OPPORTUNITY_AMOUNT_FIELD_ID = '20202020-583e-4642-8533-db761d5fa82f';
+
+// Partner-facing list of opportunities assigned to the partner (partner relation set).
+// RLS still allows listed briefs without a partner; this view scopes to assigned deals only.
+export default defineView({
+ universalIdentifier: MY_DEALS_VIEW_UNIVERSAL_IDENTIFIER,
+ name: 'My Deals',
+ icon: 'IconHandshake',
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ type: ViewType.TABLE,
+ position: 3,
+ fields: [
+ { universalIdentifier: '5c936e54-687a-4bf4-a995-1d90c71b337e', fieldMetadataUniversalIdentifier: OPPORTUNITY_NAME_FIELD_ID, position: 0, isVisible: true, size: 200 },
+ { universalIdentifier: 'c7d850e1-5d95-4097-93a3-02142654a470', fieldMetadataUniversalIdentifier: OPPORTUNITY_STAGE_FIELD_ID, position: 1, isVisible: true, size: 160 },
+ { universalIdentifier: 'fee39824-5859-433e-8f08-c4b9edecca0a', fieldMetadataUniversalIdentifier: OPPORTUNITY_AMOUNT_FIELD_ID, position: 2, isVisible: true, size: 140 },
+ ],
+ filters: [
+ {
+ universalIdentifier: '7e2f4a91-3c8d-4b5e-9f01-2a3b4c5d6e7f',
+ fieldMetadataUniversalIdentifier: PARTNER_ON_OPPORTUNITY_FIELD_ID,
+ operand: ViewFilterOperand.IS_NOT_EMPTY,
+ value: '',
+ },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/my-profile.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/my-profile.view.ts
new file mode 100644
index 00000000000..9032dbfa78d
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/my-profile.view.ts
@@ -0,0 +1,27 @@
+import { ViewType, defineView } from 'twenty-sdk/define';
+
+import { PARTNER_OBJECT_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+
+export const MY_PROFILE_VIEW_UNIVERSAL_IDENTIFIER =
+ '183ab293-07ce-4be6-8dfc-436a058c36e9';
+
+const PARTNER_NAME_FIELD_ID = 'a0000001-0000-4000-8000-000000000001';
+const PARTNER_AVAILABILITY_FIELD_ID = 'a0000004-0000-4000-8000-000000000004';
+const PARTNER_INTRODUCTION_FIELD_ID = 'a0000009-0000-4000-8000-000000000009';
+const PARTNER_CALENDAR_LINK_FIELD_ID = 'a0000008-0000-4000-8000-000000000008';
+
+// Partner-facing profile view — the partner edits their own listing fields here.
+export default defineView({
+ universalIdentifier: MY_PROFILE_VIEW_UNIVERSAL_IDENTIFIER,
+ name: 'My Profile',
+ icon: 'IconUser',
+ objectUniversalIdentifier: PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,
+ type: ViewType.TABLE,
+ position: 2,
+ fields: [
+ { universalIdentifier: 'e23cbd41-dfc1-45d9-b385-e3ddd9d9e909', fieldMetadataUniversalIdentifier: PARTNER_NAME_FIELD_ID, position: 0, isVisible: true, size: 200 },
+ { universalIdentifier: 'ce9249d5-914e-458a-a115-e4daa09a6f95', fieldMetadataUniversalIdentifier: PARTNER_AVAILABILITY_FIELD_ID, position: 1, isVisible: true, size: 140 },
+ { universalIdentifier: '8aa8bca2-8b9d-4028-b003-ab3fe8233fd1', fieldMetadataUniversalIdentifier: PARTNER_INTRODUCTION_FIELD_ID, position: 2, isVisible: true, size: 320 },
+ { universalIdentifier: '4349740f-7c1a-4f20-b64f-36d53b18eef1', fieldMetadataUniversalIdentifier: PARTNER_CALENDAR_LINK_FIELD_ID, position: 3, isVisible: true, size: 200 },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/open-briefs.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/open-briefs.view.ts
new file mode 100644
index 00000000000..fde063e84c1
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/open-briefs.view.ts
@@ -0,0 +1,46 @@
+import {
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+ ViewFilterOperand,
+ ViewType,
+ defineView,
+} from 'twenty-sdk/define';
+
+import { OPPORTUNITY_IS_LISTED_FIELD_ID } from 'src/fields/opportunity-is-listed.field';
+import { OPPORTUNITY_NEED_FIELD_ID } from 'src/fields/opportunity-need.field';
+import { OPPORTUNITY_REQUIREMENTS_FIELD_ID } from 'src/fields/opportunity-requirements.field';
+
+export const OPEN_BRIEFS_VIEW_UNIVERSAL_IDENTIFIER =
+ 'e1f9629d-c490-450e-b3c5-c944aca292eb';
+
+// Marketplace view: all Opportunities that ops have listed for partner browsing.
+// Partners see this list and apply via the "Apply" workflow action (B4).
+export default defineView({
+ universalIdentifier: OPEN_BRIEFS_VIEW_UNIVERSAL_IDENTIFIER,
+ name: 'Open Briefs',
+ icon: 'IconBuildingStore',
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ type: ViewType.TABLE,
+ position: 5,
+ fields: [
+ // Name
+ { universalIdentifier: '74595afa-c9c4-45b6-b362-803fb5574fbd', fieldMetadataUniversalIdentifier: '20202020-8609-4f65-a2d9-44009eb422b5', position: 0, isVisible: true, size: 200 },
+ // Need (B1 brief field)
+ { universalIdentifier: 'a24d52c4-9d0b-4145-a8fb-a4e21e002f58', fieldMetadataUniversalIdentifier: OPPORTUNITY_NEED_FIELD_ID, position: 1, isVisible: true, size: 280 },
+ // Requirements (B1 brief field)
+ { universalIdentifier: '8cd4738b-2975-45e0-959b-8e830a8bf3dc', fieldMetadataUniversalIdentifier: OPPORTUNITY_REQUIREMENTS_FIELD_ID, position: 2, isVisible: true, size: 280 },
+ // Listed flag — visible so ops can verify the filter at a glance
+ { universalIdentifier: '9720b93b-be90-40ee-89b2-42c04c8e09da', fieldMetadataUniversalIdentifier: OPPORTUNITY_IS_LISTED_FIELD_ID, position: 3, isVisible: true, size: 90 },
+ ],
+ filters: [
+ // Show only opportunities marked as listed (isListed = true).
+ // BOOLEAN fields use ViewFilterOperand.IS with the string value 'true' —
+ // the same representation the Twenty frontend stores and reads for boolean IS filters.
+ {
+ universalIdentifier: '642be3a1-c0f8-4197-9628-a2d3e25ed624',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_IS_LISTED_FIELD_ID,
+ operand: ViewFilterOperand.IS,
+ value: 'true',
+ },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/opportunities-with-partner-board.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/opportunities-with-partner-board.view.ts
deleted file mode 100644
index 23a9912063f..00000000000
--- a/packages/twenty-apps/internal/twenty-partners/src/views/opportunities-with-partner-board.view.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import {
- STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
- ViewFilterOperand,
- ViewType,
- defineView,
-} from 'twenty-sdk/define';
-
-import {
- MATCH_STATUS_FIELD_UNIVERSAL_IDENTIFIER,
- OPPORTUNITIES_WITH_PARTNER_BOARD_VIEW_UNIVERSAL_IDENTIFIER,
-} from 'src/constants/universal-identifiers';
-
-// Kanban board of partnered opportunities, one column per match status (in pipeline
-// order). Same with-partner filter as the table view. Empty columns (e.g. the pre-match
-// statuses, which never apply to a partnered opp) are left to the per-view "Hide empty
-// groups" toggle — we don't hide columns declaratively (brittle long-term).
-export default defineView({
- universalIdentifier: OPPORTUNITIES_WITH_PARTNER_BOARD_VIEW_UNIVERSAL_IDENTIFIER,
- name: 'OPP with partner (board)',
- icon: 'IconLayoutKanban',
- objectUniversalIdentifier:
- STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
- type: ViewType.KANBAN,
- position: 2,
- mainGroupByFieldMetadataUniversalIdentifier: MATCH_STATUS_FIELD_UNIVERSAL_IDENTIFIER,
- // Kanban columns — all visible. A manifest-defined kanban does not auto-create its
- // groups, so they must be declared (otherwise the board renders blank).
- groups: [
- { universalIdentifier: '01361796-2bb6-4cd0-82ec-ac71f81468c9', fieldValue: 'TO_BE_MATCHED', position: 0, isVisible: true },
- { universalIdentifier: 'cc6a04b2-d5f9-411d-b344-a78a114ffe0a', fieldValue: 'MANUAL_MATCH', position: 1, isVisible: true },
- { universalIdentifier: '4c2be421-0626-49db-807c-3b2b324bf61d', fieldValue: 'AUTO_MATCH', position: 2, isVisible: true },
- { universalIdentifier: '09dae3dc-ac9a-44dc-a875-7e7a1f127537', fieldValue: 'MATCHED', position: 3, isVisible: true },
- { universalIdentifier: 'ccfc2d1f-554b-4152-8eed-5759b4820a99', fieldValue: 'INTRODUCED_TO_A_PARTNER', position: 4, isVisible: true },
- { universalIdentifier: '04bf9e33-8cda-487c-bfdf-573cbe658bda', fieldValue: 'WORKING_WITH_A_PARTNER', position: 5, isVisible: true },
- { universalIdentifier: 'e966a846-7f1b-4091-a50b-473387fcd009', fieldValue: 'IMPLEMENTING', position: 6, isVisible: true },
- { universalIdentifier: 'dd3f67b8-5468-4345-9c7e-1d61fd12b3e3', fieldValue: 'WON', position: 7, isVisible: true },
- { universalIdentifier: '6abcc9a5-eed0-48bd-bb00-fc06283429ad', fieldValue: 'RECONNECT_LATER', position: 8, isVisible: true },
- { universalIdentifier: '985c64fc-8694-4f92-b183-1deaa287a43e', fieldValue: 'LOST', position: 9, isVisible: true },
- ],
- fields: [
- // Name (opportunity)
- { universalIdentifier: '9d8ee0ee-1b32-4c42-b968-7c18a0e90b25', fieldMetadataUniversalIdentifier: '20202020-8609-4f65-a2d9-44009eb422b5', position: 0, isVisible: true },
- // Partner
- { universalIdentifier: '619d7e2f-05db-4c40-8fa4-87fa30a8e8b0', fieldMetadataUniversalIdentifier: 'd9eeacaa-2f9e-44cc-b5f6-5e1526256d49', position: 1, isVisible: true },
- // Amount
- { universalIdentifier: 'c19fb75d-0b41-4997-920f-e9bfd1d01e06', fieldMetadataUniversalIdentifier: '20202020-583e-4642-8533-db761d5fa82f', position: 2, isVisible: true },
- // Match status — hidden on the card (it's already the column), kept only so the
- // group-by field is part of the view.
- { universalIdentifier: '5cb6903b-3220-4c96-a977-5a35d0136f33', fieldMetadataUniversalIdentifier: MATCH_STATUS_FIELD_UNIVERSAL_IDENTIFIER, position: 3, isVisible: false },
- ],
- filters: [
- {
- universalIdentifier: 'b46f2c0b-c37e-41a2-981a-fd642687cf4d',
- fieldMetadataUniversalIdentifier: 'd9eeacaa-2f9e-44cc-b5f6-5e1526256d49',
- operand: ViewFilterOperand.IS_NOT_EMPTY,
- value: '',
- },
- ],
-});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/opportunities-with-partner.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/opportunities-with-partner.view.ts
deleted file mode 100644
index e15e3ca7c33..00000000000
--- a/packages/twenty-apps/internal/twenty-partners/src/views/opportunities-with-partner.view.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-import {
- STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
- ViewFilterOperand,
- ViewSortDirection,
- ViewType,
- defineView,
-} from 'twenty-sdk/define';
-
-import {
- MATCH_STATUS_FIELD_UNIVERSAL_IDENTIFIER,
- OPPORTUNITIES_WITH_PARTNER_VIEW_UNIVERSAL_IDENTIFIER,
-} from 'src/constants/universal-identifiers';
-
-// Opportunities that already have a partner assigned. Same simple column set as the
-// other pipeline views.
-export default defineView({
- universalIdentifier: OPPORTUNITIES_WITH_PARTNER_VIEW_UNIVERSAL_IDENTIFIER,
- name: 'OPP with partner',
- icon: 'IconUserCheck',
- objectUniversalIdentifier:
- STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
- type: ViewType.TABLE,
- position: 1,
- fields: [
- // Name
- { universalIdentifier: 'f29e2d21-f050-4637-b1f2-9418c6768246', fieldMetadataUniversalIdentifier: '20202020-8609-4f65-a2d9-44009eb422b5', position: 0, isVisible: true, size: 200 },
- // Partner
- { universalIdentifier: 'a4beb55d-10f8-4314-9552-9526494447d7', fieldMetadataUniversalIdentifier: 'd9eeacaa-2f9e-44cc-b5f6-5e1526256d49', position: 1, isVisible: true, size: 200 },
- // Amount
- { universalIdentifier: '87e8d97a-0782-48b5-b397-2f9165ecebf0', fieldMetadataUniversalIdentifier: '20202020-583e-4642-8533-db761d5fa82f', position: 2, isVisible: true, size: 140 },
- // Match status
- { universalIdentifier: 'f2a237c1-1300-4648-a4ef-012ffa2996d7', fieldMetadataUniversalIdentifier: MATCH_STATUS_FIELD_UNIVERSAL_IDENTIFIER, position: 3, isVisible: true, size: 200 },
- ],
- // SELECT fields sort by option position, so this orders rows along the match-status
- // pipeline (To Be Matched → … → Won → Lost), not alphabetically.
- sorts: [
- {
- universalIdentifier: '418705f0-435f-4800-83b0-481edfea0933',
- fieldMetadataUniversalIdentifier: MATCH_STATUS_FIELD_UNIVERSAL_IDENTIFIER,
- direction: ViewSortDirection.ASC,
- },
- ],
- filters: [
- {
- universalIdentifier: '3cc1817a-84bb-4eb5-8755-bc72f81b202d',
- fieldMetadataUniversalIdentifier: 'd9eeacaa-2f9e-44cc-b5f6-5e1526256d49',
- operand: ViewFilterOperand.IS_NOT_EMPTY,
- value: '',
- },
- ],
-});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/opportunities-without-partner.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/opportunities-without-partner.view.ts
deleted file mode 100644
index 03de4e10f99..00000000000
--- a/packages/twenty-apps/internal/twenty-partners/src/views/opportunities-without-partner.view.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-import {
- STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
- ViewFilterOperand,
- ViewSortDirection,
- ViewType,
- defineView,
-} from 'twenty-sdk/define';
-
-import {
- MATCH_STATUS_FIELD_UNIVERSAL_IDENTIFIER,
- OPPORTUNITIES_NO_PARTNER_VIEW_UNIVERSAL_IDENTIFIER,
-} from 'src/constants/universal-identifiers';
-
-// Opportunities with no partner assigned yet. Deliberately simple — the matching
-// system will be reworked later, so the pipeline is just split by partner presence.
-export default defineView({
- universalIdentifier: OPPORTUNITIES_NO_PARTNER_VIEW_UNIVERSAL_IDENTIFIER,
- name: 'OPP without partner',
- icon: 'IconUserOff',
- objectUniversalIdentifier:
- STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
- type: ViewType.TABLE,
- position: 0,
- fields: [
- // Name
- { universalIdentifier: '8af65247-8003-4d24-be3d-4b73356045d8', fieldMetadataUniversalIdentifier: '20202020-8609-4f65-a2d9-44009eb422b5', position: 0, isVisible: true, size: 200 },
- // Partner (empty here, kept for a consistent column set across the pipeline)
- { universalIdentifier: '3e89e8f2-6ee2-4258-a07d-3607f6238fd1', fieldMetadataUniversalIdentifier: 'd9eeacaa-2f9e-44cc-b5f6-5e1526256d49', position: 1, isVisible: true, size: 200 },
- // Amount
- { universalIdentifier: 'de63b508-8fc8-4696-8155-3511745db9b6', fieldMetadataUniversalIdentifier: '20202020-583e-4642-8533-db761d5fa82f', position: 2, isVisible: true, size: 140 },
- // Match status
- { universalIdentifier: 'c63c13d2-a332-4982-b50d-707cfa6b54b0', fieldMetadataUniversalIdentifier: MATCH_STATUS_FIELD_UNIVERSAL_IDENTIFIER, position: 3, isVisible: true, size: 200 },
- ],
- // SELECT fields sort by option position, so this orders rows along the match-status
- // pipeline (To Be Matched → … → Won → Lost), not alphabetically.
- sorts: [
- {
- universalIdentifier: '6e6df89a-b614-43dc-8cb4-5746960986b9',
- fieldMetadataUniversalIdentifier: MATCH_STATUS_FIELD_UNIVERSAL_IDENTIFIER,
- direction: ViewSortDirection.ASC,
- },
- ],
- filters: [
- {
- universalIdentifier: 'd8dfd2de-c411-487a-ab9e-7abf81d4e4ef',
- fieldMetadataUniversalIdentifier: 'd9eeacaa-2f9e-44cc-b5f6-5e1526256d49',
- operand: ViewFilterOperand.IS_EMPTY,
- value: '',
- },
- ],
-});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/opportunity-record-page-fields.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/opportunity-record-page-fields.view.ts
new file mode 100644
index 00000000000..92e216b9236
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/opportunity-record-page-fields.view.ts
@@ -0,0 +1,85 @@
+import {
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+ ViewType,
+ defineView,
+} from 'twenty-sdk/define';
+
+import { OPPORTUNITY_IS_LISTED_FIELD_ID } from 'src/fields/opportunity-is-listed.field';
+import { OPPORTUNITY_NEED_FIELD_ID } from 'src/fields/opportunity-need.field';
+import { OPPORTUNITY_REQUIREMENTS_FIELD_ID } from 'src/fields/opportunity-requirements.field';
+import { PARTNER_ON_OPPORTUNITY_FIELD_ID } from 'src/fields/partner-on-opportunity.field';
+import { APPLICATIONS_ON_OPPORTUNITY_FIELD_ID } from 'src/objects/application.object';
+
+const OPPORTUNITY_STAGE_FIELD_ID =
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.fields.stage
+ .universalIdentifier;
+const OPPORTUNITY_AMOUNT_FIELD_ID =
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.fields.amount
+ .universalIdentifier;
+const OPPORTUNITY_CLOSE_DATE_FIELD_ID =
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.fields.closeDate
+ .universalIdentifier;
+
+export const OPPORTUNITY_RECORD_PAGE_FIELDS_VIEW_ID =
+ 'aa8a976c-aca6-4ca1-811e-fc3035e055aa';
+
+// FIELDS_WIDGET view backing the Opportunity record page side panel. Relation fields
+// (partner, applications) only render in the fields widget when an explicit view marks
+// them visible — this is that view.
+export default defineView({
+ universalIdentifier: OPPORTUNITY_RECORD_PAGE_FIELDS_VIEW_ID,
+ name: 'Opportunity Record Page Fields',
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
+ type: ViewType.FIELDS_WIDGET,
+ fields: [
+ {
+ universalIdentifier: '979ac0d4-2db4-48a2-8474-ff8cebd56669',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_STAGE_FIELD_ID,
+ position: 0,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '3c0f8ac5-914d-4840-b124-36f089b49dcc',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_AMOUNT_FIELD_ID,
+ position: 1,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: 'a6ee4ae4-c905-4143-b7af-fffa0ceabf2d',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_CLOSE_DATE_FIELD_ID,
+ position: 2,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '5f8c539e-82df-4db6-af05-d4c4f9b262b1',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_IS_LISTED_FIELD_ID,
+ position: 3,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: 'd44a8293-f9c5-41f6-9e08-85441475a1ce',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_NEED_FIELD_ID,
+ position: 4,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '3a97a3ce-ecfd-417f-8518-120899f1111e',
+ fieldMetadataUniversalIdentifier: OPPORTUNITY_REQUIREMENTS_FIELD_ID,
+ position: 5,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: 'd186d83a-2f6b-4693-b7eb-abc47d110ae8',
+ fieldMetadataUniversalIdentifier: PARTNER_ON_OPPORTUNITY_FIELD_ID,
+ position: 6,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '5c286d5d-c849-4210-ba55-7a2e7dc28ff1',
+ fieldMetadataUniversalIdentifier: APPLICATIONS_ON_OPPORTUNITY_FIELD_ID,
+ position: 7,
+ isVisible: true,
+ },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/partner-applications.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/partner-applications.view.ts
index 4282b659994..4b4cbeb7c68 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/views/partner-applications.view.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/partner-applications.view.ts
@@ -1,56 +1,67 @@
import { ViewFilterOperand, ViewType, defineView } from 'twenty-sdk/define';
-import {
- PARTNER_APPLICATIONS_VIEW_UNIVERSAL_IDENTIFIER,
- PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,
-} from 'src/constants/universal-identifiers';
+import { PARTNER_OBJECT_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { PARTNER_USER_ON_PARTNER_FIELD_ID } from 'src/fields/partner-user-on-partner.field';
-// Early-pipeline partners — grouped by Validation Stage, showing only the
-// Application and Potential partner stages. Later stages are declared as hidden
-// groups so their (empty) sections never render.
+const PARTNER_COUNTRY_FIELD_ID = 'a77d7fa6-c398-47db-af0f-036a5c719f20';
+const PARTNER_INTRODUCTION_FIELD_ID = 'a0000009-0000-4000-8000-000000000009';
+const PARTNER_VALIDATION_STAGE_FIELD_ID =
+ '2ca9856f-f54a-4326-9ff3-668fd7da0b50';
+const PARTNER_CREATED_AT_FIELD_ID = '421cbcea-4608-534b-9a3e-0454bdb3123a';
+
+export const PARTNER_APPLICATIONS_VIEW_UNIVERSAL_IDENTIFIER =
+ '8d8fc77b-77df-4eeb-9e0c-6409efd30a9c';
+
+// Naming: partner onboarding applicants — distinct from the Application object's "Applications" view.
export default defineView({
universalIdentifier: PARTNER_APPLICATIONS_VIEW_UNIVERSAL_IDENTIFIER,
- name: 'Applications',
- icon: 'IconUserPlus',
+ name: 'Partner Applications',
+ icon: 'IconInbox',
objectUniversalIdentifier: PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,
type: ViewType.TABLE,
- position: 0,
- // Group by Validation Stage so the stage becomes the section header — this is
- // why the Validation Stage column is dropped below (it's redundant).
- mainGroupByFieldMetadataUniversalIdentifier: '2ca9856f-f54a-4326-9ff3-668fd7da0b50',
- // Column widths (size): Name + Categories are widened for readability; Skills and
- // Languages get a little extra room since they hold several chips.
+ position: 2,
fields: [
- // Name (label identifier)
- { universalIdentifier: 'b4f505d7-3849-4a74-a27f-1c91733702b5', fieldMetadataUniversalIdentifier: 'a0000001-0000-4000-8000-000000000001', position: 0, isVisible: true, size: 200 },
- // Categories (partnerScope)
- { universalIdentifier: '2aff884c-5212-4ef7-9449-9be48ad1406c', fieldMetadataUniversalIdentifier: '500021ad-ca42-4fd3-8727-392dd26b722a', position: 1, isVisible: true, size: 260 },
- // Skills
- { universalIdentifier: '851017c4-fb46-4574-b912-189b9f229f2e', fieldMetadataUniversalIdentifier: '6f260cc0-a860-41e6-ad40-a2ef32ecffbe', position: 2, isVisible: true, size: 200 },
- // Languages Spoken
- { universalIdentifier: '02f31b03-bdda-4867-9bca-9e3378587120', fieldMetadataUniversalIdentifier: 'a0000007-0000-4000-8000-000000000007', position: 3, isVisible: true, size: 200 },
- // Country
- { universalIdentifier: '2c34a120-b0f8-421b-9546-6483f1202d9f', fieldMetadataUniversalIdentifier: 'a77d7fa6-c398-47db-af0f-036a5c719f20', position: 4, isVisible: true },
- // LinkedIn
- { universalIdentifier: 'bda8c170-a2b2-43d9-8a50-3bd51cccdf57', fieldMetadataUniversalIdentifier: '640bbf33-45d7-4174-a862-dbe611ab8d1a', position: 5, isVisible: true },
- // Type of Team (kept last)
- { universalIdentifier: '1dcf30f4-f7f3-41ce-a1af-f4b1d05eb3d6', fieldMetadataUniversalIdentifier: 'a451e557-a488-470a-8b35-6f9b8cfb1a10', position: 6, isVisible: true },
- ],
- // Application + Potential are visible; later stages are hidden so empty group
- // sections never show.
- groups: [
- { universalIdentifier: '2441704f-c832-4ca4-b4ab-0e4c87102fa9', fieldValue: 'APPLICATION', position: 0, isVisible: true },
- { universalIdentifier: '109b2df2-a3c2-4ed4-b84a-8ca1c846a6ae', fieldValue: 'POTENTIAL', position: 1, isVisible: true },
- { universalIdentifier: 'e8bd3914-84b2-4b2c-a0be-118f36868242', fieldValue: 'VALIDATED', position: 2, isVisible: false },
- { universalIdentifier: 'c5d3f331-11b2-4bc5-9c0d-0a64a5639587', fieldValue: 'FORMER', position: 3, isVisible: false },
- { universalIdentifier: 'e1e5bec5-6d1f-4d0f-9807-5507db3759fc', fieldValue: 'REJECTED', position: 4, isVisible: false },
+ {
+ universalIdentifier: 'cc7286fd-b37a-467a-a21a-47140f910137',
+ fieldMetadataUniversalIdentifier: 'a0000001-0000-4000-8000-000000000001',
+ position: 0,
+ isVisible: true,
+ size: 200,
+ },
+ {
+ universalIdentifier: 'c145da29-b040-4070-a726-562460b315c3',
+ fieldMetadataUniversalIdentifier: PARTNER_COUNTRY_FIELD_ID,
+ position: 1,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '2d198c8a-0199-4b9f-ae07-255172ab6e7e',
+ fieldMetadataUniversalIdentifier: PARTNER_INTRODUCTION_FIELD_ID,
+ position: 2,
+ isVisible: true,
+ size: 280,
+ },
+ {
+ universalIdentifier: '835c9a7e-72ec-46c5-8d90-39a02998f561',
+ fieldMetadataUniversalIdentifier: PARTNER_CREATED_AT_FIELD_ID,
+ position: 3,
+ isVisible: true,
+ size: 180,
+ },
+ {
+ universalIdentifier: '0175e169-377c-4ff5-b0f0-c3359cac48d9',
+ fieldMetadataUniversalIdentifier: PARTNER_USER_ON_PARTNER_FIELD_ID,
+ position: 4,
+ isVisible: true,
+ size: 200,
+ },
],
filters: [
{
- universalIdentifier: '210deb57-cfca-4086-b9da-ca346fbd3126',
- fieldMetadataUniversalIdentifier: '2ca9856f-f54a-4326-9ff3-668fd7da0b50',
+ universalIdentifier: 'a1ef0bcd-6f2c-44fc-ab3d-11df2523a952',
+ fieldMetadataUniversalIdentifier: PARTNER_VALIDATION_STAGE_FIELD_ID,
operand: ViewFilterOperand.IS,
- value: ['APPLICATION', 'POTENTIAL'],
+ value: ['APPLICATION'],
},
],
});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/partner-record-page-fields.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/partner-record-page-fields.view.ts
new file mode 100644
index 00000000000..f5933948349
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/partner-record-page-fields.view.ts
@@ -0,0 +1,69 @@
+import { ViewType, defineView } from 'twenty-sdk/define';
+
+import { PARTNER_OBJECT_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { PARTNER_COMPANY_FIELD_ID } from 'src/fields/partner-company.field';
+import { PARTNER_USER_ON_PARTNER_FIELD_ID } from 'src/fields/partner-user-on-partner.field';
+
+const PARTNER_NAME_FIELD_ID = 'a0000001-0000-4000-8000-000000000001';
+const PARTNER_VALIDATION_STAGE_FIELD_ID =
+ '2ca9856f-f54a-4326-9ff3-668fd7da0b50';
+const PARTNER_AVAILABILITY_FIELD_ID = 'a0000004-0000-4000-8000-000000000004';
+const PARTNER_REGION_FIELD_ID = '560503de-6330-4c1d-af97-a8dee125f2ad';
+const PARTNER_TIER_FIELD_ID = 'd4fa6461-37b6-49ee-9181-dd482e74a70b';
+
+export const PARTNER_RECORD_PAGE_FIELDS_VIEW_ID =
+ 'a10bf4de-0770-4bee-ae04-1ae97aa18254';
+
+// FIELDS_WIDGET view backing the Partner record page side panel. Relation fields
+// (partnerUser) only render in the fields widget when an explicit view marks them
+// visible — this is that view.
+export default defineView({
+ universalIdentifier: PARTNER_RECORD_PAGE_FIELDS_VIEW_ID,
+ name: 'Partner Record Page Fields',
+ objectUniversalIdentifier: PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,
+ type: ViewType.FIELDS_WIDGET,
+ fields: [
+ {
+ universalIdentifier: '1077c424-bbb4-44cd-afec-7170d961574e',
+ fieldMetadataUniversalIdentifier: PARTNER_NAME_FIELD_ID,
+ position: 0,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '3487e2ae-0feb-41c4-ad0c-f94dff435015',
+ fieldMetadataUniversalIdentifier: PARTNER_VALIDATION_STAGE_FIELD_ID,
+ position: 1,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: 'd61ac88b-139a-417d-8767-1db77a44d1a5',
+ fieldMetadataUniversalIdentifier: PARTNER_AVAILABILITY_FIELD_ID,
+ position: 2,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: 'a85dc9bc-a5f5-446e-a36c-492f1b6c0035',
+ fieldMetadataUniversalIdentifier: PARTNER_REGION_FIELD_ID,
+ position: 3,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '971c79e6-381e-4346-86a4-7119de4824be',
+ fieldMetadataUniversalIdentifier: PARTNER_TIER_FIELD_ID,
+ position: 4,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: 'ec1148d4-01ff-4128-9863-0ac42ea8eb47',
+ fieldMetadataUniversalIdentifier: PARTNER_USER_ON_PARTNER_FIELD_ID,
+ position: 5,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '3ec293a1-da90-4104-a22e-771c0059e9b5',
+ fieldMetadataUniversalIdentifier: PARTNER_COMPANY_FIELD_ID,
+ position: 6,
+ isVisible: true,
+ },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/partners-per-country.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/partners-per-country.view.ts
new file mode 100644
index 00000000000..df8f8d87b01
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/partners-per-country.view.ts
@@ -0,0 +1,67 @@
+import {
+ AggregateOperations,
+ ViewSortDirection,
+ ViewType,
+ defineView,
+} from 'twenty-sdk/define';
+
+import { PARTNER_COUNTRY_VIEW_GROUPS } from 'src/constants/partner-country-view-groups';
+import { PARTNER_OBJECT_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+
+const PARTNER_COUNTRY_FIELD_ID = 'a77d7fa6-c398-47db-af0f-036a5c719f20';
+const PARTNER_REGION_FIELD_ID = '560503de-6330-4c1d-af97-a8dee125f2ad';
+const PARTNER_VALIDATION_STAGE_FIELD_ID =
+ '2ca9856f-f54a-4326-9ff3-668fd7da0b50';
+
+export const PARTNERS_PER_COUNTRY_VIEW_UNIVERSAL_IDENTIFIER =
+ '35ef1b2f-f501-459e-a0e8-2f3d071f002d';
+
+export default defineView({
+ universalIdentifier: PARTNERS_PER_COUNTRY_VIEW_UNIVERSAL_IDENTIFIER,
+ name: 'Partners per Country',
+ icon: 'IconMap',
+ objectUniversalIdentifier: PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,
+ type: ViewType.TABLE,
+ position: 1,
+ mainGroupByFieldMetadataUniversalIdentifier: PARTNER_COUNTRY_FIELD_ID,
+ kanbanAggregateOperation: AggregateOperations.COUNT,
+ kanbanAggregateOperationFieldMetadataUniversalIdentifier:
+ 'a0000001-0000-4000-8000-000000000001',
+ shouldHideEmptyGroups: true,
+ groups: [...PARTNER_COUNTRY_VIEW_GROUPS],
+ fields: [
+ {
+ universalIdentifier: '7ba5125f-57ec-41c6-813e-d8d8e59cfe94',
+ fieldMetadataUniversalIdentifier: 'a0000001-0000-4000-8000-000000000001',
+ position: 0,
+ isVisible: true,
+ size: 200,
+ },
+ {
+ universalIdentifier: '938649bf-bfd5-4a97-a318-e76dbcc217bc',
+ fieldMetadataUniversalIdentifier: PARTNER_COUNTRY_FIELD_ID,
+ position: 1,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '11680e09-fc3f-46fd-a36a-dc84afc2d0f6',
+ fieldMetadataUniversalIdentifier: PARTNER_REGION_FIELD_ID,
+ position: 2,
+ isVisible: true,
+ size: 200,
+ },
+ {
+ universalIdentifier: '006255c0-aa2c-4228-b55f-9807b91d9bc1',
+ fieldMetadataUniversalIdentifier: PARTNER_VALIDATION_STAGE_FIELD_ID,
+ position: 3,
+ isVisible: true,
+ },
+ ],
+ sorts: [
+ {
+ universalIdentifier: 'b4ba64d8-6279-49a2-a137-3b1e4f710a82',
+ fieldMetadataUniversalIdentifier: PARTNER_COUNTRY_FIELD_ID,
+ direction: ViewSortDirection.ASC,
+ },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/partners-per-stage.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/partners-per-stage.view.ts
new file mode 100644
index 00000000000..f7e61f8f367
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/partners-per-stage.view.ts
@@ -0,0 +1,83 @@
+import { AggregateOperations, ViewType, defineView } from 'twenty-sdk/define';
+
+import { PARTNER_OBJECT_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+
+const PARTNER_VALIDATION_STAGE_FIELD_ID =
+ '2ca9856f-f54a-4326-9ff3-668fd7da0b50';
+const PARTNER_TIER_FIELD_ID = 'd4fa6461-37b6-49ee-9181-dd482e74a70b';
+const PARTNER_AVAILABILITY_FIELD_ID = 'a0000004-0000-4000-8000-000000000004';
+
+export const PARTNERS_PER_STAGE_VIEW_UNIVERSAL_IDENTIFIER =
+ '6aee3d5a-563b-4106-8837-5b4b1d67f472';
+
+export default defineView({
+ universalIdentifier: PARTNERS_PER_STAGE_VIEW_UNIVERSAL_IDENTIFIER,
+ name: 'Partners per Stage',
+ icon: 'IconColumns',
+ objectUniversalIdentifier: PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,
+ type: ViewType.KANBAN,
+ position: 0,
+ mainGroupByFieldMetadataUniversalIdentifier: PARTNER_VALIDATION_STAGE_FIELD_ID,
+ kanbanAggregateOperation: AggregateOperations.COUNT,
+ kanbanAggregateOperationFieldMetadataUniversalIdentifier:
+ 'a0000001-0000-4000-8000-000000000001',
+ groups: [
+ {
+ universalIdentifier: '24298244-4ce6-435d-91a4-d32d3f2fa6ef',
+ fieldValue: 'APPLICATION',
+ position: 0,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: 'ab1dad6a-d540-4717-8817-9929cce5c4d7',
+ fieldValue: 'POTENTIAL',
+ position: 1,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: 'df9c9696-fd2a-4d58-a335-10b7596e12ba',
+ fieldValue: 'VALIDATED',
+ position: 2,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '3a23f780-08d9-4930-87a0-a01eefe4f85f',
+ fieldValue: 'FORMER',
+ position: 3,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '50d725e5-56ce-4769-8487-05fedd9bf8bb',
+ fieldValue: 'REJECTED',
+ position: 4,
+ isVisible: true,
+ },
+ ],
+ fields: [
+ {
+ universalIdentifier: 'c26f881e-f5db-4c8d-ab2a-f69b7e452459',
+ fieldMetadataUniversalIdentifier: 'a0000001-0000-4000-8000-000000000001',
+ position: 0,
+ isVisible: true,
+ size: 200,
+ },
+ {
+ universalIdentifier: 'ce5dcced-f090-4d57-a6d9-0de0cfd08e23',
+ fieldMetadataUniversalIdentifier: PARTNER_TIER_FIELD_ID,
+ position: 1,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '3719349b-e428-470e-a5c0-5f32e9a5e9f2',
+ fieldMetadataUniversalIdentifier: PARTNER_AVAILABILITY_FIELD_ID,
+ position: 2,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: 'f748f9a4-bfc4-42da-ae08-8c8e1412bdbf',
+ fieldMetadataUniversalIdentifier: PARTNER_VALIDATION_STAGE_FIELD_ID,
+ position: 3,
+ isVisible: false,
+ },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/partners-validated.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/partners-validated.view.ts
new file mode 100644
index 00000000000..d6bad0051db
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/views/partners-validated.view.ts
@@ -0,0 +1,65 @@
+import { ViewFilterOperand, ViewType, defineView } from 'twenty-sdk/define';
+
+import { PARTNER_OBJECT_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { PARTNER_USER_ON_PARTNER_FIELD_ID } from 'src/fields/partner-user-on-partner.field';
+
+const PARTNER_TIER_FIELD_ID = 'd4fa6461-37b6-49ee-9181-dd482e74a70b';
+const PARTNER_AVAILABILITY_FIELD_ID = 'a0000004-0000-4000-8000-000000000004';
+const PARTNER_REGION_FIELD_ID = '560503de-6330-4c1d-af97-a8dee125f2ad';
+const PARTNER_VALIDATION_STAGE_FIELD_ID =
+ '2ca9856f-f54a-4326-9ff3-668fd7da0b50';
+
+export const PARTNERS_VALIDATED_VIEW_UNIVERSAL_IDENTIFIER =
+ '7b1a201d-eaf4-4239-9c56-4f988ae1181a';
+
+export default defineView({
+ universalIdentifier: PARTNERS_VALIDATED_VIEW_UNIVERSAL_IDENTIFIER,
+ name: 'Partners Validated',
+ icon: 'IconCircleCheck',
+ objectUniversalIdentifier: PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,
+ type: ViewType.TABLE,
+ position: 3,
+ fields: [
+ {
+ universalIdentifier: 'dfc446e3-aab2-45e7-8e14-5bf3d9c22b92',
+ fieldMetadataUniversalIdentifier: 'a0000001-0000-4000-8000-000000000001',
+ position: 0,
+ isVisible: true,
+ size: 200,
+ },
+ {
+ universalIdentifier: 'e41daafb-d157-4730-ae5d-a0305ac12e0e',
+ fieldMetadataUniversalIdentifier: PARTNER_TIER_FIELD_ID,
+ position: 1,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '60ab0089-7353-4b34-b1d1-747c1e817267',
+ fieldMetadataUniversalIdentifier: PARTNER_AVAILABILITY_FIELD_ID,
+ position: 2,
+ isVisible: true,
+ },
+ {
+ universalIdentifier: '0173bc1a-4884-4b58-b12d-77afa1fb1fe1',
+ fieldMetadataUniversalIdentifier: PARTNER_REGION_FIELD_ID,
+ position: 3,
+ isVisible: true,
+ size: 200,
+ },
+ {
+ universalIdentifier: '866578d7-8a53-4276-bda0-16e657102392',
+ fieldMetadataUniversalIdentifier: PARTNER_USER_ON_PARTNER_FIELD_ID,
+ position: 4,
+ isVisible: true,
+ size: 200,
+ },
+ ],
+ filters: [
+ {
+ universalIdentifier: 'da4ad9b9-57b6-4784-a68b-56426dee3761',
+ fieldMetadataUniversalIdentifier: PARTNER_VALIDATION_STAGE_FIELD_ID,
+ operand: ViewFilterOperand.IS,
+ value: ['VALIDATED'],
+ },
+ ],
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/views/validated-partners.view.ts b/packages/twenty-apps/internal/twenty-partners/src/views/validated-partners.view.ts
deleted file mode 100644
index 7f14fd78d95..00000000000
--- a/packages/twenty-apps/internal/twenty-partners/src/views/validated-partners.view.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-import { ViewFilterOperand, ViewType, defineView } from 'twenty-sdk/define';
-
-import {
- PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,
- VALIDATED_PARTNERS_VIEW_UNIVERSAL_IDENTIFIER,
-} from 'src/constants/universal-identifiers';
-import { PARTNER_USER_ON_PARTNER_FIELD_ID } from 'src/fields/partner-user-on-partner.field';
-
-// Validated partners — serves both partner intros and the public website list.
-// Columns mirror the Applications view (for consistent reading) plus Partner Tier;
-// Availability is dropped as a column because the view is grouped by it.
-export default defineView({
- universalIdentifier: VALIDATED_PARTNERS_VIEW_UNIVERSAL_IDENTIFIER,
- name: 'Validated',
- icon: 'IconCircleCheck',
- objectUniversalIdentifier: PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,
- type: ViewType.TABLE,
- position: 1,
- // Group by Availability so unavailable partners are immediately visible as
- // their own section (hence no Availability column below).
- mainGroupByFieldMetadataUniversalIdentifier: 'a0000004-0000-4000-8000-000000000004',
- groups: [
- { universalIdentifier: '1e23a5c8-a46d-4738-a610-d5a37ba64d08', fieldValue: 'AVAILABLE', position: 0, isVisible: true },
- { universalIdentifier: '656bf55a-9762-410d-bd4f-cf50ee9d810b', fieldValue: 'UNAVAILABLE', position: 1, isVisible: true },
- ],
- // Same column set/widths as Applications, plus Partner Tier right after Name.
- fields: [
- // Name (label identifier)
- { universalIdentifier: '9463bf58-69d5-4309-bc6e-4835df346246', fieldMetadataUniversalIdentifier: 'a0000001-0000-4000-8000-000000000001', position: 0, isVisible: true, size: 200 },
- // Categories (partnerScope)
- { universalIdentifier: '9cb93542-2a91-4e75-a9f8-4a1866445322', fieldMetadataUniversalIdentifier: '500021ad-ca42-4fd3-8727-392dd26b722a', position: 1, isVisible: true, size: 260 },
- // Skills
- { universalIdentifier: '73022579-b4b1-4e0e-87f8-fee2cc5ff1a1', fieldMetadataUniversalIdentifier: '6f260cc0-a860-41e6-ad40-a2ef32ecffbe', position: 2, isVisible: true, size: 200 },
- // Partner Tier (after Skills)
- { universalIdentifier: 'c8fd88c5-ffa9-4944-b5b9-deec3acd3dff', fieldMetadataUniversalIdentifier: 'd4fa6461-37b6-49ee-9181-dd482e74a70b', position: 3, isVisible: true },
- // Languages Spoken
- { universalIdentifier: '6a7d6b14-9216-42af-bbd9-89bd185fd492', fieldMetadataUniversalIdentifier: 'a0000007-0000-4000-8000-000000000007', position: 4, isVisible: true, size: 200 },
- // Country
- { universalIdentifier: '75d5dad8-259f-4911-9607-06f247410329', fieldMetadataUniversalIdentifier: 'a77d7fa6-c398-47db-af0f-036a5c719f20', position: 5, isVisible: true },
- // LinkedIn
- { universalIdentifier: '72390fd5-b148-4074-b41d-c64bc28097a6', fieldMetadataUniversalIdentifier: '640bbf33-45d7-4174-a862-dbe611ab8d1a', position: 6, isVisible: true },
- // Type of Team
- { universalIdentifier: '300ea008-d311-4375-b8eb-74e8731c52cc', fieldMetadataUniversalIdentifier: 'a451e557-a488-470a-8b35-6f9b8cfb1a10', position: 7, isVisible: true },
- // partnerUser: the login member this partner signs in as (set inline here, like setting an owner).
- { universalIdentifier: '9e06eeaa-649d-412a-aacd-0f8bf7ee69c3', fieldMetadataUniversalIdentifier: PARTNER_USER_ON_PARTNER_FIELD_ID, position: 8, isVisible: true },
- ],
- filters: [
- {
- universalIdentifier: 'a3b7e215-693d-420c-b444-37d4109ca535',
- fieldMetadataUniversalIdentifier: '2ca9856f-f54a-4326-9ff3-668fd7da0b50',
- operand: ViewFilterOperand.IS,
- value: ['VALIDATED'],
- },
- ],
-});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/workflows/README.md b/packages/twenty-apps/internal/twenty-partners/src/workflows/README.md
new file mode 100644
index 00000000000..55d1e8464eb
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/workflows/README.md
@@ -0,0 +1,89 @@
+# Manual workflows runbook
+
+The Twenty Partners app relies on two **manual-trigger workflows** built in the Twenty
+workspace UI. The SDK has no `defineWorkflow`, so these are documented setup steps — not
+shipped in the app manifest.
+
+**Rebuild both workflows in every workspace** where the app is installed (local bundles,
+staging, prod). After `yarn twenty install`, prod is empty until an admin follows this
+runbook.
+
+## Prerequisites
+
+- Twenty Partners app installed and synced (`yarn twenty dev --once` or `install`).
+- **Partner role** already grants the **WORKFLOWS** permission flag (shipped in the app).
+ Partners need this to see **Run workflow → Apply** on a brief. Admins run **Mark as
+ Winner** with their own role (no special flag beyond workflow access).
+
+---
+
+## 1. Apply to Brief
+
+Partner self-apply on an **Opportunity** (brief). Creates an **Application** and lets
+`on-application-created` resolve the Partner from the clicking member.
+
+### Build (Settings → Workflows)
+
+1. Open **Workflows** (sidebar or Settings) and click **+ New workflow**.
+2. Name it **Apply to Brief** (the published label can be shortened to **Apply**).
+3. Open the trigger node (**Manual trigger**).
+4. Set **Availability** to **Single record**.
+5. Choose object **Opportunity**.
+6. Add an action: **Create Record**.
+7. Set **Object** to **Application**.
+8. Map fields:
+ - **Opportunity** → `{{trigger.record.id}}`
+ - **State** → `APPLIED`
+ - **Partner User** → `{{trigger.workspaceMember}}` *(see note below)*
+9. **Publish** (activate) the workflow version.
+
+**Partner User note:** `on-application-created` resolves the Partner from
+`createdBy.workspaceMemberId` on the new Application. Manual workflows run as the
+clicking user, so **Create Record** sets `createdBy` to that member automatically. At
+build time, confirm whether **Partner User** is still required — if `createdBy` is
+populated on the new record, you can omit **Partner User** and rely on the logic
+function alone.
+
+### Expected UI (partner)
+
+On an **Opportunity** record (e.g. from **Open Briefs**), command menu → **Run workflow
+→ Apply**.
+
+---
+
+## 2. Mark as Winner
+
+Admin assigns the winning partner on the linked **Opportunity**. Fires
+`on-opportunity-partner-won`, which cascades Application states to **WON** / **BACKUP**.
+
+### Build (Settings → Workflows)
+
+1. **+ New workflow** → name **Mark as Winner**.
+2. Open the trigger (**Manual trigger**).
+3. Set **Availability** to **Single record**.
+4. Choose object **Application**.
+5. Add an action: **Update Record**.
+6. Configure the action:
+ - **Object** → **Opportunity**
+ - **Record ID** → `{{trigger.record.opportunity.id}}`
+ - **Fields to update** → select **Partner**
+ - **Partner** value → `{{trigger.record.partner.id}}`
+7. **Publish** the workflow version.
+
+### Expected UI (admin)
+
+On an **Application** record, command menu → **Run workflow → Mark as Winner**.
+
+---
+
+## Per-workspace checklist
+
+| Step | Apply to Brief | Mark as Winner |
+| --- | --- | --- |
+| Trigger | Manual, single **Opportunity** | Manual, single **Application** |
+| Action | Create **Application** | Update linked **Opportunity** |
+| Published label | **Apply** (on brief) | **Mark as Winner** (on application) |
+| Who runs it | Partner (WORKFLOWS flag) | Admin / Partner Ops |
+
+Repeat for each workspace after install. Workflows are workspace metadata — they do not
+travel with `deploy` / `install`.
diff --git a/packages/twenty-apps/internal/twenty-partners/tsconfig.json b/packages/twenty-apps/internal/twenty-partners/tsconfig.json
index f71645f97ac..eed679b9bc3 100644
--- a/packages/twenty-apps/internal/twenty-partners/tsconfig.json
+++ b/packages/twenty-apps/internal/twenty-partners/tsconfig.json
@@ -30,6 +30,7 @@
"exclude": [
"node_modules",
"dist",
+ "**/*.config.ts",
"**/*.test.ts",
"**/*.spec.ts",
"**/*.integration-test.ts"