From a121a39c900d695c9359f6e0d49869f5a800b61f Mon Sep 17 00:00:00 2001 From: Bhupesh-MS Date: Thu, 29 Aug 2024 13:10:48 +0530 Subject: [PATCH] update profile backend changes --- .../src/http/profile.test.ts | 5 ++--- .../offchain-resolver/src/http/profile.ts | 19 ------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/packages/offchain-resolver/src/http/profile.test.ts b/packages/offchain-resolver/src/http/profile.test.ts index 4e2293002..01e7c0089 100644 --- a/packages/offchain-resolver/src/http/profile.test.ts +++ b/packages/offchain-resolver/src/http/profile.test.ts @@ -260,7 +260,7 @@ describe('Profile', () => { expect(body.error).to.equal('invalid profile'); }); - it('Rejects if subdomain has already a profile', async () => { + it('Updates profile if subdomain has already a profile', async () => { app.use(profile(provider)); const offChainProfile1 = await getSignedUserProfile(); @@ -291,8 +291,7 @@ describe('Profile', () => { subdomain: 'beta-addr.dm3.eth', }); - expect(res2.status).to.equal(400); - expect(res2.body.error).to.eql('subdomain already claimed'); + expect(res2.status).to.equal(200); }); it('Rejects if subdomain is not supported', async () => { app.use(profile(provider)); diff --git a/packages/offchain-resolver/src/http/profile.ts b/packages/offchain-resolver/src/http/profile.ts index 22026a31b..301ab596c 100644 --- a/packages/offchain-resolver/src/http/profile.ts +++ b/packages/offchain-resolver/src/http/profile.ts @@ -267,16 +267,6 @@ export function profile(web3Provider: ethers.providers.BaseProvider) { return res.status(400).send({ error: 'invalid profile' }); } - const hasAddressProfile = - !!(await req.app.locals.db.getProfileContainer(address)); - - //One address can only claim one subdomain - if (hasAddressProfile) { - return res.status(400).send({ - error: 'address has already claimed a subdomain', - }); - } - const name = `${address}.${subdomain}`; //ask the subdomain manager if the names subdomain is supported @@ -286,15 +276,6 @@ export function profile(web3Provider: ethers.providers.BaseProvider) { }); } - const profileExists = - !!(await req.app.locals.db.getProfileContainer(name)); - - if (profileExists) { - return res - .status(400) - .send({ error: 'subdomain already claimed' }); - } - await req.app.locals.db.setUserProfile( name, signedUserProfile,