fix(medusa): Remove atomicPhase usage in OAuthService (#2249)
This commit is contained in:
1 parent
74342fc1ea
commit
7e56935e7a
1 file changed
+14
-18
@@ -79,31 +79,27 @@ class Oauth extends TransactionBaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async create(data: CreateOauthInput): Promise<OAuthModel> {
|
async create(data: CreateOauthInput): Promise<OAuthModel> {
|
||||||
return await this.atomicPhase_(async (manager) => {
|
const repo = this.manager.getCustomRepository(this.oauthRepository_)
|
||||||
const repo = manager.getCustomRepository(this.oauthRepository_)
|
|
||||||
|
|
||||||
const application = repo.create({
|
const application = repo.create({
|
||||||
display_name: data.display_name,
|
display_name: data.display_name,
|
||||||
application_name: data.application_name,
|
application_name: data.application_name,
|
||||||
install_url: data.install_url,
|
install_url: data.install_url,
|
||||||
uninstall_url: data.uninstall_url,
|
uninstall_url: data.uninstall_url,
|
||||||
})
|
|
||||||
|
|
||||||
return await repo.save(application)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
return await repo.save(application)
|
||||||
}
|
}
|
||||||
|
|
||||||
async update(id: string, update: UpdateOauthInput): Promise<OAuthModel> {
|
async update(id: string, update: UpdateOauthInput): Promise<OAuthModel> {
|
||||||
return await this.atomicPhase_(async (manager) => {
|
const repo = this.manager.getCustomRepository(this.oauthRepository_)
|
||||||
const repo = manager.getCustomRepository(this.oauthRepository_)
|
const oauth = await this.retrieve(id)
|
||||||
const oauth = await this.retrieve(id)
|
|
||||||
|
|
||||||
if ("data" in update) {
|
if ("data" in update) {
|
||||||
oauth.data = update.data
|
oauth.data = update.data
|
||||||
}
|
}
|
||||||
|
|
||||||
return await repo.save(oauth)
|
return await repo.save(oauth)
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async registerOauthApp(appDetails: CreateOauthInput): Promise<OAuthModel> {
|
async registerOauthApp(appDetails: CreateOauthInput): Promise<OAuthModel> {
|
||||||
|
|||||||
Reference in new issue
Block a user