Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
chore: remove organization service (#1224)
Will Hutchinson13f71bbf4d0f
diff --git a/.env-local.enc b/.env-local.encindex 1181135d3d..ea40b84629 100644--- a/.env-local.enc+++ b/.env-local.enc@@ -81,7 +81,6 @@ OPENSEARCH_PASSWORD=ENC[AES256_GCM,data:utp3ZNqwJtSb+M3F1tnc09FY/Beo4iHbmj/oUupsOPENSEARCH_URL=ENC[AES256_GCM,data:ao9SZZPp3ftAH22Pv+eMWP90is8hD67D3N5YizJoe1RhPaoCWgKQl0yDAwnybsIypXW4+aGb30RtUFIGDeX47zeGWOaMPkKbdiam6kp1QqY+5N2EN5s67PeXAQ==,iv:Y/eylw4I7NQkSftmq0HRwTEr0yES1GNApOwADtif1ps=,tag:utQon777HGgWzilMHUYwzA==,type:str]OPENSEARCH_USERNAME=ENC[AES256_GCM,data:z29WFf9prHdvM6U=,iv:R3PvJ2MINDnc1F/Au41FZDNBtKtBXheLxrmgwFIzNHQ=,tag:KmE0RAQ+k731elN2zDY6ng==,type:str]OPEN_ROUTER_API_KEY=ENC[AES256_GCM,data:D33gc0FJcrP3/zm/PKCiWpYqbNW0fCqRliFyeUimf1IsB1giWSe+/X+xWT4oMxX4A+CH3viedtTm6tD0bocEH64qQAf+BkcZMAa8,iv:+z2iPxzVxRxM6TqnKva1jgb0zWXe+XYPz89ZQcGgOZU=,tag:56I/6S8DY/Qz42krF3toBQ==,type:str]-ORGANIZATION_SERVICE_URL=ENC[AES256_GCM,data:4kD7WqhGe5PlBW2abshKHr87nIdZc/vuw23DUbiRDlABnw==,iv:gSQkpJH7wwYH/mH+CINpJ10Ma+ayFV5S8HyUbWzKa8k=,tag:wu/jZwByNjSkt0kubQIDiQ==,type:str]PERPLEXITY_API_KEY=ENC[AES256_GCM,data:30QzR6XG7btJ4RSLYr8F7luvJagn6oC6EnKihWjgNtYiZQpIFqLN2Tbyb9U4C8H1ggKAsrHuOA==,iv:GQ1SCdVWWFVfoYDYvzpLsKs9x2qBwrUpmhFVb4d3Wd4=,tag:9D1U29qzjcw0HFWGvmgumw==,type:str]PORT=ENC[AES256_GCM,data:VDpgDZVd,iv:VwfRGqAC92nUsrdqYlmc3YpsCJyMjwFquZGemuWQEVM=,tag:yHKZuDL5jo7wwCELzD0VRg==,type:str]PROPERTIES_SERVICE_URL=ENC[AES256_GCM,data:zlYrSy0/Gud+pQQNk7tOfrSM70vObvNDOmhmil03Nec=,iv:nCDL23oS6hUFybYos7ROgiu2IcirFd/gK7U1GLVgjwY=,tag:OIHBaveUbuPlstues4lYvQ==,type:str]@@ -127,7 +126,7 @@ sops_kms__list_1__map_arn=arn:aws:kms:us-west-1:569036502058:key/mrk-cab29bf9480sops_kms__list_1__map_aws_profile=sops_kms__list_1__map_created_at=2026-01-23T20:29:10Zsops_kms__list_1__map_enc=AQICAHjuYcSMsjB0lKJtZ3DIAvxF8N3RNRn5KZaAN74Et6122wGRPlpTPmF93uacbjyH/XQPAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMMnW9e8xSFMkqg4HHAgEQgDuUXAj5MhZkV1I2LmwvRJMg8/QQVC67RKtcCMp1Me82cU4uJS2hOosKL5h4qNtBr4NI7WwAJiyWmoxJvQ==-sops_lastmodified=2026-01-26T20:06:06Z-sops_mac=ENC[AES256_GCM,data:W0WGWe6DI0zEX5/8C9oIaD23gPTEYVfnGWRaYQxINT2GHR/Qys+H2Q6gO6rUCqGXUUpIP70syT+KtqAtljD+Os0LMgJUhN0dFwJiUqRvipOa1V1p9k5HrUE2iKniGw18B9vMVvoEuwAM/iBdyWIri/1KoD12PBcjcrG9VOJIWYE=,iv:J84hZggmyY+yjz7BqFvpcv9psl2xIU5o4kRvWd6uQNE=,tag:+f2wBRkeip83jjPnLIw0VQ==,type:str]+sops_lastmodified=2026-01-28T15:47:53Z+sops_mac=ENC[AES256_GCM,data:3Ei91g9gXw5lrt0gZZzOc4k0mo7DkACGAmySs+WSlK9EFrhgSjUKAe+MFn4gaigknzqUYp04uCy63Ex+Rmva2fQYQaV0JkYUMI19wodTncR46d5mv1MNLTkpsCU/uapsf0TffPDCGjzCb4izpbxHEPx4bAb0GL1hXF+TAtlfhFA=,iv:A00d0tn+9s66DYxAi5OmHxcthtOBBzSv2MspNjrBk/A=,tag:M2O1EkeOvQH+5DGM2OKxeQ==,type:str]sops_unencrypted_suffix=_unencryptedsops_version=3.11.0diff --git a/.env-localdev.enc b/.env-localdev.encindex 29cf62c01d..8860b5acc5 100644--- a/.env-localdev.enc+++ b/.env-localdev.enc@@ -84,7 +84,6 @@ OPENSEARCH_PASSWORD=ENC[AES256_GCM,data:SGwK5ad9dQpjAfpVknm7oYeao2K30AOtTqAocRipOPENSEARCH_URL=ENC[AES256_GCM,data:Dud/pfCI00M+fu3b2mYou9vh7YEunkMkFZvXYHZQ1ItBNjIOM24PBbNvTCVDcSLOL9xPfpmJUYRJEyJi9/7jU8Zo551ttnb7AiipIttphBU9VBpbV6vjGtmcbw==,iv:X0c/cuyd0aujL0Jw7aK6nsHyrMzyjppWt5OMGDAMJHk=,tag:lcJAsiuXYtSBXGmzyOtUHg==,type:str]OPENSEARCH_USERNAME=ENC[AES256_GCM,data:Fw7dArmxNizdBNw=,iv:GAW2yLafOUbJOa9SNW+W5XLnvZjHEEOjX5TLJnAYgoI=,tag:hHZKzpvnWqwviqQ0ADo7cg==,type:str]OPEN_ROUTER_API_KEY=ENC[AES256_GCM,data:tomm17nkdaSwRveVYK8ZrN+s+JCovWzghU1tEC9I27zExBh4OT7vWdNyS3nkCxKE2AVPdvIqWJIGXPv5W9mvhff1pYTA3PFhYgdD,iv:KYEx9WEiD8Pz4Zp4NOoe0dd5BLBMRsWRXPVBeLr5P0M=,tag:+OJTG7DElIw85oehgsKYYA==,type:str]-ORGANIZATION_SERVICE_URL=ENC[AES256_GCM,data:O+LaJA21SFxJWrNGNKvaZCpSsAO47oCQWdnep2yaqi9FYQ==,iv:g+vLf4Y3xF3gw4opsbCwqvSMb8ALC8zB9e2y3YSAvsc=,tag:XGcMhMOYM3J+cHHUmUqt8A==,type:str]PERPLEXITY_API_KEY=ENC[AES256_GCM,data:zmj2hBDr5eHSlnvd5SD7HG3UW8soGCsP8TyjBDzV8s+6KQc0rrsRMIHCsvsxEZqc267I+fEbSg==,iv:IsMZ6xJjFdRGuCzykdqsVy6NJSzHyfiZ05moNtVzYYE=,tag:AFYJyv6AmGp4nJZLXZ/iWw==,type:str]PORT=ENC[AES256_GCM,data:jfcxlToI,iv:dUk6L365oDidF2OMu9lKOnskUgikSCqP84UZJ0Ktgcw=,tag:kf2KpJQV8jp/8JyLVFGHUg==,type:str]PROPERTIES_SERVICE_URL=ENC[AES256_GCM,data:8j0WmIw6KkpH3VtxkcjUUVbCLyeN4C4l5H6hLQ76qDI=,iv:FFD3n8/RIVbGW/ZVEnnYMDVu+Ggxi77RjxqwIayQwUg=,tag:XAubbZ0bTFRVfMJ9bzozxg==,type:str]@@ -130,7 +129,7 @@ sops_kms__list_1__map_arn=arn:aws:kms:us-west-1:569036502058:key/mrk-cab29bf9480sops_kms__list_1__map_aws_profile=sops_kms__list_1__map_created_at=2026-01-23T18:54:25Zsops_kms__list_1__map_enc=AQICAHjuYcSMsjB0lKJtZ3DIAvxF8N3RNRn5KZaAN74Et6122wEnNCqr/Zq6DZK9TBYR0a/xAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMyZ8H89arx7KZNv2hAgEQgDso7Kg/nL9zBAqO6faK1cbELSa9Fs7QWAVofQuzasPwl+1JOuSwcjOkJqovaClntoErb/1U8ES+rtUBpA==-sops_lastmodified=2026-01-27T18:52:56Z-sops_mac=ENC[AES256_GCM,data:fcPoA4+s4o8TB7pDOUbXlWoOHOptwrVY3WTrHyT30ikQoWmA6M2oXcl/1N9bRvFYPwHMAlDTjMIKOCSVd9leBy/kkmXxFO9mNfCGnx91erNBYQT17KMgllWW1dNX1jClh54CPs6GFIcMNFUpDZ8wPoJiYtNi2nzXQmTlJaJH0zE=,iv:M5DL4bFX9+axvHiA8SVuq+1WXHzgVJS+Y0Edp9xKsOk=,tag:rGSjcncyrr4PwS4fb+i71w==,type:str]+sops_lastmodified=2026-01-28T15:48:03Z+sops_mac=ENC[AES256_GCM,data:9lrIV4mBzqwbFscmPT+uAzxv9S45halmq4hLnd0fikcPCMFtZJ05qYUpTvt1nCnUkw9D/Uqtuhuhd2HL2Cv+S/sN1zxgkAJY/JD/4T+pmKfNaE9fdViZCHBs6mvN+Wr7IabLB7X9J4D19gDZRl4/C8anba5CZiAUrtUZG3kGVrY=,iv:V9cr7PcJ/isdeWnYZC9ilR0Ga1BDBQ+suN1qhaSCmpo=,tag:xCGoTpYapy3boJj5uuxilg==,type:str]sops_unencrypted_suffix=_unencryptedsops_version=3.11.0diff --git a/.github/services-config.json b/.github/services-config.jsonindex 98fdf1a50a..8458d87fa2 100644--- a/.github/services-config.json+++ b/.github/services-config.json@@ -85,12 +85,6 @@],"stack_path": "infra/stacks/notification-service/**"},- "organization-service": {- "source_paths": [- "rust/cloud-storage/organization_service/**"- ],- "stack_path": "infra/stacks/organization-service/**"- },"organization-retention": {"source_paths": ["rust/cloud-storage/organization_retention/**"diff --git a/.github/workflows/deploy-service-generic.yml b/.github/workflows/deploy-service-generic.ymlindex 3275ed5e8c..856ef39d69 100644--- a/.github/workflows/deploy-service-generic.yml+++ b/.github/workflows/deploy-service-generic.yml@@ -26,7 +26,6 @@ on:- lambda-aggregate-frecency- link-sharing- notification-service- - organization-service- organization-retention- properties-service- search-processing-servicediff --git a/docker-compose.yml b/docker-compose.ymlindex cd2e4c5765..049b5da30d 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -240,32 +240,6 @@ services:retries: 3start_period: 10s- # ============================================================================- # organization_service (Port 8090)- # Organization and team management- # ============================================================================- organization_service:- <<: *common-env- build:- context: ./rust/cloud-storage- dockerfile: Dockerfile.dev- target: organization_service- ports:- - "8090:8080"- depends_on:- - redis- - document_storage_service- - authentication_service- networks:- - databases- - services- healthcheck:- test: ["CMD", "curl", "-f", "http://localhost:8080/health"]- interval: 30s- timeout: 10s- retries: 3- start_period: 10s-# ============================================================================# properties_service (Port 8091)# User/document propertiesdiff --git a/js/app/packages/app/component/settings/Organization/ActiveTable/useActiveTable.tsx b/js/app/packages/app/component/settings/Organization/ActiveTable/useActiveTable.tsxindex debdd4e2bf..cbee36a69e 100644--- a/js/app/packages/app/component/settings/Organization/ActiveTable/useActiveTable.tsx+++ b/js/app/packages/app/component/settings/Organization/ActiveTable/useActiveTable.tsx@@ -1,13 +1,8 @@-import { withAnalytics } from '@coparse/analytics';import type { IOrganizationUser } from '@core/user';-import { isErr } from '@core/util/maybeResult';-import { organizationServiceClient } from '@service-organization/client';import { createSingletonRoot } from '@solid-primitives/rootless';-import { createEffect, createMemo } from 'solid-js';+import { createMemo } from 'solid-js';import { createStore } from 'solid-js/store';-const { track, TrackingEvents } = withAnalytics();-const useActiveTable = createSingletonRoot(() => {const [store, setStore] = createStore<{users: Array<IOrganizationUser | null>;@@ -19,105 +14,23 @@ const useActiveTable = createSingletonRoot(() => {pageSize: 10,});- const getUsers = async (limit: number = 10, offset: number = 0) => {- if (store.users.length > 0 && store.users[offset]) return;- const users = await organizationServiceClient.getUsers({ limit, offset });- if (!users || isErr(users)) return;- const [_, data] = users;-- if (store.users.length === 0) {- const nulls = Array.from({- length: data.total - data.users.length,- }).map(() => null);- setStore('users', [...data.users, ...nulls]);- return;- }-- setStore(- 'users',- store.users.map((user, idx) => {- if (idx >= offset && idx < offset + data.users.length) {- return data.users[idx - offset];- }- return user;- })- );+ const getUsers = async (_limit: number = 10, _offset: number = 0) => {+ // Organization service has been removed};const patchUserRole = async (- userId: string,- role: 'owner' | 'member',- cb: Function+ _userId: string,+ _role: 'owner' | 'member',+ _cb: Function) => {- try {- const data = await organizationServiceClient.patchUserRole({- userId,- role,- });- if (isErr(data)) throw new Error('Failed to update user role');- setStore(- 'users',- store.users.map((user) => {- if (user?.id === userId) {- return {- ...user,- is_it_admin: role === 'owner',- };- }- return user;- })- );- track(TrackingEvents.ORGANIZATION.MEMBERS.UPDATE, {- role,- });- cb();- } catch (e) {- console.error(e);- }+ // Organization service has been removed};- const deleteUser = async (userId: string) => {- try {- const data = await organizationServiceClient.deleteUser({ userId });- if (isErr(data)) throw new Error('Failed to delete user');-- setStore(- 'users',- store.users.filter((user) => user?.id !== userId)- );- track(TrackingEvents.ORGANIZATION.MEMBERS.DELETE);- } catch (e) {- console.error(e);- }+ const deleteUser = async (_userId: string) => {+ // Organization service has been removed};- // Fetch and set users- createEffect(() => getUsers(store.pageSize, store.pageIdx * store.pageSize));-- const pageIdxs = createMemo(() => {- const { users, pageSize, pageIdx } = store;- const totalUsers = users.length;- const maxPageIdx = Math.ceil(totalUsers / pageSize) - 1;-- if (maxPageIdx < 3) {- // If there are less than 4 pages, show all- // return Array.from({ length: maxPageIdx }, (_, i) => i);- return [0];- }-- if (pageIdx === 0) {- // If on the first page, show first three pages and the last page- return [0, 1, 2];- }-- if (pageIdx === maxPageIdx) {- // If on the last page, show first page and the last three pages- return [maxPageIdx - 2, maxPageIdx - 1, maxPageIdx];- }-- // If on a middle page, show previous, current, next, and last page- return [pageIdx - 1, pageIdx, pageIdx + 1];- });+ const pageIdxs = createMemo(() => [0]);const userPageSlice = createMemo(() => {return store.users.slice(diff --git a/js/app/packages/app/component/settings/Organization/InactiveTable/useInactiveTable.tsx b/js/app/packages/app/component/settings/Organization/InactiveTable/useInactiveTable.tsxindex 6d1796424f..7ed2af9b71 100644--- a/js/app/packages/app/component/settings/Organization/InactiveTable/useInactiveTable.tsx+++ b/js/app/packages/app/component/settings/Organization/InactiveTable/useInactiveTable.tsx@@ -1,27 +1,12 @@-import { withAnalytics } from '@coparse/analytics';-import { isErr } from '@core/util/maybeResult';-import { organizationServiceClient } from '@service-organization/client';import { createSingletonRoot } from '@solid-primitives/rootless';-import {- createEffect,- createMemo,- createResource,- createSignal,-} from 'solid-js';+import { createMemo, createSignal } from 'solid-js';import { createStore } from 'solid-js/store';-const { track, TrackingEvents } = withAnalytics();-const useInactiveTable = createSingletonRoot(() => {const [email, setEmail] = createSignal('');-- const [message, setMessage] = createSignal('');- const [success, setSuccess] = createSignal(false);- const [loading, setLoading] = createSignal(false);-- const [getInvitedUsers] = createResource(- organizationServiceClient.getInvitedUsers- );+ const [message, _setMessage] = createSignal('');+ const [success, _setSuccess] = createSignal(false);+ const [loading] = createSignal(false);const [store, setStore] = createStore<{users: { email: string }[];@@ -33,18 +18,6 @@ const useInactiveTable = createSingletonRoot(() => {pageSize: 10,});- // Fetch and set invited users- createEffect(() => {- const invitedUsers = getInvitedUsers();- if (!invitedUsers || isErr(invitedUsers)) return;- const [_, data] = invitedUsers;-- setStore(- 'users',- data.invited_users.map((email: string) => ({ email }))- );- });-const showingText = createMemo(() => {const start = store.pageIdx * store.pageSize + 1;const end = Math.min(@@ -54,63 +27,27 @@ const useInactiveTable = createSingletonRoot(() => {return `${start}-${end}`;});- // Clear message after 3 seconds- createEffect(() => {- if (message()) {- const timeout = setTimeout(() => setMessage(''), 3000);- return () => clearTimeout(timeout);- }- });-- // Revoke a user's invite- const revokeUserInvite = async (email: string) => {- try {- const data = await organizationServiceClient.revokeUserInvite({ email });- if (isErr(data)) {- throw new Error('Failed to revoke user invite');- }- setStore('users', (prevUsers) =>- prevUsers.filter((u) => u.email !== email)- );-- // If the last user on the current page is removed, go back a page- if (- store.users.slice(- store.pageIdx * store.pageSize,- (store.pageIdx + 1) * store.pageSize- ).length === 0 &&- store.pageIdx > 0- ) {- setStore('pageIdx', store.pageIdx - 1);- }- track(TrackingEvents.ORGANIZATION.MEMBERS.REVOKE);- } catch (_e) {- console.error('Failed to revoke user invite');- }+ const revokeUserInvite = async (_email: string) => {+ // Organization service has been removed};- // Memoized computation of page indexes for pagination controlsconst pageIdxs = createMemo(() => {const { users, pageSize, pageIdx } = store;const totalUsers = users.length;const maxPageIdx = Math.ceil(totalUsers / pageSize) - 1;if (maxPageIdx < 3) {- // If there are less than 4 pages, show allreturn Array.from({ length: maxPageIdx + 1 }, (_, i) => i);}if (pageIdx === 0) {- // If on the first page, show first three pages and the last pagereturn [0, 1, 2];}if (pageIdx === maxPageIdx) {- // If on the last page, show first page and the last three pagesreturn [maxPageIdx - 2, maxPageIdx - 1, maxPageIdx];}- // If on a middle page, show previous, current, next, and last pagereturn [pageIdx - 1, pageIdx, pageIdx + 1];});@@ -121,38 +58,15 @@ const useInactiveTable = createSingletonRoot(() => {));- // Function to change the current page indexconst changePageIdx = (newPageIdx: number) => {const maxPageIdx = Math.ceil(store.users.length / store.pageSize) - 1;if (newPageIdx < 0 || newPageIdx > maxPageIdx) return;setStore('pageIdx', newPageIdx);};- // Handle form submission to invite a userconst onSubmit = async (e: SubmitEvent) => {e.preventDefault();- if (loading() || !email()) return;-- setLoading(true);- try {- const inviteUser = await organizationServiceClient.inviteUser({- email: email(),- });- if (isErr(inviteUser)) {- // TODO: Retrieve and display the error message from the API- throw new Error('Failed to invite user');- }- setStore('users', (prevUsers) => [...prevUsers, { email: email() }]);- setSuccess(true);- setMessage('An invitation email has been sent.');- setEmail('');- track(TrackingEvents.ORGANIZATION.MEMBERS.INVITE);- } catch (e) {- console.error('Failed to invite user', e);- setSuccess(false);- setMessage(e.message || 'Failed to invite user.');- }- setLoading(false);+ // Organization service has been removed};return {@@ -167,7 +81,6 @@ const useInactiveTable = createSingletonRoot(() => {setEmail,success,message,-userPageSlice,};});diff --git a/js/app/packages/app/component/settings/Organization/OrganizationSettings/useOrganizationSettings.ts b/js/app/packages/app/component/settings/Organization/OrganizationSettings/useOrganizationSettings.tsindex 3c66974c52..364aa65a5a 100644--- a/js/app/packages/app/component/settings/Organization/OrganizationSettings/useOrganizationSettings.ts+++ b/js/app/packages/app/component/settings/Organization/OrganizationSettings/useOrganizationSettings.ts@@ -1,117 +1,35 @@-import { withAnalytics } from '@coparse/analytics';-import { isErr } from '@core/util/maybeResult';-import type { IOrganizationSettings } from '@service-organization/client';-import { organizationServiceClient } from '@service-organization/client';import { createSingletonRoot } from '@solid-primitives/rootless';-import { createEffect, createResource, createSignal } from 'solid-js';+import { createSignal } from 'solid-js';import { createStore } from 'solid-js/store';-const { track, TrackingEvents } = withAnalytics();+interface IOrganizationSettings {+ name: string;+ default_share_permission: string;+ retention_days?: number;+}const useOrganizationSettings = createSingletonRoot(() => {- const [loading, setLoading] = createSignal(true);- const [store, setStore] = createStore<IOrganizationSettings>({+ const [loading] = createSignal(false);+ const [store] = createStore<IOrganizationSettings>({name: '',default_share_permission: 'public',});- const [getOrgSettings] = createResource(- organizationServiceClient.getOrganizationSettings- );-- createEffect(() => {- const orgSettings = getOrgSettings();- if (!orgSettings || isErr(orgSettings)) return;- const [_, data] = orgSettings;- setStore({- ...data,- default_share_permission: data.default_share_permission || 'public',- });- setLoading(false);- });-- // const changePublicAccessLevel = async (e: Event) => {- // const target = e.target as HTMLSelectElement;- // if (!target) return;- // const update = {- // default_share_permission: {- // is_public: store.default_share_permission?.is_public || false,- // public_access_level: target.value as 'owner' | 'edit' | 'view',- // },- // };-- // try {- // const data =- // await organizationServiceClient.patchOrganizationSettings(update);- // if (isErr(data)) {- // throw new Error('Failed to update public access level');- // }- // setStore('default_share_permission', {- // ...store.default_share_permission,- // public_access_level: target.value as 'owner' | 'edit' | 'view',- // });- // track(TrackingEvents.ORGANIZATION.SETTINGS.ACCESSLEVEL, {- // level: target.value,- // });- // } catch (e) {- // console.error(e);- // return;- // }- // };-- const updateRetentionDays = async (days: number) => {- const update = { retention_days: days };-- try {- const data =- await organizationServiceClient.patchOrganizationSettings(update);- if (isErr(data)) {- throw new Error('Failed to update retention days');- }- setStore('retention_days', days);- track(TrackingEvents.ORGANIZATION.SETTINGS.RETENTION, {- days: days,- });- } catch (e) {- console.error(e);- return;- }+ const changeRetentionDays = async (_e: Event) => {+ // Organization service has been removed};- const changeRetentionDays = async (e: Event) => {- const target = e.target as HTMLSelectElement;- if (!target) return;- const days = parseInt(target.value);-- updateRetentionDays(days);+ const updateRetentionDays = async (_days: number) => {+ // Organization service has been removed};const removeRetentionDays = async () => {- const update = {- remove_retention_days: true,- };-- try {- const data =- await organizationServiceClient.patchOrganizationSettings(update);- if (isErr(data)) {- throw new Error('Failed to remove retention days');- }-- setStore('retention_days', undefined);- track(TrackingEvents.ORGANIZATION.SETTINGS.RETENTION, {- days: null,- });- } catch (e) {- console.error(e);- return;- }+ // Organization service has been removed};return {orgSettings: store,loading,- // changePublicAccessLevel,changeRetentionDays,updateRetentionDays,removeRetentionDays,diff --git a/js/app/packages/core/constant/servers.ts b/js/app/packages/core/constant/servers.tsindex a928bb7898..1928153898 100644--- a/js/app/packages/core/constant/servers.ts+++ b/js/app/packages/core/constant/servers.ts@@ -2,7 +2,6 @@ const serverHostLocal: Servers = {'auth-service': 'http://localhost:8080','pdf-service': 'http://localhost:4567','document-storage-service': 'http://localhost:8086',- 'organization-service': 'http://localhost:8090','websocket-service': 'ws://localhost:6969','cognition-service': 'http://localhost:8085','cognition-websocket-service': 'ws://localhost:8085',@@ -26,7 +25,6 @@ const serverHostRemote = {'websocket-service': `wss://services${devServerSuffix}.macro.com`,'cognition-service': `https://document-cognition${devServerSuffix}.macro.com`,'cognition-websocket-service': `wss://document-cognition${devServerSuffix}.macro.com`,- 'organization-service': `https://organization-service${devServerSuffix}.macro.com`,'connection-gateway': `wss://connection-gateway${devServerSuffix}.macro.com`,'comms-service': `https://comms-service${devServerSuffix}.macro.com`,'notification-service': `https://notifications${devServerSuffix}.macro.com`,diff --git a/js/app/packages/core/user/organization.ts b/js/app/packages/core/user/organization.tsindex 74ff67b851..0fe046c87d 100644--- a/js/app/packages/core/user/organization.ts+++ b/js/app/packages/core/user/organization.ts@@ -1,77 +1,9 @@-import { useIsOrganizationMember } from '@core/auth';-import {- type IOrganizationUser,- type IUser,- idToDisplayName,-} from '@core/user';-import { isErr } from '@core/util/maybeResult';+import type { IUser } from '@core/user';import { useOrganizationQuery } from '@queries/auth';-import { organizationServiceClient } from '@service-organization/client';-import { createSingletonRoot } from '@solid-primitives/rootless';-import { createMemo, createResource } from 'solid-js';--const USERS_PER_PAGE = 50;--async function getPaginatedUsers() {- let allUsers: IOrganizationUser[] = [];- const result = await organizationServiceClient.getUsers({- limit: USERS_PER_PAGE,- offset: 0,- });- if (isErr(result)) {- console.error('Failed to get users', result);- return [];- }- const [, data] = result;- let { next_offset: nextOffset, users } = data;-- allUsers = [...allUsers, ...users];-- if (nextOffset === 0) return allUsers;-- while (nextOffset > 0) {- const result = await organizationServiceClient.getUsers({- limit: USERS_PER_PAGE,- offset: nextOffset,- });- if (isErr(result)) {- console.error('Failed to get users', result);- return [];- }- const [, data] = result;- const { next_offset, users } = data;- nextOffset = next_offset;- allUsers = [...allUsers, ...users];- }-- return allUsers;-}--const organizationResource = createSingletonRoot(() =>- createResource(- () => {- const isOrganizationMember = useIsOrganizationMember();- if (!isOrganizationMember()) return [];- return getPaginatedUsers();- },- {- initialValue: [],- }- )-);+import { createMemo } from 'solid-js';export function useOrganizationUsers() {- const [resource] = organizationResource();- return createMemo<IUser[]>(() => {- const result = resource.latest;- const users = result.map((user) => ({- id: user.id,- email: user.email,- name: idToDisplayName(user.id),- }));-- return users;- });+ return createMemo<IUser[]>(() => []);}export function useOrganizationName() {diff --git a/js/app/packages/core/user/types.ts b/js/app/packages/core/user/types.tsindex 3627e3fafa..a674ec95ce 100644--- a/js/app/packages/core/user/types.ts+++ b/js/app/packages/core/user/types.ts@@ -1,9 +1,13 @@-import type { IOrganizationUserInternal } from '@service-organization/client';import type { Accessor } from 'solid-js';export type { ChannelWithParticipants } from '@service-comms/generated/models';export type { ContactInfo } from '@service-email/generated/schemas';-export type IOrganizationUser = IOrganizationUserInternal;++export interface IOrganizationUser {+ email: string;+ id: string;+ is_it_admin: boolean;+}export type IUser = {id: string;diff --git a/js/app/packages/service-clients/service-organization/client.ts b/js/app/packages/service-clients/service-organization/client.tsdeleted file mode 100644index fa0b30bd1a..0000000000--- a/js/app/packages/service-clients/service-organization/client.ts+++ /dev/null@@ -1,192 +0,0 @@-import { SERVER_HOSTS } from '@core/constant/servers';-import {- type FetchWithTokenErrorCode,- fetchWithToken,-} from '@core/util/fetchWithToken';-import {- type MaybeError,- type MaybeResult,- mapOk,- type ObjectLike,-} from '@core/util/maybeResult';-import { registerClient } from '@core/util/mockClient';-import type { SafeFetchInit } from '@core/util/safeFetch';--import type {- IOrganizationSettings,- IOrganizationUserInternal as IOrganizationUser,-} from './models';--export type * from './models';--// Define the organization service host-const orgHost: string = SERVER_HOSTS['organization-service'];--// orgFetch function with overloads to handle different response types-export function orgFetch(- url: string,- init?: SafeFetchInit-): Promise<MaybeError<FetchWithTokenErrorCode>>;-export function orgFetch<T extends ObjectLike>(- url: string,- init?: SafeFetchInit-): Promise<MaybeResult<FetchWithTokenErrorCode, T>>;-export function orgFetch<T extends ObjectLike = never>(- url: string,- init?: SafeFetchInit-):- | Promise<MaybeResult<FetchWithTokenErrorCode, T>>- | Promise<MaybeError<FetchWithTokenErrorCode>> {- return fetchWithToken<T>(`${orgHost}${url}`, init);-}--export type Success = { success: boolean };-type SuccessResponse = { data: Success };--// Organization Service Client Implementation-export const organizationServiceClient = {- /**- * Retrieves all organization users with pagination- */- async getUsers(args: { limit: number; offset: number }) {- const { limit, offset } = args;- return mapOk(- await orgFetch<{- users: IOrganizationUser[];- total: number;- next_offset: number;- }>(`/users?limit=${limit}&offset=${offset}`, {- method: 'GET',- }),- (result) => result- );- },-- /**- * Deletes a user by their ID- */- async deleteUser(args: { userId: string }) {- const { userId } = args;- return mapOk(- await orgFetch<SuccessResponse>('/users', {- method: 'DELETE',- headers: {- 'Content-Type': 'application/json',- },- body: JSON.stringify({- user_id: userId,- }),- }),- (result) => result.data- );- },-- /**- * Updates a user's role within the organization- */- async patchUserRole(args: { userId: string; role: 'owner' | 'member' }) {- const { userId, role } = args;- return orgFetch<SuccessResponse>('/users/role', {- method: 'PATCH',- headers: {- 'Content-Type': 'application/json',- },- body: JSON.stringify({- user_id: userId,- organization_user_role: role,- }),- });- },-- /**- * Invites a new user to the organization via email- */- async inviteUser(args: { email: string }) {- const { email } = args;- return orgFetch<SuccessResponse>('/users/invite', {- method: 'POST',- headers: {- 'Content-Type': 'application/json',- },- body: JSON.stringify({- email,- }),- });- },-- /**- * Retrieves a list of invited users- */- async getInvitedUsers() {- return mapOk(- await orgFetch<{- invited_users: string[];- }>(`/users/invited`, {- method: 'GET',- }),- (result) => result- );- },-- /**- * Revokes an invite for a user by their email- */- async revokeUserInvite(args: { email: string }) {- const { email } = args;- return orgFetch<SuccessResponse>('/users/invite', {- method: 'DELETE',- headers: {- 'Content-Type': 'application/json',- },- body: JSON.stringify({- email,- }),- });- },-- /**- * Retrieves the organization's settings- */- async getOrganizationSettings() {- return mapOk(- await orgFetch<IOrganizationSettings>('/organization/settings', {- method: 'GET',- }),- (result) => result- );- },-- /**- * Updates the organization's settings- */- async patchOrganizationSettings(args: {- retention_days?: number;- remove_default_share_permission?: boolean;- remove_retention_days?: boolean;- }) {- return orgFetch<SuccessResponse>('/organization/settings', {- method: 'PATCH',- headers: {- 'Content-Type': 'application/json',- },- body: JSON.stringify(args),- });- },-- /**- * Updates the organization's share permissions- */- async updateSharePermissions(- share_type: 'public' | 'private' | 'organization'- ) {- return orgFetch<SuccessResponse>(`/organization/share/${share_type}`, {- method: 'PATCH',- headers: {- 'Content-Type': 'application/json',- },- });- },-};--// Register the organization service client-registerClient('organization', organizationServiceClient);diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/accessLevel.ts b/js/app/packages/service-clients/service-organization/generated/schemas/accessLevel.tsdeleted file mode 100644index a9c3ad7a0a..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/accessLevel.ts+++ /dev/null@@ -1,19 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */--/**- * Ordered from least to most access top -> bottom- */-export type AccessLevel = (typeof AccessLevel)[keyof typeof AccessLevel];--// eslint-disable-next-line @typescript-eslint/no-redeclare-export const AccessLevel = {- view: 'view',- comment: 'comment',- edit: 'edit',- owner: 'owner',-} as const;diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/deleteUserRequest.ts b/js/app/packages/service-clients/service-organization/generated/schemas/deleteUserRequest.tsdeleted file mode 100644index b6594d9985..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/deleteUserRequest.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */--export interface DeleteUserRequest {- /** The user id who we are deleting */- user_id: string;-}diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/emptyResponse.ts b/js/app/packages/service-clients/service-organization/generated/schemas/emptyResponse.tsdeleted file mode 100644index 55493c920a..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/emptyResponse.ts+++ /dev/null@@ -1,13 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */--/**- * Empty response is required due to custom fetch forcing `response.json()`- */-export interface EmptyResponse {- [key: string]: unknown;-}diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/getInvitedUsersResponse.ts b/js/app/packages/service-clients/service-organization/generated/schemas/getInvitedUsersResponse.tsdeleted file mode 100644index 99a1351a7c..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/getInvitedUsersResponse.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */--export interface GetInvitedUsersResponse {- /** The invited users in your organization */- invited_users: string[];-}diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/getUsersHandlerParams.ts b/js/app/packages/service-clients/service-organization/generated/schemas/getUsersHandlerParams.tsdeleted file mode 100644index cd095425c9..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/getUsersHandlerParams.ts+++ /dev/null@@ -1,17 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */--export type GetUsersHandlerParams = {- /**- * The maximum number of users to retreive. Default 10, max 100.- */- limit: number;- /**- * The offset to start from. Default 0.- */- offset: number;-};diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/getUsersResponse.ts b/js/app/packages/service-clients/service-organization/generated/schemas/getUsersResponse.tsdeleted file mode 100644index e5ce29724e..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/getUsersResponse.ts+++ /dev/null@@ -1,17 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */-import type { GetUsersResponseNextOffset } from './getUsersResponseNextOffset';-import type { User } from './user';--export interface GetUsersResponse {- /** The next offset to be used if there is one */- next_offset?: GetUsersResponseNextOffset;- /** The total number of documents the user has */- total: number;- /** The users in your organization returned from the query */- users: User[];-}diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/getUsersResponseNextOffset.ts b/js/app/packages/service-clients/service-organization/generated/schemas/getUsersResponseNextOffset.tsdeleted file mode 100644index b365c47b62..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/getUsersResponseNextOffset.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */--/**- * The next offset to be used if there is one- */-export type GetUsersResponseNextOffset = number | null;diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/index.ts b/js/app/packages/service-clients/service-organization/generated/schemas/index.tsdeleted file mode 100644index 8a918a4c11..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/index.ts+++ /dev/null@@ -1,28 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */--export * from './accessLevel';-export * from './deleteUserRequest';-export * from './emptyResponse';-export * from './getInvitedUsersResponse';-export * from './getUsersHandlerParams';-export * from './getUsersResponse';-export * from './getUsersResponseNextOffset';-export * from './inviteUserRequest';-export * from './organizationDefaultSharePermission';-export * from './organizationDefaultSharePermissionOrganizationAccessLevel';-export * from './organizationDefaultSharePermissionPublicAccessLevel';-export * from './organizationSettingsResponse';-export * from './organizationSettingsResponseRetentionDays';-export * from './organizationShareType';-export * from './organizationUserRole';-export * from './patchOrganizationSettingsRequest';-export * from './patchOrganizationSettingsRequestRemoveDefaultSharePermission';-export * from './patchOrganizationSettingsRequestRemoveRetentionDays';-export * from './patchOrganizationSettingsRequestRetentionDays';-export * from './patchUserRoleRequest';-export * from './user';diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/inviteUserRequest.ts b/js/app/packages/service-clients/service-organization/generated/schemas/inviteUserRequest.tsdeleted file mode 100644index 14020b5002..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/inviteUserRequest.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */--export interface InviteUserRequest {- /** The email of the user to invite */- email: string;-}diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/organizationDefaultSharePermission.ts b/js/app/packages/service-clients/service-organization/generated/schemas/organizationDefaultSharePermission.tsdeleted file mode 100644index 02aac94c4f..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/organizationDefaultSharePermission.ts+++ /dev/null@@ -1,17 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */-import type { OrganizationDefaultSharePermissionOrganizationAccessLevel } from './organizationDefaultSharePermissionOrganizationAccessLevel';-import type { OrganizationDefaultSharePermissionPublicAccessLevel } from './organizationDefaultSharePermissionPublicAccessLevel';--export interface OrganizationDefaultSharePermission {- /** If the item is publicly accessible by default */- is_public: boolean;- /** If the item is accessible by organization by default */- organization_access_enabled: boolean;- organization_access_level?: OrganizationDefaultSharePermissionOrganizationAccessLevel;- public_access_level?: OrganizationDefaultSharePermissionPublicAccessLevel;-}diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/organizationDefaultSharePermissionOrganizationAccessLevel.ts b/js/app/packages/service-clients/service-organization/generated/schemas/organizationDefaultSharePermissionOrganizationAccessLevel.tsdeleted file mode 100644index 00bac08b94..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/organizationDefaultSharePermissionOrganizationAccessLevel.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */-import type { AccessLevel } from './accessLevel';--export type OrganizationDefaultSharePermissionOrganizationAccessLevel =- null | AccessLevel;diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/organizationDefaultSharePermissionPublicAccessLevel.ts b/js/app/packages/service-clients/service-organization/generated/schemas/organizationDefaultSharePermissionPublicAccessLevel.tsdeleted file mode 100644index c63aed700c..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/organizationDefaultSharePermissionPublicAccessLevel.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */-import type { AccessLevel } from './accessLevel';--export type OrganizationDefaultSharePermissionPublicAccessLevel =- null | AccessLevel;diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/organizationSettingsResponse.ts b/js/app/packages/service-clients/service-organization/generated/schemas/organizationSettingsResponse.tsdeleted file mode 100644index 7731191f90..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/organizationSettingsResponse.ts+++ /dev/null@@ -1,18 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */--import type { OrganizationSettingsResponseRetentionDays } from './organizationSettingsResponseRetentionDays';-import type { OrganizationShareType } from './organizationShareType';--export interface OrganizationSettingsResponse {- /** The default share permission for the organization */- default_share_permission: OrganizationShareType;- /** The name of the organization */- name: string;- /** The number of days an item can go unopened for before it is automatically deleted */- retention_days?: OrganizationSettingsResponseRetentionDays;-}diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/organizationSettingsResponseRetentionDays.ts b/js/app/packages/service-clients/service-organization/generated/schemas/organizationSettingsResponseRetentionDays.tsdeleted file mode 100644index 84279acdc7..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/organizationSettingsResponseRetentionDays.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */--/**- * The number of days an item can go unopened for before it is automatically deleted- */-export type OrganizationSettingsResponseRetentionDays = number | null;diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/organizationShareType.ts b/js/app/packages/service-clients/service-organization/generated/schemas/organizationShareType.tsdeleted file mode 100644index 2c0759f6be..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/organizationShareType.ts+++ /dev/null@@ -1,16 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */--export type OrganizationShareType =- (typeof OrganizationShareType)[keyof typeof OrganizationShareType];--// eslint-disable-next-line @typescript-eslint/no-redeclare-export const OrganizationShareType = {- public: 'public',- organization: 'organization',- private: 'private',-} as const;diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/organizationUserRole.ts b/js/app/packages/service-clients/service-organization/generated/schemas/organizationUserRole.tsdeleted file mode 100644index 7a6b4246a8..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/organizationUserRole.ts+++ /dev/null@@ -1,15 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */--export type OrganizationUserRole =- (typeof OrganizationUserRole)[keyof typeof OrganizationUserRole];--// eslint-disable-next-line @typescript-eslint/no-redeclare-export const OrganizationUserRole = {- owner: 'owner',- member: 'member',-} as const;diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/patchOrganizationSettingsRequest.ts b/js/app/packages/service-clients/service-organization/generated/schemas/patchOrganizationSettingsRequest.tsdeleted file mode 100644index 6cd6398a72..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/patchOrganizationSettingsRequest.ts+++ /dev/null@@ -1,20 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */-import type { PatchOrganizationSettingsRequestRemoveDefaultSharePermission } from './patchOrganizationSettingsRequestRemoveDefaultSharePermission';-import type { PatchOrganizationSettingsRequestRemoveRetentionDays } from './patchOrganizationSettingsRequestRemoveRetentionDays';-import type { PatchOrganizationSettingsRequestRetentionDays } from './patchOrganizationSettingsRequestRetentionDays';--export interface PatchOrganizationSettingsRequest {- /** Removes the default share permission you currently have set */- remove_default_share_permission?: PatchOrganizationSettingsRequestRemoveDefaultSharePermission;- /** Removes the retention policy you currently have set */- remove_retention_days?: PatchOrganizationSettingsRequestRemoveRetentionDays;- /** The new retention policy you want to set-- Note: This will get ignored if you have pass in **any value** for remove_retention_days */- retention_days?: PatchOrganizationSettingsRequestRetentionDays;-}diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/patchOrganizationSettingsRequestRemoveDefaultSharePermission.ts b/js/app/packages/service-clients/service-organization/generated/schemas/patchOrganizationSettingsRequestRemoveDefaultSharePermission.tsdeleted file mode 100644index 11840e56ef..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/patchOrganizationSettingsRequestRemoveDefaultSharePermission.ts+++ /dev/null@@ -1,13 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */--/**- * Removes the default share permission you currently have set- */-export type PatchOrganizationSettingsRequestRemoveDefaultSharePermission =- | boolean- | null;diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/patchOrganizationSettingsRequestRemoveRetentionDays.ts b/js/app/packages/service-clients/service-organization/generated/schemas/patchOrganizationSettingsRequestRemoveRetentionDays.tsdeleted file mode 100644index 6b9c9f6b3a..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/patchOrganizationSettingsRequestRemoveRetentionDays.ts+++ /dev/null@@ -1,13 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */--/**- * Removes the retention policy you currently have set- */-export type PatchOrganizationSettingsRequestRemoveRetentionDays =- | boolean- | null;diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/patchOrganizationSettingsRequestRetentionDays.ts b/js/app/packages/service-clients/service-organization/generated/schemas/patchOrganizationSettingsRequestRetentionDays.tsdeleted file mode 100644index 645fca87c0..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/patchOrganizationSettingsRequestRetentionDays.ts+++ /dev/null@@ -1,13 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */--/**- * The new retention policy you want to set-- Note: This will get ignored if you have pass in **any value** for remove_retention_days- */-export type PatchOrganizationSettingsRequestRetentionDays = number | null;diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/patchUserRoleRequest.ts b/js/app/packages/service-clients/service-organization/generated/schemas/patchUserRoleRequest.tsdeleted file mode 100644index 79f61be00e..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/patchUserRoleRequest.ts+++ /dev/null@@ -1,14 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */-import type { OrganizationUserRole } from './organizationUserRole';--export interface PatchUserRoleRequest {- /** The new role to give the user */- organization_user_role: OrganizationUserRole;- /** The user id who we are updating the role for */- user_id: string;-}diff --git a/js/app/packages/service-clients/service-organization/generated/schemas/user.ts b/js/app/packages/service-clients/service-organization/generated/schemas/user.tsdeleted file mode 100644index 0fc459388e..0000000000--- a/js/app/packages/service-clients/service-organization/generated/schemas/user.ts+++ /dev/null@@ -1,15 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */--export interface User {- /** The email of the user */- email: string;- /** The id of the user */- id: string;- /** If the user is an it admin or not */- is_it_admin: boolean;-}diff --git a/js/app/packages/service-clients/service-organization/generated/zod.ts b/js/app/packages/service-clients/service-organization/generated/zod.tsdeleted file mode 100644index f7aeb6e779..0000000000--- a/js/app/packages/service-clients/service-organization/generated/zod.ts+++ /dev/null@@ -1,112 +0,0 @@-/**- * Generated by orval v7.13.0 🍺- * Do not edit manually.- * organization_service- * OpenAPI spec version: 0.1.0- */-import { z as zod } from 'zod';--/**- * @summary Gets the organizations settings- */-export const getSettingsHandlerResponse = zod.object({- default_share_permission: zod.enum(['public', 'organization', 'private']),- name: zod.string().describe('The name of the organization'),- retention_days: zod- .number()- .nullish()- .describe(- 'The number of days an item can go unopened for before it is automatically deleted'- ),-});--/**- * @summary Patches the organization settings- */-export const patchOrganizationSettingsHandlerBody = zod.object({- remove_default_share_permission: zod- .boolean()- .nullish()- .describe('Removes the default share permission you currently have set'),- remove_retention_days: zod- .boolean()- .nullish()- .describe('Removes the retention policy you currently have set'),- retention_days: zod- .number()- .nullish()- .describe(- 'The new retention policy you want to set\n\n Note: This will get ignored if you have pass in **any value** for remove_retention_days'- ),-});--/**- * @summary Gets all users currently in your organization- */-export const getUsersHandlerQueryParams = zod.object({- limit: zod- .number()- .describe('The maximum number of users to retreive. Default 10, max 100.'),- offset: zod.number().describe('The offset to start from. Default 0.'),-});--export const getUsersHandlerResponse = zod.object({- next_offset: zod- .number()- .nullish()- .describe('The next offset to be used if there is one'),- total: zod.number().describe('The total number of documents the user has'),- users: zod- .array(- zod.object({- email: zod.string().describe('The email of the user'),- id: zod.string().describe('The id of the user'),- is_it_admin: zod- .boolean()- .describe('If the user is an it admin or not'),- })- )- .describe('The users in your organization returned from the query'),-});--/**- * @summary Deletes the user. This action cannot be undone as it queues the user for deletion.- */-export const deleteUserHandlerBody = zod.object({- user_id: zod.string().describe('The user id who we are deleting'),-});--/**- * @summary Invites a user to an organization- */-export const inviteUserHandlerBody = zod.object({- email: zod.string().describe('The email of the user to invite'),-});--/**- * If the user is `allow_list_only` we will also remove the `OrganizationEmailMatch`- * @summary Removes the users invitation from OrganizationInvitation- */-export const revokeUserInviteHandlerBody = zod.object({- email: zod.string().describe('The email of the user to invite'),-});--/**- * @summary Gets all invited users for your organization- */-export const getInvitedUsersHandlerResponse = zod.object({- invited_users: zod- .array(zod.string())- .describe('The invited users in your organization'),-});--/**- * @summary Patches the requested users role. Updating whether they have organization_it role or-not.- */-export const patchUserRoleHandlerBody = zod.object({- organization_user_role: zod.enum(['owner', 'member']),- user_id: zod- .string()- .describe('The user id who we are updating the role for'),-});diff --git a/js/app/packages/service-clients/service-organization/models/index.ts b/js/app/packages/service-clients/service-organization/models/index.tsdeleted file mode 100644index 75b9ad261e..0000000000--- a/js/app/packages/service-clients/service-organization/models/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export type { OrganizationSettingsResponse as IOrganizationSettings } from '../generated/schemas/organizationSettingsResponse';-export type { User as IOrganizationUserInternal } from '../generated/schemas/user';diff --git a/js/app/packages/service-clients/service-organization/openapi.json b/js/app/packages/service-clients/service-organization/openapi.jsondeleted file mode 100644index f528c91903..0000000000--- a/js/app/packages/service-clients/service-organization/openapi.json+++ /dev/null@@ -1,685 +0,0 @@-{- "openapi": "3.1.0",- "info": {- "title": "organization_service",- "description": "",- "termsOfService": "https://macro.com/terms",- "license": {- "name": ""- },- "version": "0.1.0"- },- "paths": {- "/health": {- "get": {- "tags": ["health"],- "summary": "Health check",- "operationId": "health_handler",- "responses": {- "200": {- "description": "health",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/organization/settings": {- "get": {- "tags": ["organization::get_settings"],- "summary": "Gets the organizations settings",- "operationId": "get_settings_handler",- "responses": {- "200": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/OrganizationSettingsResponse"- }- }- }- },- "400": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- },- "patch": {- "tags": ["organization::patch_organization_settings"],- "summary": "Patches the organization settings",- "operationId": "patch_organization_settings_handler",- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/PatchOrganizationSettingsRequest"- }- }- },- "required": true- },- "responses": {- "200": {- "description": ""- },- "400": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/users": {- "get": {- "tags": ["users::get_users"],- "summary": "Gets all users currently in your organization",- "operationId": "get_users_handler",- "parameters": [- {- "name": "limit",- "in": "query",- "description": "The maximum number of users to retreive. Default 10, max 100.",- "required": true,- "schema": {- "type": "integer",- "format": "int64"- }- },- {- "name": "offset",- "in": "query",- "description": "The offset to start from. Default 0.",- "required": true,- "schema": {- "type": "integer",- "format": "int64"- }- }- ],- "responses": {- "200": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/GetUsersResponse"- }- }- }- },- "400": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- },- "delete": {- "tags": ["users::delete_user"],- "summary": "Deletes the user. This action cannot be undone as it queues the user for deletion.",- "operationId": "delete_user_handler",- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/DeleteUserRequest"- }- }- },- "required": true- },- "responses": {- "200": {- "description": ""- },- "400": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/users/invite": {- "post": {- "tags": ["users::invite_user"],- "summary": "Invites a user to an organization",- "operationId": "invite_user_handler",- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/InviteUserRequest"- }- }- },- "required": true- },- "responses": {- "200": {- "description": ""- },- "400": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- },- "delete": {- "tags": ["users::revoke_user_invite"],- "summary": "Removes the users invitation from OrganizationInvitation",- "description": "If the user is `allow_list_only` we will also remove the `OrganizationEmailMatch`",- "operationId": "revoke_user_invite_handler",- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/InviteUserRequest"- }- }- },- "required": true- },- "responses": {- "200": {- "description": ""- },- "400": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/users/invited": {- "get": {- "tags": ["users::get_invited_users"],- "summary": "Gets all invited users for your organization",- "operationId": "get_invited_users_handler",- "responses": {- "200": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/GetInvitedUsersResponse"- }- }- }- },- "400": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/users/role": {- "patch": {- "tags": ["users::patch_user_role"],- "summary": "Patches the requested users role. Updating whether they have organization_it role or\nnot.",- "operationId": "patch_user_role_handler",- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/PatchUserRoleRequest"- }- }- },- "required": true- },- "responses": {- "200": {- "description": ""- },- "400": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- }- },- "components": {- "schemas": {- "AccessLevel": {- "type": "string",- "description": "Ordered from least to most access top -> bottom",- "enum": ["view", "comment", "edit", "owner"]- },- "DeleteUserRequest": {- "type": "object",- "required": ["user_id"],- "properties": {- "user_id": {- "type": "string",- "description": "The user id who we are deleting"- }- }- },- "EmptyResponse": {- "type": "object",- "description": "Empty response is required due to custom fetch forcing `response.json()`"- },- "GetInvitedUsersResponse": {- "type": "object",- "required": ["invited_users"],- "properties": {- "invited_users": {- "type": "array",- "items": {- "type": "string"- },- "description": "The invited users in your organization"- }- }- },- "GetUsersResponse": {- "type": "object",- "required": ["users", "total"],- "properties": {- "next_offset": {- "type": ["integer", "null"],- "format": "int64",- "description": "The next offset to be used if there is one"- },- "total": {- "type": "integer",- "format": "int64",- "description": "The total number of documents the user has"- },- "users": {- "type": "array",- "items": {- "$ref": "#/components/schemas/User"- },- "description": "The users in your organization returned from the query"- }- }- },- "InviteUserRequest": {- "type": "object",- "required": ["email"],- "properties": {- "email": {- "type": "string",- "description": "The email of the user to invite"- }- }- },- "OrganizationDefaultSharePermission": {- "type": "object",- "required": ["is_public", "organization_access_enabled"],- "properties": {- "is_public": {- "type": "boolean",- "description": "If the item is publicly accessible by default"- },- "organization_access_enabled": {- "type": "boolean",- "description": "If the item is accessible by organization by default"- },- "organization_access_level": {- "oneOf": [- {- "type": "null"- },- {- "$ref": "#/components/schemas/AccessLevel",- "description": "The access level for users if the item is accessible by organization"- }- ]- },- "public_access_level": {- "oneOf": [- {- "type": "null"- },- {- "$ref": "#/components/schemas/AccessLevel",- "description": "The access level for users if the item is publicly accessible"- }- ]- }- }- },- "OrganizationSettingsResponse": {- "type": "object",- "required": ["name", "default_share_permission"],- "properties": {- "default_share_permission": {- "$ref": "#/components/schemas/OrganizationShareType",- "description": "The default share permission for the organization"- },- "name": {- "type": "string",- "description": "The name of the organization"- },- "retention_days": {- "type": ["integer", "null"],- "format": "int32",- "description": "The number of days an item can go unopened for before it is automatically deleted"- }- }- },- "OrganizationShareType": {- "type": "string",- "enum": ["public", "organization", "private"]- },- "OrganizationUserRole": {- "type": "string",- "enum": ["owner", "member"]- },- "PatchOrganizationSettingsRequest": {- "type": "object",- "properties": {- "remove_default_share_permission": {- "type": ["boolean", "null"],- "description": "Removes the default share permission you currently have set"- },- "remove_retention_days": {- "type": ["boolean", "null"],- "description": "Removes the retention policy you currently have set"- },- "retention_days": {- "type": ["integer", "null"],- "format": "int32",- "description": "The new retention policy you want to set\n\n Note: This will get ignored if you have pass in **any value** for remove_retention_days"- }- }- },- "PatchUserRoleRequest": {- "type": "object",- "required": ["user_id", "organization_user_role"],- "properties": {- "organization_user_role": {- "$ref": "#/components/schemas/OrganizationUserRole",- "description": "The new role to give the user"- },- "user_id": {- "type": "string",- "description": "The user id who we are updating the role for"- }- }- },- "User": {- "type": "object",- "required": ["id", "email", "is_it_admin"],- "properties": {- "email": {- "type": "string",- "description": "The email of the user"- },- "id": {- "type": "string",- "description": "The id of the user"- },- "is_it_admin": {- "type": "boolean",- "description": "If the user is an it admin or not"- }- }- }- }- },- "tags": [- {- "name": "macro organization service",- "description": "Organization service"- }- ]-}diff --git a/js/app/scripts/generate-api-schema.ts b/js/app/scripts/generate-api-schema.tsindex 6c260ab449..7b63311188 100644--- a/js/app/scripts/generate-api-schema.ts+++ b/js/app/scripts/generate-api-schema.ts@@ -24,7 +24,6 @@ const serviceToCrate: Record<string, string> = {'email-service': 'email_service','search-service': 'search_service','properties-service': 'properties_service',- 'organization-service': 'organization_service',};const getRustCloudStorageDir = () => path.resolve(import.meta.dirname, '../../../rust/cloud-storage');diff --git a/js/app/scripts/services.ts b/js/app/scripts/services.tsindex 3a143ff599..b0799f54f8 100644--- a/js/app/scripts/services.ts+++ b/js/app/scripts/services.ts@@ -104,14 +104,6 @@ export const services: Service[] = [output: "../packages/service-clients/service-properties/",orvalKey: "propertiesService",},- {- name: "organization-service",- dev: "https://organization-service-dev.macro.com/api-doc/openapi.json",- prod: "https://organization-service.macro.com/api-doc/openapi.json",- local: "http://localhost:8090/api-doc/openapi.json",- output: "../packages/service-clients/service-organization/",- orvalKey: "organization",- }];export const documentCognitionBase: Service = {diff --git a/js/app/tsconfig.json b/js/app/tsconfig.jsonindex 0de400168c..d857c7c87b 100644--- a/js/app/tsconfig.json+++ b/js/app/tsconfig.json@@ -91,9 +91,6 @@"@service-cognition/*": ["./packages/service-clients/service-cognition/*"],- "@service-organization/*": [- "./packages/service-clients/service-organization/*"- ],"@service-connection/*": ["./packages/service-clients/service-connection/*"],diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lockindex cec76b6e76..603266cbac 100644--- a/rust/cloud-storage/Cargo.lock+++ b/rust/cloud-storage/Cargo.lock@@ -6193,54 +6193,6 @@ dependencies = ["tracing",]-[[package]]-name = "organization_service"-version = "0.1.0"-dependencies = [- "anyhow",- "aws-config",- "aws-sdk-secretsmanager",- "aws-sdk-sesv2",- "axum",- "http-body-util",- "lazy_static",- "macro_auth",- "macro_cors",- "macro_db_client",- "macro_entrypoint",- "macro_env",- "macro_env_var",- "macro_middleware",- "model",- "models_permissions",- "redis",- "regex",- "reqwest",- "secretsmanager_client",- "serde",- "serde_json",- "ses_client",- "sqlx",- "strum",- "thiserror 2.0.17",- "tokio",- "tower 0.5.2",- "tower-http",- "tracing",- "urlencoding",- "utoipa",- "utoipa-swagger-ui",-]--[[package]]-name = "organization_service_client"-version = "0.1.0"-dependencies = [- "macro_client_errors",- "reqwest",- "serde",-]-[[package]]name = "outref"version = "0.5.2"diff --git a/rust/cloud-storage/Cargo.toml b/rust/cloud-storage/Cargo.tomlindex e69f12d6d2..abdbcab4e1 100644--- a/rust/cloud-storage/Cargo.toml+++ b/rust/cloud-storage/Cargo.toml@@ -83,8 +83,6 @@ members = ["opensearch_client","organization_retention_handler","organization_retention_trigger",- "organization_service",- "organization_service_client","permission","properties","properties_db_client",diff --git a/rust/cloud-storage/Dockerfile.dev b/rust/cloud-storage/Dockerfile.devindex 502c67968e..0e5ddd87de 100644--- a/rust/cloud-storage/Dockerfile.dev+++ b/rust/cloud-storage/Dockerfile.dev@@ -16,7 +16,6 @@ RUN cargo build --release \--bin document_storage_service \--bin email_service \--bin notification_service \- --bin organization_service \--bin properties_service \--bin search_service \--bin static_file_service \@@ -73,11 +72,6 @@ COPY --from=builder /app/target/release/notification_service /app/svcRUN chmod +x /app/svcENTRYPOINT ["dumb-init", "./svc"]-FROM base AS organization_service-COPY --from=builder /app/target/release/organization_service /app/svc-RUN chmod +x /app/svc-ENTRYPOINT ["dumb-init", "./svc"]-FROM base AS properties_serviceCOPY --from=builder /app/target/release/properties_service /app/svcRUN chmod +x /app/svcdiff --git a/rust/cloud-storage/organization_service/.gitignore b/rust/cloud-storage/organization_service/.gitignoredeleted file mode 100644index 2f7896d1d1..0000000000--- a/rust/cloud-storage/organization_service/.gitignore+++ /dev/null@@ -1 +0,0 @@-target/diff --git a/rust/cloud-storage/organization_service/Cargo.toml b/rust/cloud-storage/organization_service/Cargo.tomldeleted file mode 100644index e6bd48f080..0000000000--- a/rust/cloud-storage/organization_service/Cargo.toml+++ /dev/null@@ -1,51 +0,0 @@-[package]-edition = "2024"-name = "organization_service"-publish = false-version = "0.1.0"--[[bin]]-name = "organization_service"-path = "src/main.rs"--[[bin]]-name = "organization_service_openapi"-path = "src/openapi.rs"--[dependencies]-anyhow = { workspace = true }-aws-config = { workspace = true }-aws-sdk-secretsmanager = { workspace = true }-aws-sdk-sesv2 = { workspace = true }-axum = { workspace = true, features = ["tower-log"] }-http-body-util = { workspace = true }-lazy_static = { workspace = true }-macro_auth = { path = "../macro_auth" }-macro_cors = { path = "../macro_cors" }-macro_db_client = { path = "../macro_db_client" }-macro_entrypoint = { path = "../macro_entrypoint" }-macro_env = { path = "../macro_env" }-macro_env_var = { path = "../macro_env_var" }-macro_middleware = { path = "../macro_middleware", default-features = false, features = [- "auth",- "user_permissions",-] }-model = { path = "../model" }-models_permissions = { path = "../models_permissions" }-redis = { workspace = true, features = ["tokio-native-tls-comp"] }-regex = { workspace = true }-reqwest = { workspace = true }-secretsmanager_client = { path = "../secretsmanager_client" }-serde = { workspace = true }-serde_json = { workspace = true }-ses_client = { path = "../ses_client" }-sqlx = { workspace = true }-strum = { workspace = true }-thiserror = { workspace = true }-tokio = { workspace = true }-tower = { workspace = true, features = ["util"] }-tower-http = { workspace = true }-tracing = { workspace = true }-urlencoding = { workspace = true }-utoipa = { workspace = true, features = ["axum_extras"] }-utoipa-swagger-ui = { workspace = true, features = ["axum"] }diff --git a/rust/cloud-storage/organization_service/Makefile b/rust/cloud-storage/organization_service/Makefiledeleted file mode 100644index cd58853ade..0000000000--- a/rust/cloud-storage/organization_service/Makefile+++ /dev/null@@ -1,2 +0,0 @@-prepare_db:- DATABASE_URL=postgres://user:password@localhost:5432/macrodb cargo sqlx preparediff --git a/rust/cloud-storage/organization_service/justfile b/rust/cloud-storage/organization_service/justfiledeleted file mode 100644index 0b829d5e0c..0000000000--- a/rust/cloud-storage/organization_service/justfile+++ /dev/null@@ -1,15 +0,0 @@-set dotenv-load := true--mod ci '../ci.just'--deploy-dev:- just ci::deploy-dev organization-service--run:- cargo run--check:- SQLX_OFFLINE=true cargo check--run-local:- cargo run --features macro_middleware/local_authdiff --git a/rust/cloud-storage/organization_service/src/api/context.rs b/rust/cloud-storage/organization_service/src/api/context.rsdeleted file mode 100644index 52397ffae7..0000000000--- a/rust/cloud-storage/organization_service/src/api/context.rs+++ /dev/null@@ -1,36 +0,0 @@-use crate::{config::Config, service};-use axum::extract::FromRef;-use macro_auth::middleware::decode_jwt::JwtValidationArgs;-use macro_middleware::auth::internal_access::InternalApiSecretKey;-use secretsmanager_client::LocalOrRemoteSecret;-use sqlx::PgPool;-use std::sync::Arc;--#[derive(Clone, FromRef)]-pub(crate) struct ApiContext {- pub db: PgPool,- pub redis_client: Arc<service::redis::Redis>,- pub ses_client: Arc<ses_client::Ses>,- pub config: Arc<Config>,- jwt_args: JwtValidationArgs,- internal_api_key: LocalOrRemoteSecret<InternalApiSecretKey>,-}--impl ApiContext {- pub fn init(- db: PgPool,- redis_client: redis::Client,- ses_client: ses_client::Ses,- config: Config,- jwt_args: JwtValidationArgs,- ) -> Self {- ApiContext {- db,- redis_client: Arc::new(service::redis::Redis::new(redis_client)),- ses_client: Arc::new(ses_client),- jwt_args,- internal_api_key: LocalOrRemoteSecret::Local(config.internal_api_secret_key.clone()),- config: Arc::new(config),- }- }-}diff --git a/rust/cloud-storage/organization_service/src/api/health.rs b/rust/cloud-storage/organization_service/src/api/health.rsdeleted file mode 100644index 62c7c23332..0000000000--- a/rust/cloud-storage/organization_service/src/api/health.rs+++ /dev/null@@ -1,58 +0,0 @@-use axum::{Router, routing::get};--/// Health check-#[utoipa::path(- get,- path = "/health",- responses(- (status = 200, description = "health", body = String),- )- )]-pub async fn health_handler() -> String {- "healthy".to_string()-}--pub fn router() -> Router {- Router::new().route("/health", get(health_handler))-}--#[cfg(test)]-mod tests {- use super::*;- use axum::{- body::Body,- http::{Request, StatusCode},- };- #[allow(unused_imports)]- use http_body_util::BodyExt; // for `collect`- use tower::ServiceExt;-- #[tokio::test]- async fn test_health_check() {- let api = router();-- let response = api- .oneshot(- Request::builder()- .uri("/health")- .method("GET")- .body(Body::empty())- .unwrap(),- )- .await- .unwrap();-- assert_eq!(response.status(), StatusCode::OK);- let body = String::from_utf8(- response- .into_body()- .collect()- .await- .unwrap()- .to_bytes()- .to_vec(),- )- .unwrap();- assert_eq!(body, "healthy");- }-}diff --git a/rust/cloud-storage/organization_service/src/api/internal/get_users_in_organization.rs b/rust/cloud-storage/organization_service/src/api/internal/get_users_in_organization.rsdeleted file mode 100644index 45eab6bce8..0000000000--- a/rust/cloud-storage/organization_service/src/api/internal/get_users_in_organization.rs+++ /dev/null@@ -1,77 +0,0 @@-use axum::{- Json,- extract::{Path, Query, State},- http::StatusCode,- response::IntoResponse,-};-use macro_middleware::auth::internal_access::ValidInternalKey;--use crate::{api::context::ApiContext, model::response::user::get_users::GetUsersInternalResponse};-use model::request::pagination::PaginationQueryParams;--#[derive(serde::Deserialize)]-pub struct Params {- pub organization_id: i32,-}--#[utoipa::path(- get,- path = "/internal/organization/{organization_id}/users",- operation_id = "get_users_in_organization",- params(- ("organization_id" = i32, Path, description = "The organization id")- ),- responses(- (status = 200, body=GetUsersInternalResponse),- (status = 401, body=String),- (status = 400, body=String),- (status = 500, body=String),- )-)]-#[tracing::instrument(skip(ctx, params))]-pub async fn handler(- _access: ValidInternalKey,- State(ctx): State<ApiContext>,- Path(Params { organization_id }): Path<Params>,- Query(params): Query<PaginationQueryParams>,-) -> impl IntoResponse {- if let Some(limit) = params.limit- && limit > 100- {- tracing::warn!(limit=%limit, "exceeded max value for limit");- return Err((StatusCode::BAD_REQUEST, "limit cannot exceed 100"));- }-- let limit = params.limit.unwrap_or(10);- let offset = params.offset.unwrap_or(0);-- let (users, total) = macro_db_client::user::get_all::get_user_ids_by_organization(- &ctx.db,- organization_id,- limit,- offset,- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to get users in organization");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to get users in organization",- )- })?;-- // Only include the next offset if there are more users to fetch- let next_offset = if offset + limit < total {- Some(offset + limit)- } else {- None- };-- let response = GetUsersInternalResponse {- users,- total,- next_offset,- };-- Ok((StatusCode::OK, Json(response)))-}diff --git a/rust/cloud-storage/organization_service/src/api/internal/mod.rs b/rust/cloud-storage/organization_service/src/api/internal/mod.rsdeleted file mode 100644index 1d13c1f43b..0000000000--- a/rust/cloud-storage/organization_service/src/api/internal/mod.rs+++ /dev/null@@ -1,12 +0,0 @@-use axum::{Router, routing::get};--use crate::api::context::ApiContext;--mod get_users_in_organization;--pub fn router() -> Router<ApiContext> {- Router::new().route(- "/organization/:organization_id/users",- get(get_users_in_organization::handler),- )-}diff --git a/rust/cloud-storage/organization_service/src/api/middleware/ensure_it_permission.rs b/rust/cloud-storage/organization_service/src/api/middleware/ensure_it_permission.rsdeleted file mode 100644index d1362dcbb9..0000000000--- a/rust/cloud-storage/organization_service/src/api/middleware/ensure_it_permission.rs+++ /dev/null@@ -1,28 +0,0 @@-use axum::{- Extension,- extract::Request,- http::StatusCode,- middleware::Next,- response::{IntoResponse, Response},-};--use crate::api::MACRO_IT_PANEL_PERMISSION;--use model::user::UserContext;--/// Ensures the user has the correct permission(s) for access-pub(in crate::api) async fn handler(- user_context: Extension<UserContext>,- req: Request,- next: Next,-) -> Result<Response, Response> {- let permissions = user_context- .permissions- .as_ref()- .expect("permissions must be supplied");- if !permissions.contains(MACRO_IT_PANEL_PERMISSION) {- return Err(StatusCode::UNAUTHORIZED.into_response());- }-- Ok(next.run(req).await)-}diff --git a/rust/cloud-storage/organization_service/src/api/middleware/mod.rs b/rust/cloud-storage/organization_service/src/api/middleware/mod.rsdeleted file mode 100644index 7ac4b0f17d..0000000000--- a/rust/cloud-storage/organization_service/src/api/middleware/mod.rs+++ /dev/null@@ -1 +0,0 @@-pub(in crate::api) mod ensure_it_permission;diff --git a/rust/cloud-storage/organization_service/src/api/mod.rs b/rust/cloud-storage/organization_service/src/api/mod.rsdeleted file mode 100644index b1154062bc..0000000000--- a/rust/cloud-storage/organization_service/src/api/mod.rs+++ /dev/null@@ -1,110 +0,0 @@-use anyhow::Context;-use axum::Router;-use axum::extract::Request;-use axum::http::Method;-use axum::middleware::Next;-use context::ApiContext;-use tower::ServiceBuilder;-use tower_http::trace::TraceLayer;-use utoipa::OpenApi;-use utoipa_swagger_ui::SwaggerUi;--// Utilities-pub mod context;--// Routes-mod health;-mod internal;-mod organization;-mod users;--mod middleware;--pub(crate) mod swagger;--// Constants-// role based constants-pub static MACRO_ORGANIZATION_IT_ROLE: &str = "organization_it";--// permission based constants-pub static MACRO_IT_PANEL_PERMISSION: &str = "write:it_panel";--pub async fn setup_and_serve(state: ApiContext) -> anyhow::Result<()> {- let cors = macro_cors::cors_layer();-- let app = api_router(state.clone())- .layer(cors.clone())- .layer(TraceLayer::new_for_http())- // The health router is attached here so we don't attach the logging middleware to it- .merge(health::router().layer(cors))- .merge(SwaggerUi::new("/docs").url("/api-doc/openapi.json", swagger::ApiDoc::openapi()));-- let listener = tokio::net::TcpListener::bind(format!("0.0.0.0:{}", state.config.port))- .await- .unwrap();- tracing::info!(- "organization service is up and running with environment {:?} on port {}",- &state.config.environment,- &state.config.port- );- axum::serve(listener, app.into_make_service())- .await- .context("error starting service")-}--fn api_router(state: ApiContext) -> Router {- Router::new()- .nest(- "/users",- users::router().layer(- ServiceBuilder::new()- .layer(axum::middleware::from_fn_with_state(- state.clone(),- macro_middleware::auth::decode_jwt::handler,- ))- .layer(axum::middleware::from_fn_with_state(- state.clone(),- macro_middleware::user_permissions::attach_user_permissions::handler,- ))- .layer(axum::middleware::from_fn(- |req: Request, next: Next| async move {- match req.method() {- &Method::PUT | &Method::POST | &Method::PATCH | &Method::DELETE => {- tokio::task::spawn(next.run(req)).await.unwrap()- }- _ => next.run(req).await,- }- },- )),- ),- )- .nest(- "/organization",- organization::router().layer(- ServiceBuilder::new()- .layer(axum::middleware::from_fn_with_state(- state.clone(),- macro_middleware::auth::decode_jwt::handler,- ))- .layer(axum::middleware::from_fn_with_state(- state.clone(),- macro_middleware::user_permissions::attach_user_permissions::handler,- ))- .layer(axum::middleware::from_fn(- middleware::ensure_it_permission::handler,- ))- .layer(axum::middleware::from_fn(- |req: Request, next: Next| async move {- match req.method() {- &Method::PUT | &Method::POST | &Method::PATCH | &Method::DELETE => {- tokio::task::spawn(next.run(req)).await.unwrap()- }- _ => next.run(req).await,- }- },- )),- ),- )- .nest("/internal", internal::router())- .with_state(state)-}diff --git a/rust/cloud-storage/organization_service/src/api/organization/get_settings.rs b/rust/cloud-storage/organization_service/src/api/organization/get_settings.rsdeleted file mode 100644index dea7ae225b..0000000000--- a/rust/cloud-storage/organization_service/src/api/organization/get_settings.rs+++ /dev/null@@ -1,47 +0,0 @@-use axum::{- Extension, Json,- extract::State,- http::StatusCode,- response::{IntoResponse, Response},-};--use crate::{api::context::ApiContext, model::organization::OrganizationSettingsResponse};-use model::user::UserContext;--/// Gets the organizations settings-#[utoipa::path(- get,- path = "/organization/settings",- responses(- (status = 200, body=OrganizationSettingsResponse),- (status = 401, body=String),- (status = 400, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(ctx, user_context), fields(user_id=%user_context.user_id, organization_id=?user_context.organization_id))]-pub async fn get_settings_handler(- State(ctx): State<ApiContext>,- user_context: Extension<UserContext>,-) -> Result<impl IntoResponse, Response> {- let settings = macro_db_client::organization::get::settings::get_organization_settings(- ctx.db.clone(),- user_context- .organization_id- .expect("Organization ID must be supplied"),- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to get organization settings");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to get organization settings",- )- .into_response()- })?;-- Ok((- StatusCode::OK,- Json(OrganizationSettingsResponse::from(settings)),- ))-}diff --git a/rust/cloud-storage/organization_service/src/api/organization/mod.rs b/rust/cloud-storage/organization_service/src/api/organization/mod.rsdeleted file mode 100644index c3d0071f9d..0000000000--- a/rust/cloud-storage/organization_service/src/api/organization/mod.rs+++ /dev/null@@ -1,16 +0,0 @@-use crate::api::context::ApiContext;-use axum::{- Router,- routing::{get, patch},-};-pub(in crate::api) mod get_settings;-pub(in crate::api) mod patch_organization_settings;--pub fn router() -> Router<ApiContext> {- Router::new()- .route("/settings", get(get_settings::get_settings_handler))- .route(- "/settings",- patch(patch_organization_settings::patch_organization_settings_handler),- )-}diff --git a/rust/cloud-storage/organization_service/src/api/organization/patch_organization_settings.rs b/rust/cloud-storage/organization_service/src/api/organization/patch_organization_settings.rsdeleted file mode 100644index 3ef4e7052c..0000000000--- a/rust/cloud-storage/organization_service/src/api/organization/patch_organization_settings.rs+++ /dev/null@@ -1,102 +0,0 @@-use axum::{- Extension, Json,- extract::{self, State},- http::StatusCode,- response::{IntoResponse, Response},-};--use crate::{- api::context::ApiContext,- model::{- request::patch_organization_settings::PatchOrganizationSettingsRequest,- response::EmptyResponse,- },-};--use model::user::UserContext;--/// Patches the organization settings-#[utoipa::path(- patch,- path = "/organization/settings",- responses(- (status = 200),- (status = 401, body=String),- (status = 400, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(ctx, user_context,req), fields(user_id=%user_context.user_id, organization_id=?user_context.organization_id))]-pub async fn patch_organization_settings_handler(- State(ctx): State<ApiContext>,- user_context: Extension<UserContext>,- extract::Json(req): extract::Json<PatchOrganizationSettingsRequest>,-) -> Result<Response, Response> {- let mut transaction = ctx.db.begin().await.map_err(|e| {- tracing::error!(error=?e, "failed to begin transaction");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to update organization settings",- )- .into_response()- })?;-- if let Some(remove_organization_default_share_permission) = req.remove_default_share_permission- && remove_organization_default_share_permission- {- macro_db_client::organization::remove::organization_default_share_permission::remove_organization_default_share_permission(- &mut transaction,- user_context.organization_id.expect("Organization ID must be supplied"),- )- .await- .map_err(|e| {- tracing::error!(error=?e, "failed to remove organization default share permission");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to update organization settings",- ).into_response()- })?;- }-- if let Some(remove_retention_days) = req.remove_retention_days {- if remove_retention_days {- macro_db_client::organization::remove::organization_retention_policy::remove_organization_retention_policy(- &mut transaction,- user_context.organization_id.expect("Organization ID must be supplied"),- )- .await- .map_err(|e| {- tracing::error!(error=?e, "failed to remove organization retention policy");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to update organization settings",- ).into_response()- })?;- }- } else if let Some(retention_days) = req.retention_days {- macro_db_client::organization::patch::organization_retention_policy::patch_organization_retention_policy(- &mut transaction,- user_context.organization_id.expect("Organization ID must be supplied"),- retention_days,- )- .await- .map_err(|e| {- tracing::error!(error=?e, "failed to update organization retention policy");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to update organization settings",- ).into_response()- })?;- }-- transaction.commit().await.map_err(|e| {- tracing::error!(error=?e, "failed to commit transaction");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to update organization settings",- )- .into_response()- })?;-- Ok((StatusCode::OK, Json(EmptyResponse::default())).into_response())-}diff --git a/rust/cloud-storage/organization_service/src/api/swagger.rs b/rust/cloud-storage/organization_service/src/api/swagger.rsdeleted file mode 100644index b173f9f19e..0000000000--- a/rust/cloud-storage/organization_service/src/api/swagger.rs+++ /dev/null@@ -1,60 +0,0 @@-use crate::{- api::{health, organization, users},- model::{- organization::{OrganizationSettingsResponse, OrganizationShareType},- request::{- delete_user::DeleteUserRequest,- invite_user::InviteUserRequest,- patch_organization_settings::PatchOrganizationSettingsRequest,- patch_user_role::{OrganizationUserRole, PatchUserRoleRequest},- },- response::{- EmptyResponse,- user::{get_invited_users::GetInvitedUsersResponse, get_users::GetUsersResponse},- },- },-};--use model::organization::{OrganizationDefaultSharePermission, User};-use models_permissions::share_permission::access_level::AccessLevel;-use utoipa::OpenApi;--#[derive(OpenApi)]-#[openapi(- info(- terms_of_service = "https://macro.com/terms",- ),- paths(- health::health_handler,-- // users- users::get_users::get_users_handler,- users::patch_user_role::patch_user_role_handler,- users::delete_user::delete_user_handler,- users::invite_user::invite_user_handler,- users::revoke_user_invite::revoke_user_invite_handler,- users::get_invited_users::get_invited_users_handler,-- // organizations- organization::get_settings::get_settings_handler,- organization::patch_organization_settings::patch_organization_settings_handler,- ),- components(- schemas(- User,- AccessLevel, OrganizationDefaultSharePermission,- GetUsersResponse, // Get all users- OrganizationShareType, OrganizationSettingsResponse, // Get organization settings- PatchOrganizationSettingsRequest, // Patch organization settings- OrganizationUserRole, PatchUserRoleRequest,- DeleteUserRequest,- InviteUserRequest,- GetInvitedUsersResponse,- EmptyResponse,- ),- ),- tags(- (name = "macro organization service", description = "Organization service")- )- )]-pub struct ApiDoc;diff --git a/rust/cloud-storage/organization_service/src/api/users/delete_user.rs b/rust/cloud-storage/organization_service/src/api/users/delete_user.rsdeleted file mode 100644index d03e00270a..0000000000--- a/rust/cloud-storage/organization_service/src/api/users/delete_user.rs+++ /dev/null@@ -1,143 +0,0 @@-use std::sync::Arc;--use axum::{- Extension, Json,- extract::{self, State},- http::StatusCode,- response::{IntoResponse, Response},-};-use sqlx::PgPool;--use crate::{- config::Config,- model::{request::delete_user::DeleteUserRequest, response::EmptyResponse},-};--use model::user::UserContext;--/// Deletes the user. This action cannot be undone as it queues the user for deletion.-#[utoipa::path(- delete,- path = "/users",- responses(- (status = 200),- (status = 401, body=String),- (status = 400, body=String),- (status = 404, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(db, config, user_context, req), fields(user_id=%user_context.user_id, organization_id=?user_context.organization_id, delete_user_id=%req.user_id))]-pub async fn delete_user_handler(- State(db): State<PgPool>,- State(config): State<Arc<Config>>,- user_context: Extension<UserContext>,- extract::Json(req): extract::Json<DeleteUserRequest>,-) -> Result<Response, Response> {- // Ensure the user is in the organization- let user_organization_id: i32 =- match macro_db_client::user::get::get_user_organization::get_user_organization(- &db,- req.user_id.as_str(),- )- .await- {- Ok(result) => {- if let Some(organization_id) = result {- organization_id- } else {- tracing::error!("user not in organization");- return Err(StatusCode::UNAUTHORIZED.into_response());- }- }- Err(e) => {- tracing::error!(error=?e, "unable to get user organization");- let result = match e {- sqlx::Error::RowNotFound => StatusCode::NOT_FOUND,- _ => StatusCode::INTERNAL_SERVER_ERROR,- }- .into_response();- return Err(result);- }- };-- if user_organization_id- != user_context- .organization_id- .expect("organization ID must be supplied")- {- tracing::error!("user not in same organization");- return Err(StatusCode::UNAUTHORIZED.into_response());- }-- delete_user(&config, &req.user_id).await.map_err(|e| {- tracing::error!(error=?e, "unable to delete user");- (StatusCode::INTERNAL_SERVER_ERROR).into_response()- })?;-- Ok((StatusCode::OK, Json(EmptyResponse::default())).into_response())-}--/// Calls DSS to delete the user's documents and then will delete the user from the database.-#[tracing::instrument(skip(auth_context))]-async fn delete_user(auth_context: &Config, user_to_delete: &str) -> anyhow::Result<()> {- let client = reqwest::Client::new();- let start_time_dss = std::time::Instant::now();- // Delete user DSS items through DSS API- let url_encoded_user_id = urlencoding::encode(user_to_delete);- let res = client- .delete(format!(- "{}/internal/users/{url_encoded_user_id}",- auth_context.document_storage_service_url- ))- .header(- "x-document-storage-service-auth-key",- auth_context.internal_api_secret_key.as_ref(),- )- .header("User-Agent", "organization-service")- .send()- .await?;- tracing::trace!(elapsed = ?start_time_dss.elapsed(), "delete user DSS complete");-- if res.status() != reqwest::StatusCode::OK {- tracing::error!(status=?res.status(), "failed to delete dss");- return Err(anyhow::anyhow!(- "status:{} response:{}",- res.status(),- res.text().await?- ));- }-- let start_time_auth = std::time::Instant::now();- // Delete user DSS items through DSS API- let res = client- .delete(format!(- "{}/webhooks/user",- auth_context.authentication_service_url- ))- .body(serde_json::to_string(&DeleteUserRequest {- user_id: user_to_delete.to_string(),- })?)- .header(- "x-internal-auth-key",- auth_context- .authentication_service_internal_api_secret_key- .as_ref(),- )- .header("User-Agent", "organization-service")- .header(reqwest::header::CONTENT_TYPE, "application/json")- .send()- .await?;- tracing::trace!(elapsed = ?start_time_auth.elapsed(), "delete user auth complete");-- if res.status() != reqwest::StatusCode::OK {- tracing::error!(status=?res.status(), "failed to delete auth");- return Err(anyhow::anyhow!(- "status:{} response:{}",- res.status(),- res.text().await?- ));- }-- Ok(())-}diff --git a/rust/cloud-storage/organization_service/src/api/users/get_invited_users.rs b/rust/cloud-storage/organization_service/src/api/users/get_invited_users.rsdeleted file mode 100644index 80b95ecfea..0000000000--- a/rust/cloud-storage/organization_service/src/api/users/get_invited_users.rs+++ /dev/null@@ -1,49 +0,0 @@-use axum::{- Extension, Json,- extract::State,- http::StatusCode,- response::{IntoResponse, Response},-};--use crate::{- api::context::ApiContext, model::response::user::get_invited_users::GetInvitedUsersResponse,-};--use model::user::UserContext;--/// Gets all invited users for your organization-#[utoipa::path(- get,- path = "/users/invited",- responses(- (status = 200, body=GetInvitedUsersResponse),- (status = 401, body=String),- (status = 400, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(ctx, user_context), fields(user_id=%user_context.user_id, organization_id=?user_context.organization_id))]-pub async fn get_invited_users_handler(- State(ctx): State<ApiContext>,- user_context: Extension<UserContext>,-) -> Result<Response, Response> {- let invited_users = macro_db_client::user::get_invited::get_invited_users_by_organization(- ctx.db.clone(),- user_context- .organization_id- .expect("organization ID required"),- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to get invited users in organization");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to get invited users in organization",- )- .into_response()- })?;-- let response = GetInvitedUsersResponse { invited_users };-- Ok((StatusCode::OK, Json(response)).into_response())-}diff --git a/rust/cloud-storage/organization_service/src/api/users/get_users.rs b/rust/cloud-storage/organization_service/src/api/users/get_users.rsdeleted file mode 100644index 1eece1833d..0000000000--- a/rust/cloud-storage/organization_service/src/api/users/get_users.rs+++ /dev/null@@ -1,83 +0,0 @@-use axum::{- Extension, Json,- extract::{self, State},- http::StatusCode,- response::IntoResponse,-};--use crate::{api::context::ApiContext, model::response::user::get_users::GetUsersResponse};-use model::request::pagination::PaginationQueryParams;-use model::user::UserContext;--/// Gets all users currently in your organization-#[utoipa::path(- get,- path = "/users",- params(- ("limit" = i64, Query, description = "The maximum number of users to retreive. Default 10, max 100."),- ("offset" = i64, Query, description = "The offset to start from. Default 0."),- ),- responses(- (status = 200, body=GetUsersResponse),- (status = 401, body=String),- (status = 400, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(ctx, user_context, params), fields(user_id=%user_context.user_id, organization_id=?user_context.organization_id))]-pub async fn get_users_handler(- State(ctx): State<ApiContext>,- user_context: Extension<UserContext>,- extract::Query(params): extract::Query<PaginationQueryParams>,-) -> impl IntoResponse {- if let Some(limit) = params.limit- && limit > 100- {- tracing::warn!(limit=%limit, "exceeded max value for limit");- return Err((StatusCode::BAD_REQUEST, "limit cannot exceed 100"));- }-- let limit = params.limit.unwrap_or(10);- let offset = params.offset.unwrap_or(0);-- let organization_id = match user_context.organization_id {- Some(org_id) => org_id,- None => {- tracing::warn!(user_id=%user_context.user_id, "User is not part of an organization");- return Err((- StatusCode::FORBIDDEN,- "User must be part of an organization to access this endpoint",- ));- }- };-- let (users, total) = macro_db_client::user::get_all::get_users_by_organization(- ctx.db.clone(),- organization_id,- limit,- offset,- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to get users in organization");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to get users in organization",- )- })?;-- // Only include the next offset if there are more users to fetch- let next_offset = if offset + limit < total {- Some(offset + limit)- } else {- None- };-- let response = GetUsersResponse {- users,- total,- next_offset,- };-- Ok((StatusCode::OK, Json(response)))-}diff --git a/rust/cloud-storage/organization_service/src/api/users/invite_user.rs b/rust/cloud-storage/organization_service/src/api/users/invite_user.rsdeleted file mode 100644index d24332bb2c..0000000000--- a/rust/cloud-storage/organization_service/src/api/users/invite_user.rs+++ /dev/null@@ -1,213 +0,0 @@-use axum::{- Extension, Json,- extract::{self, State},- http::StatusCode,- response::{IntoResponse, Response},-};--use crate::{- api::context::ApiContext,- model::{request::invite_user::InviteUserRequest, response::EmptyResponse},- utils,-};--use model::user::UserContext;--/// Invites a user to an organization-#[utoipa::path(- post,- path = "/users/invite",- responses(- (status = 200),- (status = 401, body=String),- (status = 400, body=String),- (status = 404, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(ctx, user_context, req), fields(user_id=%user_context.user_id, organization_id=?user_context.organization_id, invite_email=%req.email))]-pub async fn invite_user_handler(- State(ctx): State<ApiContext>,- user_context: Extension<UserContext>,- extract::Json(req): extract::Json<InviteUserRequest>,-) -> Result<Response, Response> {- if !utils::validate_email::is_valid_email(req.email.as_str()) {- tracing::error!("invalid email provided");- return Err((StatusCode::BAD_REQUEST, "Unable to validate request.").into_response());- }- let organization_id = user_context.organization_id;- let allow_list_only = macro_db_client::organization::get::organization::get_allow_list_only(- ctx.db.clone(),- organization_id.expect("Organization ID must be supplied"),- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to get organization allow list only");- (- StatusCode::INTERNAL_SERVER_ERROR,- "Unable to validate request.",- )- .into_response()- })?;-- let organization_name =- macro_db_client::organization::get::organization::get_organization_name(- &ctx.db,- organization_id.expect("Organization ID must be supplied"),- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to get organization name");- (- StatusCode::INTERNAL_SERVER_ERROR,- "Unable to invite user to organization.",- )- .into_response()- })?;-- // Ensure domain is correct for the organization- let user_domain = req.email.split('@').collect::<Vec<&str>>()[1];- let organization_domains = get_organization_domains(- ctx.db.clone(),- organization_id.expect("Organization ID must be supplied"),- allow_list_only,- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to get organization email matches");- (- StatusCode::INTERNAL_SERVER_ERROR,- "Unable to validate request.",- )- .into_response()- })?;-- tracing::trace!(organization_domain=?organization_domains, user_domain=?user_domain, "checking if user domain matches organization domain");-- if !organization_domains.contains(&user_domain.to_string()) {- tracing::error!(user_domain=?user_domain, organization_domains=?organization_domains, "user domain not in organization domain list");- return Err((- StatusCode::BAD_REQUEST,- "The user's domain is not valid for this organization.",- )- .into_response());- }-- // Check if user exists and is in organization- let existing_user = macro_db_client::user::get::get_user_by_email::get_user_by_email(- ctx.db.clone(),- req.email.as_str(),- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to get user");- (- StatusCode::INTERNAL_SERVER_ERROR,- "Unable to validate request.",- )- .into_response()- })?;-- // If the user is part of an organization we cannot invite them to this one.- if let Some(existing_user) = existing_user- && let Some(user_organization_id) = existing_user.1- {- if user_organization_id != organization_id.expect("Organization ID must be supplied") {- tracing::error!("user is already in a different organization");- return Err((- StatusCode::UNAUTHORIZED,- "User belongs to another organization.",- )- .into_response());- }- tracing::trace!("user is already in the organization, sending invitation email");-- // Email user invitation- ctx.ses_client- .invite_user(&organization_name, req.email.as_str())- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to send user invitation email");- (- StatusCode::INTERNAL_SERVER_ERROR,- "Unable to email user invitation.",- )- .into_response()- })?;-- // User is already in the organization- return Ok((StatusCode::OK, Json(EmptyResponse::default())).into_response());- }-- // Invite user- macro_db_client::user::create::invite_user::invite_user(- ctx.db.clone(),- user_context- .organization_id- .expect("Organization must be supplied"),- req.email.as_str(),- allow_list_only,- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to create organization invitation");- if e.to_string()- .contains("user is already invited to your organization")- {- return (- StatusCode::BAD_REQUEST,- "User is already invited to your organization.",- )- .into_response();- }- (- StatusCode::INTERNAL_SERVER_ERROR,- "Unable to invite user to organization.",- )- .into_response()- })?;-- // Email user invitation- ctx.ses_client- .invite_user(&organization_name, req.email.as_str())- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to send user invitation email");- (- StatusCode::INTERNAL_SERVER_ERROR,- "Unable to email user invitation.",- )- .into_response()- })?;-- Ok((StatusCode::OK, Json(EmptyResponse::default())).into_response())-}--/// Gets the organization domains for the user-async fn get_organization_domains(- db: sqlx::Pool<sqlx::Postgres>,- organization_id: i32,- allow_list_only: bool,-) -> anyhow::Result<Vec<String>> {- let email_matches =- macro_db_client::organization::get::organization_email_matches::get_organization_email_matches(- db.clone(),- organization_id,- )- .await?;-- // If organization is "allowListOnly" we need to convert the emails in list to domains to- // ensure the domain matches- if allow_list_only {- tracing::trace!("organization is allow list only");- return Ok(email_matches- .into_iter()- .map(|e| e.split('@').collect::<Vec<&str>>()[1].to_string())- .collect());- }-- Ok(email_matches- .into_iter()- .filter(|email| !email.contains('@'))- .collect())-}diff --git a/rust/cloud-storage/organization_service/src/api/users/mod.rs b/rust/cloud-storage/organization_service/src/api/users/mod.rsdeleted file mode 100644index 9f49374b28..0000000000--- a/rust/cloud-storage/organization_service/src/api/users/mod.rs+++ /dev/null@@ -1,53 +0,0 @@-use axum::{- Router,- routing::{delete, get, patch, post},-};-use tower::ServiceBuilder;--use crate::api::context::ApiContext;--use super::middleware;--pub(in crate::api) mod delete_user;-pub(in crate::api) mod get_invited_users;-pub(in crate::api) mod get_users;-pub(in crate::api) mod invite_user;-pub(in crate::api) mod patch_user_role;-pub(in crate::api) mod revoke_user_invite;--pub fn router() -> Router<ApiContext> {- Router::new()- .route("/", get(get_users::get_users_handler))- .route(- "/invited",- get(get_invited_users::get_invited_users_handler).layer(ServiceBuilder::new().layer(- axum::middleware::from_fn(middleware::ensure_it_permission::handler),- )),- )- .route(- "/role",- patch(patch_user_role::patch_user_role_handler).layer(ServiceBuilder::new().layer(- axum::middleware::from_fn(middleware::ensure_it_permission::handler),- )),- )- .route(- "/",- delete(delete_user::delete_user_handler).layer(ServiceBuilder::new().layer(- axum::middleware::from_fn(middleware::ensure_it_permission::handler),- )),- )- .route(- "/invite",- post(invite_user::invite_user_handler).layer(ServiceBuilder::new().layer(- axum::middleware::from_fn(middleware::ensure_it_permission::handler),- )),- )- .route(- "/invite",- delete(revoke_user_invite::revoke_user_invite_handler).layer(- ServiceBuilder::new().layer(axum::middleware::from_fn(- middleware::ensure_it_permission::handler,- )),- ),- )-}diff --git a/rust/cloud-storage/organization_service/src/api/users/patch_user_role.rs b/rust/cloud-storage/organization_service/src/api/users/patch_user_role.rsdeleted file mode 100644index fd0864a57c..0000000000--- a/rust/cloud-storage/organization_service/src/api/users/patch_user_role.rs+++ /dev/null@@ -1,138 +0,0 @@-use axum::{- Extension, Json,- extract::{self, State},- http::StatusCode,- response::{IntoResponse, Response},-};--use crate::{- api::{MACRO_IT_PANEL_PERMISSION, MACRO_ORGANIZATION_IT_ROLE, context::ApiContext},- model::{- request::patch_user_role::{OrganizationUserRole, PatchUserRoleRequest},- response::EmptyResponse,- },- service,-};--use model::user::UserContext;--/// Patches the requested users role. Updating whether they have organization_it role or-/// not.-#[utoipa::path(- patch,- path = "/users/role",- responses(- (status = 200),- (status = 401, body=String),- (status = 400, body=String),- (status = 404, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(ctx, user_context, req), fields(user_id=%user_context.user_id, organization_id=?user_context.organization_id))]-pub async fn patch_user_role_handler(- State(ctx): State<ApiContext>,- user_context: Extension<UserContext>,- extract::Json(req): extract::Json<PatchUserRoleRequest>,-) -> Result<Response, Response> {- // Ensure the user is in the organization- let user_organization_id: i32 =- match macro_db_client::user::get::get_user_organization::get_user_organization(- &ctx.db,- req.user_id.as_str(),- )- .await- {- Ok(result) => {- if let Some(organization_id) = result {- organization_id- } else {- tracing::error!("user not in organization");- return Err(StatusCode::UNAUTHORIZED.into_response());- }- }- Err(e) => {- tracing::error!(error=?e, "unable to get user organization");- let result = match e {- sqlx::Error::RowNotFound => StatusCode::NOT_FOUND,- _ => StatusCode::INTERNAL_SERVER_ERROR,- }- .into_response();- return Err(result);- }- };-- if user_organization_id- != user_context- .organization_id- .expect("Organization ID must be supplied")- {- tracing::error!("user not in same organization");- return Err(StatusCode::UNAUTHORIZED.into_response());- }-- match req.organization_user_role {- OrganizationUserRole::Owner => {- make_user_owner(ctx.db.clone(), &ctx.redis_client, req.user_id.as_str()).await- }- OrganizationUserRole::Member => {- make_user_member(ctx.db.clone(), &ctx.redis_client, req.user_id.as_str()).await- }- }- .map_err(|e| {- tracing::error!(error=?e, "unable to update user roles");- StatusCode::INTERNAL_SERVER_ERROR.into_response()- })?;-- Ok((StatusCode::OK, Json(EmptyResponse::default())).into_response())-}--/// Makes the user an "owner" of the organization. Giving them organization it role.-#[tracing::instrument(skip(db, redis_client))]-async fn make_user_owner(- db: sqlx::Pool<sqlx::Postgres>,- redis_client: &service::redis::Redis,- update_user_id: &str,-) -> anyhow::Result<()> {- macro_db_client::user::patch::add_user_role::add_user_role(- db,- update_user_id,- MACRO_ORGANIZATION_IT_ROLE,- )- .await?;-- redis_client- .add_user_permission(update_user_id, MACRO_IT_PANEL_PERMISSION)- .await?;-- Ok(())-}--/// Makes the user a "member" of the organization. Removing the organization_it role if present.-async fn make_user_member(- db: sqlx::Pool<sqlx::Postgres>,- redis_client: &service::redis::Redis,- update_user_id: &str,-) -> anyhow::Result<()> {- macro_db_client::user::remove::remove_user_role::remove_user_role(- db.clone(),- update_user_id,- MACRO_ORGANIZATION_IT_ROLE,- )- .await?;-- let user_permissions =- macro_db_client::user::get::get_user_permissions::get_user_permissions(db, update_user_id)- .await?;-- let user_permissions = user_permissions- .into_iter()- .collect::<Vec<String>>()- .join(",");-- redis_client- .update_user_permissions(update_user_id, user_permissions.as_str())- .await?;-- Ok(())-}diff --git a/rust/cloud-storage/organization_service/src/api/users/revoke_user_invite.rs b/rust/cloud-storage/organization_service/src/api/users/revoke_user_invite.rsdeleted file mode 100644index 0e5d8d086a..0000000000--- a/rust/cloud-storage/organization_service/src/api/users/revoke_user_invite.rs+++ /dev/null@@ -1,47 +0,0 @@-use axum::{- Extension, Json,- extract::{self, State},- http::StatusCode,- response::{IntoResponse, Response},-};--use crate::{- api::context::ApiContext,- model::{request::invite_user::InviteUserRequest, response::EmptyResponse},-};--use model::user::UserContext;--/// Removes the users invitation from OrganizationInvitation-///-/// If the user is `allow_list_only` we will also remove the `OrganizationEmailMatch`-#[utoipa::path(- delete,- path = "/users/invite",- responses(- (status = 200),- (status = 401, body=String),- (status = 400, body=String),- (status = 404, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(ctx, user_context, req), fields(user_id=%user_context.user_id, organization_id=?user_context.organization_id))]-pub async fn revoke_user_invite_handler(- State(ctx): State<ApiContext>,- user_context: Extension<UserContext>,- extract::Json(req): extract::Json<InviteUserRequest>,-) -> Result<Response, Response> {- macro_db_client::organization::remove::organization_invitation::revoke_organization_invitation_for_user(- ctx.db.clone(),- user_context.organization_id.expect("organization ID required"),- &req.email,- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to revoke organization invitation");- (StatusCode::INTERNAL_SERVER_ERROR).into_response()- })?;-- Ok((StatusCode::OK, Json(EmptyResponse::default())).into_response())-}diff --git a/rust/cloud-storage/organization_service/src/config.rs b/rust/cloud-storage/organization_service/src/config.rsdeleted file mode 100644index d96a9163b5..0000000000--- a/rust/cloud-storage/organization_service/src/config.rs+++ /dev/null@@ -1,79 +0,0 @@-use anyhow::Context;-pub use macro_env::Environment;-use macro_env_var::env_var;-use macro_middleware::auth::internal_access::InternalApiSecretKey;-use secretsmanager_client::LocalOrRemoteSecret;--pub(crate) struct Config {- /// The connection URL for the Postgres database this application should use.- pub database_url: String,-- /// The connection URI for Macro Cache redis cluster.- pub redis_uri: String,-- /// The internal auth key to call DSS.- pub internal_api_secret_key: InternalApiSecretKey,-- /// The DSS URL.- pub document_storage_service_url: String,-- /// The email used to send user invites to macro- pub invite_email: String,-- /// The port to listen for HTTP requests on.- pub port: usize,-- /// The environment we are in- pub environment: Environment,-- /// The Auth service url- pub authentication_service_url: String,- /// The Auth service internal auth secret key- pub authentication_service_internal_api_secret_key:- LocalOrRemoteSecret<AuthenticationServiceInternalApiSecretKey>,-}--env_var! {- pub(crate) struct AuthenticationServiceInternalApiSecretKey;-}--impl Config {- pub fn from_env(- authentication_service_internal_api_secret_key: LocalOrRemoteSecret<- AuthenticationServiceInternalApiSecretKey,- >,- ) -> anyhow::Result<Self> {- let database_url =- std::env::var("DATABASE_URL").context("DATABASE_URL must be provided")?;-- let redis_uri = std::env::var("REDIS_URI").context("REDIS_URI must be provided")?;-- let document_storage_service_url = std::env::var("DOCUMENT_STORAGE_SERVICE_URL")- .context("DOCUMENT_STORAGE_SERVICE_URL must be provided")?;-- let invite_email =- std::env::var("INVITE_EMAIL").context("INVITE_EMAIL must be provided")?;-- let port: usize = std::env::var("PORT")- .unwrap_or("8080".to_string())- .parse::<usize>()- .context("port should be a number")?;-- let environment = Environment::new_or_prod();-- let authentication_service_url = std::env::var("AUTHENTICATION_SERVICE_URL")- .context("AUTHENTICATION_SERVICE_URL must be provided")?;-- Ok(Config {- database_url,- redis_uri,- internal_api_secret_key: InternalApiSecretKey::new()?,- document_storage_service_url,- invite_email,- port,- environment,- authentication_service_url,- authentication_service_internal_api_secret_key,- })- }-}diff --git a/rust/cloud-storage/organization_service/src/main.rs b/rust/cloud-storage/organization_service/src/main.rsdeleted file mode 100644index 4be232e541..0000000000--- a/rust/cloud-storage/organization_service/src/main.rs+++ /dev/null@@ -1,88 +0,0 @@-use crate::{api::context::ApiContext, config::AuthenticationServiceInternalApiSecretKey};-use anyhow::Context;-use config::{Config, Environment};-use macro_auth::middleware::decode_jwt::JwtValidationArgs;-use macro_entrypoint::MacroEntrypoint;-use secretsmanager_client::SecretManager;-use sqlx::postgres::PgPoolOptions;--mod api;-mod config;-mod model;-mod service;-mod utils;--#[tokio::main]-async fn main() -> anyhow::Result<()> {- let env = Environment::new_or_prod();- MacroEntrypoint::new(env).init();-- let secretsmanager_client =- secretsmanager_client::SecretsManager::new(aws_sdk_secretsmanager::Client::new(- &aws_config::defaults(aws_config::BehaviorVersion::latest())- .region("us-east-1")- .load()- .await,- ));-- let auth_service_key = secretsmanager_client- .get_maybe_secret_value(env, AuthenticationServiceInternalApiSecretKey::new()?)- .await?;-- // Parse our configuration from the environment.- let config =- Config::from_env(auth_service_key).context("expected to be able to generate config")?;-- tracing::trace!("initialized config");-- let (min_connections, max_connections): (u32, u32) = match config.environment {- Environment::Production => (5, 50),- Environment::Develop => (1, 10),- Environment::Local => (1, 10),- };-- let db = PgPoolOptions::new()- .min_connections(min_connections)- .max_connections(max_connections)- .connect(&config.database_url)- .await- .context("could not connect to db")?;-- tracing::trace!(- min_connections,- max_connections,- "initialized db connection"- );-- let redis_client =- redis::Client::open(config.redis_uri.as_str()).expect("could not connect to redis client");-- match redis_client.get_connection().is_err() {- true => {- tracing::error!("unable to connect to redis");- }- false => {- tracing::trace!("initialized redis connection");- }- }-- let ses_client = ses_client::Ses::new(- aws_sdk_sesv2::Client::new(- &aws_config::defaults(aws_config::BehaviorVersion::latest())- .region("us-east-1")- .load()- .await,- ),- &config.environment.to_string(),- )- .invite_email(&config.invite_email);-- let jwt_args =- JwtValidationArgs::new_with_secret_manager(config.environment, &secretsmanager_client)- .await?;-- let api_context = ApiContext::init(db, redis_client, ses_client, config, jwt_args);-- api::setup_and_serve(api_context).await?;- Ok(())-}diff --git a/rust/cloud-storage/organization_service/src/model/mod.rs b/rust/cloud-storage/organization_service/src/model/mod.rsdeleted file mode 100644index 243f391cc3..0000000000--- a/rust/cloud-storage/organization_service/src/model/mod.rs+++ /dev/null@@ -1,3 +0,0 @@-pub mod organization;-pub mod request;-pub mod response;diff --git a/rust/cloud-storage/organization_service/src/model/organization.rs b/rust/cloud-storage/organization_service/src/model/organization.rsdeleted file mode 100644index aa4567d1e5..0000000000--- a/rust/cloud-storage/organization_service/src/model/organization.rs+++ /dev/null@@ -1,72 +0,0 @@-use model::organization::{OrganizationDefaultSharePermission, OrganizationSettings};-use models_permissions::share_permission::access_level::AccessLevel;-use strum::EnumString;-use utoipa::ToSchema;--#[derive(serde::Serialize, serde::Deserialize, Eq, PartialEq, Debug, ToSchema)]-pub struct OrganizationSettingsResponse {- /// The name of the organization- pub name: String,- /// The number of days an item can go unopened for before it is automatically deleted- #[serde(skip_serializing_if = "Option::is_none")]- pub retention_days: Option<i32>,- /// The default share permission for the organization- pub default_share_permission: OrganizationShareType,-}--impl From<OrganizationSettings> for OrganizationSettingsResponse {- fn from(settings: OrganizationSettings) -> Self {- let default_share_permission = if let Some(dsp) = settings.default_share_permission {- if dsp.is_public {- OrganizationShareType::Public- } else if dsp.organization_access_enabled {- OrganizationShareType::Organization- } else {- OrganizationShareType::Private- }- } else {- // We use the default share permission which is public- OrganizationShareType::Public- };-- Self {- name: settings.name,- retention_days: settings.retention_days,- default_share_permission,- }- }-}--#[derive(serde::Serialize, serde::Deserialize, Eq, PartialEq, Debug, ToSchema, EnumString)]-#[serde(rename_all = "snake_case")]-#[strum(serialize_all = "snake_case")]-pub enum OrganizationShareType {- Public,- Organization,- Private,-}--impl From<OrganizationShareType> for OrganizationDefaultSharePermission {- fn from(share_type: OrganizationShareType) -> Self {- match share_type {- OrganizationShareType::Public => OrganizationDefaultSharePermission {- is_public: true,- public_access_level: Some(AccessLevel::View),- organization_access_enabled: false,- organization_access_level: None,- },- OrganizationShareType::Organization => OrganizationDefaultSharePermission {- is_public: false,- public_access_level: None,- organization_access_enabled: true,- organization_access_level: Some(AccessLevel::View),- },- OrganizationShareType::Private => OrganizationDefaultSharePermission {- is_public: false,- public_access_level: None,- organization_access_enabled: false,- organization_access_level: None,- },- }- }-}diff --git a/rust/cloud-storage/organization_service/src/model/request/delete_user.rs b/rust/cloud-storage/organization_service/src/model/request/delete_user.rsdeleted file mode 100644index 5336c80376..0000000000--- a/rust/cloud-storage/organization_service/src/model/request/delete_user.rs+++ /dev/null@@ -1,7 +0,0 @@-use utoipa::ToSchema;--#[derive(serde::Serialize, serde::Deserialize, Debug, ToSchema)]-pub struct DeleteUserRequest {- /// The user id who we are deleting- pub user_id: String,-}diff --git a/rust/cloud-storage/organization_service/src/model/request/invite_user.rs b/rust/cloud-storage/organization_service/src/model/request/invite_user.rsdeleted file mode 100644index a8e70c58e8..0000000000--- a/rust/cloud-storage/organization_service/src/model/request/invite_user.rs+++ /dev/null@@ -1,7 +0,0 @@-use utoipa::ToSchema;--#[derive(serde::Serialize, serde::Deserialize, Debug, ToSchema)]-pub struct InviteUserRequest {- /// The email of the user to invite- pub email: String,-}diff --git a/rust/cloud-storage/organization_service/src/model/request/mod.rs b/rust/cloud-storage/organization_service/src/model/request/mod.rsdeleted file mode 100644index 9e3836ae5b..0000000000--- a/rust/cloud-storage/organization_service/src/model/request/mod.rs+++ /dev/null@@ -1,4 +0,0 @@-pub mod delete_user;-pub mod invite_user;-pub mod patch_organization_settings;-pub mod patch_user_role;diff --git a/rust/cloud-storage/organization_service/src/model/request/patch_organization_settings.rs b/rust/cloud-storage/organization_service/src/model/request/patch_organization_settings.rsdeleted file mode 100644index df89a86726..0000000000--- a/rust/cloud-storage/organization_service/src/model/request/patch_organization_settings.rs+++ /dev/null@@ -1,13 +0,0 @@-use utoipa::ToSchema;--#[derive(serde::Serialize, serde::Deserialize, Debug, ToSchema)]-pub struct PatchOrganizationSettingsRequest {- /// Removes the retention policy you currently have set- pub remove_retention_days: Option<bool>,- /// Removes the default share permission you currently have set- pub remove_default_share_permission: Option<bool>,- /// The new retention policy you want to set- ///- /// Note: This will get ignored if you have pass in **any value** for remove_retention_days- pub retention_days: Option<i32>,-}diff --git a/rust/cloud-storage/organization_service/src/model/request/patch_user_role.rs b/rust/cloud-storage/organization_service/src/model/request/patch_user_role.rsdeleted file mode 100644index fc45a8d9f8..0000000000--- a/rust/cloud-storage/organization_service/src/model/request/patch_user_role.rs+++ /dev/null@@ -1,16 +0,0 @@-use utoipa::ToSchema;--#[derive(serde::Serialize, serde::Deserialize, Debug, ToSchema)]-#[serde(rename_all = "lowercase")]-pub enum OrganizationUserRole {- Owner,- Member,-}--#[derive(serde::Serialize, serde::Deserialize, Debug, ToSchema)]-pub struct PatchUserRoleRequest {- /// The user id who we are updating the role for- pub user_id: String,- /// The new role to give the user- pub organization_user_role: OrganizationUserRole,-}diff --git a/rust/cloud-storage/organization_service/src/model/response/mod.rs b/rust/cloud-storage/organization_service/src/model/response/mod.rsdeleted file mode 100644index 02dafa69c3..0000000000--- a/rust/cloud-storage/organization_service/src/model/response/mod.rs+++ /dev/null@@ -1,7 +0,0 @@-pub mod user;--use utoipa::ToSchema;--/// Empty response is required due to custom fetch forcing `response.json()`-#[derive(serde::Serialize, serde::Deserialize, Debug, ToSchema, Default)]-pub struct EmptyResponse {}diff --git a/rust/cloud-storage/organization_service/src/model/response/user/get_invited_users.rs b/rust/cloud-storage/organization_service/src/model/response/user/get_invited_users.rsdeleted file mode 100644index c903664035..0000000000--- a/rust/cloud-storage/organization_service/src/model/response/user/get_invited_users.rs+++ /dev/null@@ -1,7 +0,0 @@-use utoipa::ToSchema;--#[derive(serde::Serialize, serde::Deserialize, Debug, ToSchema)]-pub struct GetInvitedUsersResponse {- /// The invited users in your organization- pub invited_users: Vec<String>,-}diff --git a/rust/cloud-storage/organization_service/src/model/response/user/get_users.rs b/rust/cloud-storage/organization_service/src/model/response/user/get_users.rsdeleted file mode 100644index ae612a8e1e..0000000000--- a/rust/cloud-storage/organization_service/src/model/response/user/get_users.rs+++ /dev/null@@ -1,24 +0,0 @@-use model::organization::User;-use utoipa::ToSchema;--#[derive(serde::Serialize, serde::Deserialize, Debug, ToSchema)]-pub struct GetUsersResponse {- /// The users in your organization returned from the query- pub users: Vec<User>,- /// The total number of documents the user has- pub total: i64,- /// The next offset to be used if there is one- #[serde(skip_serializing_if = "Option::is_none")]- pub next_offset: Option<i64>,-}--#[derive(serde::Serialize, serde::Deserialize, Debug, ToSchema)]-pub struct GetUsersInternalResponse {- /// The users in your organization returned from the query- pub users: Vec<String>,- /// The total number of documents the user has- pub total: i64,- /// The next offset to be used if there is one- #[serde(skip_serializing_if = "Option::is_none")]- pub next_offset: Option<i64>,-}diff --git a/rust/cloud-storage/organization_service/src/model/response/user/mod.rs b/rust/cloud-storage/organization_service/src/model/response/user/mod.rsdeleted file mode 100644index 24d8ce367f..0000000000--- a/rust/cloud-storage/organization_service/src/model/response/user/mod.rs+++ /dev/null@@ -1,2 +0,0 @@-pub mod get_invited_users;-pub mod get_users;diff --git a/rust/cloud-storage/organization_service/src/openapi.rs b/rust/cloud-storage/organization_service/src/openapi.rsdeleted file mode 100644index d6eff42d1e..0000000000--- a/rust/cloud-storage/organization_service/src/openapi.rs+++ /dev/null@@ -1,16 +0,0 @@-#![allow(unused)]--mod api;-mod config;-mod model;-mod service;-mod utils;--use utoipa::OpenApi;--fn main() {- println!(- "{}",- api::swagger::ApiDoc::openapi().to_pretty_json().unwrap()- );-}diff --git a/rust/cloud-storage/organization_service/src/service/mod.rs b/rust/cloud-storage/organization_service/src/service/mod.rsdeleted file mode 100644index 027fbef58d..0000000000--- a/rust/cloud-storage/organization_service/src/service/mod.rs+++ /dev/null@@ -1 +0,0 @@-pub mod redis;diff --git a/rust/cloud-storage/organization_service/src/service/redis/add_user_permission.rs b/rust/cloud-storage/organization_service/src/service/redis/add_user_permission.rsdeleted file mode 100644index 8e2f6b444d..0000000000--- a/rust/cloud-storage/organization_service/src/service/redis/add_user_permission.rs+++ /dev/null@@ -1,23 +0,0 @@-use redis::AsyncCommands;--/// Adds a permission to the list of user permissions for their session if present-#[tracing::instrument(skip(redis_client))]-pub async fn add_user_permission(- redis_client: &redis::Client,- user_id: &str,- permission: &str,-) -> anyhow::Result<()> {- let mut connection = redis_client.get_multiplexed_async_connection().await?;-- let session_id = connection.get::<&str, Option<String>>(user_id).await?;-- if let Some(session_id) = session_id {- let mut permissions = connection.get::<&str, String>(session_id.as_str()).await?;- if !permissions.contains(permission) {- permissions += format!(",{}", permission).as_str();- () = connection.set(session_id.as_str(), permissions).await?;- }- }-- Ok(())-}diff --git a/rust/cloud-storage/organization_service/src/service/redis/mod.rs b/rust/cloud-storage/organization_service/src/service/redis/mod.rsdeleted file mode 100644index dbb9df3100..0000000000--- a/rust/cloud-storage/organization_service/src/service/redis/mod.rs+++ /dev/null@@ -1,27 +0,0 @@-mod add_user_permission;-mod update_user_permissions;--#[derive(Clone)]-pub struct Redis {- inner: redis::Client,-}--// Key prefixes-impl Redis {- pub fn new(inner: redis::Client) -> Self {- Self { inner }- }-- #[tracing::instrument(skip(self))]- pub async fn add_user_permission(&self, user_id: &str, permission: &str) -> anyhow::Result<()> {- add_user_permission::add_user_permission(&self.inner, user_id, permission).await- }-- pub async fn update_user_permissions(- &self,- user_id: &str,- permissions: &str,- ) -> anyhow::Result<()> {- update_user_permissions::update_user_permissions(&self.inner, user_id, permissions).await- }-}diff --git a/rust/cloud-storage/organization_service/src/service/redis/update_user_permissions.rs b/rust/cloud-storage/organization_service/src/service/redis/update_user_permissions.rsdeleted file mode 100644index 4c96fdb7f4..0000000000--- a/rust/cloud-storage/organization_service/src/service/redis/update_user_permissions.rs+++ /dev/null@@ -1,19 +0,0 @@-use redis::AsyncCommands;--/// Sets the user permissions for their session if present-#[tracing::instrument(skip(redis_client))]-pub async fn update_user_permissions(- redis_client: &redis::Client,- user_id: &str,- permissions: &str,-) -> anyhow::Result<()> {- let mut connection = redis_client.get_multiplexed_async_connection().await?;-- let session_id = connection.get::<&str, Option<String>>(user_id).await?;-- if let Some(session_id) = session_id {- () = connection.set(session_id.as_str(), permissions).await?;- }-- Ok(())-}diff --git a/rust/cloud-storage/organization_service/src/utils/mod.rs b/rust/cloud-storage/organization_service/src/utils/mod.rsdeleted file mode 100644index 372c20d1fa..0000000000--- a/rust/cloud-storage/organization_service/src/utils/mod.rs+++ /dev/null@@ -1 +0,0 @@-pub mod validate_email;diff --git a/rust/cloud-storage/organization_service/src/utils/validate_email.rs b/rust/cloud-storage/organization_service/src/utils/validate_email.rsdeleted file mode 100644index fae7709b7e..0000000000--- a/rust/cloud-storage/organization_service/src/utils/validate_email.rs+++ /dev/null@@ -1,40 +0,0 @@-use lazy_static::lazy_static;-use regex::Regex;--lazy_static! {- static ref EMAIL_REGEX: Regex = Regex::new(- r"^([a-z0-9_+]([a-z0-9_+.]*[a-z0-9_+])?)@([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6})"- )- .unwrap();-}--pub fn is_valid_email(email: &str) -> bool {- EMAIL_REGEX.is_match(email)-}--#[cfg(test)]-mod tests {- use super::*;-- #[test]- fn test_is_valid_email() {- let emails: Vec<(&str, bool)> = vec![- ("[email protected]", true),- ("[email protected]", true),- ("[email protected]", true),- ("[email protected]", true),- ("test.com", false),- ("test@test", false),- ("test@@test.com", false),- ("test@#test.com", false),- ("test@$test.com", false),- ("test@/test.com", false),- ("test@\\test.com", false),- ("[email protected]", true),- ];-- for email in emails {- assert_eq!((email.0, is_valid_email(email.0)), (email.0, email.1));- }- }-}diff --git a/rust/cloud-storage/organization_service_client/Cargo.toml b/rust/cloud-storage/organization_service_client/Cargo.tomldeleted file mode 100644index 810dad0d68..0000000000--- a/rust/cloud-storage/organization_service_client/Cargo.toml+++ /dev/null@@ -1,10 +0,0 @@-[package]-edition = "2024"-name = "organization_service_client"-publish = false-version = "0.1.0"--[dependencies]-macro_client_errors = { path = "../macro_client_errors" }-reqwest = { workspace = true }-serde = { workspace = true }diff --git a/rust/cloud-storage/organization_service_client/src/constants.rs b/rust/cloud-storage/organization_service_client/src/constants.rsdeleted file mode 100644index ef7bf96f63..0000000000--- a/rust/cloud-storage/organization_service_client/src/constants.rs+++ /dev/null@@ -1 +0,0 @@-pub static MACRO_INTERNAL_AUTH_KEY_HEADER_KEY: &str = "x-internal-auth-key";diff --git a/rust/cloud-storage/organization_service_client/src/get_users.rs b/rust/cloud-storage/organization_service_client/src/get_users.rsdeleted file mode 100644index 036a589ac3..0000000000--- a/rust/cloud-storage/organization_service_client/src/get_users.rs+++ /dev/null@@ -1,57 +0,0 @@-use macro_client_errors::{GenericErrorResponse, MacroClientError};--use super::OrganizationServiceClient;--#[derive(serde::Serialize, serde::Deserialize, Debug)]-pub struct GetUsersInternalResponse {- pub users: Vec<String>,- pub total: i64,- pub next_offset: Option<i64>,-}--impl OrganizationServiceClient {- /// Gets a paginated list of users in an organization- pub async fn get_organization_users(- &self,- organization_id: i32,- limit: i64, // max limit of 100- offset: i64,- ) -> Result<GetUsersInternalResponse, MacroClientError> {- let url = format!(- "{}/internal/organization/{}/users?limit={}&offset={}",- self.url, organization_id, limit, offset- );- let res =- self.client- .get(url)- .send()- .await- .map_err(|e| MacroClientError::RequestBuildError {- details: e.to_string(),- })?;-- match res.status() {- reqwest::StatusCode::OK => {- let result = res.json::<GetUsersInternalResponse>().await.map_err(|e| {- MacroClientError::Generic(GenericErrorResponse {- message: e.to_string(),- })- })?;-- Ok(result)- }- reqwest::StatusCode::UNAUTHORIZED => Err(MacroClientError::Unauthorized),- _ => {- let body = res.text().await.map_err(|e| {- MacroClientError::Generic(GenericErrorResponse {- message: e.to_string(),- })- })?;-- Err(MacroClientError::Generic(GenericErrorResponse {- message: body,- }))- }- }- }-}diff --git a/rust/cloud-storage/organization_service_client/src/lib.rs b/rust/cloud-storage/organization_service_client/src/lib.rsdeleted file mode 100644index 97c36d27d2..0000000000--- a/rust/cloud-storage/organization_service_client/src/lib.rs+++ /dev/null@@ -1,56 +0,0 @@-use std::collections::HashSet;--use constants::MACRO_INTERNAL_AUTH_KEY_HEADER_KEY;-use macro_client_errors::MacroClientError;--pub(crate) mod constants;-pub(crate) mod get_users;--#[derive(Clone)]-pub struct OrganizationServiceClient {- url: String,- client: reqwest::Client,-}--impl OrganizationServiceClient {- pub fn new(internal_auth_key: String, url: String) -> Self {- let mut headers = reqwest::header::HeaderMap::new();- headers.insert(- MACRO_INTERNAL_AUTH_KEY_HEADER_KEY,- internal_auth_key.parse().unwrap(),- );-- let client = reqwest::Client::builder()- .default_headers(headers)- .build()- .unwrap();-- Self { url, client }- }-- pub async fn get_all_users_in_organization(- &self,- organization_id: i32,- ) -> Result<Vec<String>, MacroClientError> {- let mut users: HashSet<String> = HashSet::new();-- let limit = 100;- let mut offset = 0;-- loop {- let result = self- .get_organization_users(organization_id, limit, offset)- .await?;-- users.extend(result.users);-- if result.next_offset.is_none() {- break;- }-- offset = result.next_offset.unwrap();- }-- Ok(users.into_iter().collect())- }-}