@@ -279,7 +279,7 @@ export default {
279
279
280
280
return await performPaidAction ( 'TERRITORY_UNARCHIVE' , data , { me, models, lnd } )
281
281
} ,
282
- updateCustomDomain : async ( parent , { subName, domain } , { me, models } ) => {
282
+ setCustomDomain : async ( parent , { subName, domain } , { me, models } ) => {
283
283
if ( ! me ) {
284
284
throw new GqlAuthenticationError ( )
285
285
}
@@ -292,28 +292,27 @@ export default {
292
292
if ( sub . userId !== me . id ) {
293
293
throw new GqlInputError ( 'you do not own this sub' )
294
294
}
295
- domain = domain . trim ( )
295
+ domain = domain . trim ( ) // protect against trailing spaces
296
296
if ( domain && ! validateSchema ( customDomainSchema , { domain } ) ) {
297
297
throw new GqlInputError ( 'Invalid domain format' )
298
298
}
299
299
300
- console . log ( 'domain' , domain )
301
- console . log ( 'sub.customDomain?.domain' , sub . customDomain ?. domain )
302
-
303
300
if ( domain ) {
304
301
const existing = await models . customDomain . findUnique ( { where : { subName } } )
305
302
if ( existing ) {
306
303
if ( domain === existing . domain ) {
307
304
throw new GqlInputError ( 'domain already set' )
308
305
}
309
- return await models . customDomain . update ( { where : { subName } , data : { domain, verificationState : 'PENDING' } } )
306
+ return await models . customDomain . update ( {
307
+ where : { subName } ,
308
+ data : { domain, dnsState : 'PENDING' , sslState : 'PENDING' }
309
+ } )
310
310
} else {
311
311
return await models . customDomain . create ( {
312
312
data : {
313
313
domain,
314
- verificationState : 'PENDING' ,
315
- cname : 'parallel.soxa.dev' ,
316
- verificationTxt : randomBytes ( 32 ) . toString ( 'base64' ) ,
314
+ cname : 'todo' , // TODO: explore other options
315
+ verificationTxt : randomBytes ( 32 ) . toString ( 'base64' ) , // TODO: explore other options
317
316
sub : {
318
317
connect : { name : subName }
319
318
}
0 commit comments