Files
calendar/packages/app-store/_utils/oauth/markTokenAsExpired.ts
T
d47c6b3fdb fix: Credential Syncing Improvements (#14588)
* Add example app to test credential sync

* Fixes

* Changes to normalize flow of GoogleCalendar and Zoom

* Add unit tests

* PR Feedback

* credential-sync-more-tests-and-more-apps

* Fix yarn.lock

* Clear cache

* Add test

* Fix yarn.lock

* Fix 204 handling

* Fix yarn.lock

---------

Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
2024-04-25 12:47:17 -04:00

22 lines
595 B
TypeScript

import prisma from "@calcom/prisma";
import type { CredentialPayload } from "@calcom/types/Credential";
import { getTokenObjectFromCredential } from "./getTokenObjectFromCredential";
export const markTokenAsExpired = async (credential: CredentialPayload) => {
const tokenResponse = getTokenObjectFromCredential(credential);
if (credential && credential.key) {
await prisma.credential.update({
where: {
id: credential.id,
},
data: {
key: {
...tokenResponse,
expiry_date: Date.now() - 3600 * 1000,
},
},
});
}
};