feat: fix postiz oauth
This commit is contained in:
parent
41fcb08834
commit
08c3143647
1 changed files with 30 additions and 18 deletions
|
|
@ -59,7 +59,7 @@ export class OAuthRepository {
|
|||
});
|
||||
}
|
||||
|
||||
updateApp(
|
||||
async updateApp(
|
||||
orgId: string,
|
||||
data: {
|
||||
name?: string;
|
||||
|
|
@ -68,13 +68,17 @@ export class OAuthRepository {
|
|||
redirectUrl?: string;
|
||||
}
|
||||
) {
|
||||
return this._oauthApp.model.oAuthApp.update({
|
||||
const app = await this._oauthApp.model.oAuthApp.findFirst({
|
||||
where: {
|
||||
organizationId_deletedAt: {
|
||||
organizationId: orgId,
|
||||
deletedAt: null,
|
||||
},
|
||||
organizationId: orgId,
|
||||
deletedAt: null,
|
||||
},
|
||||
});
|
||||
if (!app) {
|
||||
return null;
|
||||
}
|
||||
return this._oauthApp.model.oAuthApp.update({
|
||||
where: { id: app.id },
|
||||
data,
|
||||
include: {
|
||||
picture: true,
|
||||
|
|
@ -82,28 +86,36 @@ export class OAuthRepository {
|
|||
});
|
||||
}
|
||||
|
||||
deleteApp(orgId: string) {
|
||||
return this._oauthApp.model.oAuthApp.update({
|
||||
async deleteApp(orgId: string) {
|
||||
const app = await this._oauthApp.model.oAuthApp.findFirst({
|
||||
where: {
|
||||
organizationId_deletedAt: {
|
||||
organizationId: orgId,
|
||||
deletedAt: null,
|
||||
},
|
||||
organizationId: orgId,
|
||||
deletedAt: null,
|
||||
},
|
||||
});
|
||||
if (!app) {
|
||||
return null;
|
||||
}
|
||||
return this._oauthApp.model.oAuthApp.update({
|
||||
where: { id: app.id },
|
||||
data: {
|
||||
deletedAt: new Date(),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
updateClientSecret(orgId: string, newSecret: string) {
|
||||
return this._oauthApp.model.oAuthApp.update({
|
||||
async updateClientSecret(orgId: string, newSecret: string) {
|
||||
const app = await this._oauthApp.model.oAuthApp.findFirst({
|
||||
where: {
|
||||
organizationId_deletedAt: {
|
||||
organizationId: orgId,
|
||||
deletedAt: null,
|
||||
},
|
||||
organizationId: orgId,
|
||||
deletedAt: null,
|
||||
},
|
||||
});
|
||||
if (!app) {
|
||||
return null;
|
||||
}
|
||||
return this._oauthApp.model.oAuthApp.update({
|
||||
where: { id: app.id },
|
||||
data: {
|
||||
clientSecret: newSecret,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue