@@ -28,7 +28,6 @@ import InviteUserEmail from "./emails/inviteUserEmail";
2828import JoinRequestApprovedEmail from "./emails/joinRequestApprovedEmail" ;
2929import JoinRequestSubmittedEmail from "./emails/joinRequestSubmittedEmail" ;
3030import { AGENTIC_SEARCH_TUTORIAL_DISMISSED_COOKIE_NAME , MOBILE_UNSUPPORTED_SPLASH_SCREEN_DISMISSED_COOKIE_NAME , SINGLE_TENANT_ORG_DOMAIN , SOURCEBOT_GUEST_USER_ID , SOURCEBOT_SUPPORT_EMAIL } from "./lib/constants" ;
31- import { orgDomainSchema , orgNameSchema } from "./lib/schemas" ;
3231import { ApiKeyPayload , RepositoryQuery , TenancyMode } from "./lib/types" ;
3332import { withAuthV2 , withOptionalAuthV2 } from "./withAuthV2" ;
3433import { getBrowsePath } from "./app/[domain]/browse/hooks/utils" ;
@@ -186,54 +185,6 @@ export const withTenancyModeEnforcement = async<T>(mode: TenancyMode, fn: () =>
186185}
187186
188187////// Actions ///////
189-
190- export const updateOrgName = async ( name : string , domain : string ) => sew ( ( ) =>
191- withAuth ( ( userId ) =>
192- withOrgMembership ( userId , domain , async ( { org } ) => {
193- const { success } = orgNameSchema . safeParse ( name ) ;
194- if ( ! success ) {
195- return {
196- statusCode : StatusCodes . BAD_REQUEST ,
197- errorCode : ErrorCode . INVALID_REQUEST_BODY ,
198- message : "Invalid organization url" ,
199- } satisfies ServiceError ;
200- }
201-
202- await prisma . org . update ( {
203- where : { id : org . id } ,
204- data : { name } ,
205- } ) ;
206-
207- return {
208- success : true ,
209- }
210- } , /* minRequiredRole = */ OrgRole . OWNER )
211- ) ) ;
212-
213- export const updateOrgDomain = async ( newDomain : string , existingDomain : string ) => sew ( ( ) =>
214- withTenancyModeEnforcement ( 'multi' , ( ) =>
215- withAuth ( ( userId ) =>
216- withOrgMembership ( userId , existingDomain , async ( { org } ) => {
217- const { success } = await orgDomainSchema . safeParseAsync ( newDomain ) ;
218- if ( ! success ) {
219- return {
220- statusCode : StatusCodes . BAD_REQUEST ,
221- errorCode : ErrorCode . INVALID_REQUEST_BODY ,
222- message : "Invalid organization url" ,
223- } satisfies ServiceError ;
224- }
225-
226- await prisma . org . update ( {
227- where : { id : org . id } ,
228- data : { domain : newDomain } ,
229- } ) ;
230-
231- return {
232- success : true ,
233- }
234- } , /* minRequiredRole = */ OrgRole . OWNER )
235- ) ) ) ;
236-
237188export const completeOnboarding = async ( domain : string ) : Promise < { success : boolean } | ServiceError > => sew ( ( ) =>
238189 withAuth ( ( userId ) =>
239190 withOrgMembership ( userId , domain , async ( { org } ) => {
@@ -1164,18 +1115,6 @@ export const getInviteInfo = async (inviteId: string) => sew(() =>
11641115 }
11651116 } ) ) ;
11661117
1167- export const checkIfOrgDomainExists = async ( domain : string ) : Promise < boolean | ServiceError > => sew ( ( ) =>
1168- withAuth ( async ( ) => {
1169- const org = await prisma . org . findFirst ( {
1170- where : {
1171- domain,
1172- }
1173- } ) ;
1174-
1175- return ! ! org ;
1176- } ) ) ;
1177-
1178-
11791118export const getOrgMembers = async ( domain : string ) => sew ( ( ) =>
11801119 withAuth ( async ( userId ) =>
11811120 withOrgMembership ( userId , domain , async ( { org } ) => {
0 commit comments