diff options
author | Sam Wilkins <samwilkins333@gmail.com> | 2019-09-26 22:30:26 -0400 |
---|---|---|
committer | Sam Wilkins <samwilkins333@gmail.com> | 2019-09-26 22:30:26 -0400 |
commit | 2e61db73a1fcba3b87cc84a7d1af51617f6a02f6 (patch) | |
tree | cda9beea579fe25edecfc44525874490ca1ecd3b /src | |
parent | 20540a35be82c34cc3962de4f957d1aa43f8a2b0 (diff) |
added route for deleting google credentials
Diffstat (limited to 'src')
-rw-r--r-- | src/server/database.ts | 5 | ||||
-rw-r--r-- | src/server/index.ts | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/server/database.ts b/src/server/database.ts index bc9a9ab23..969437818 100644 --- a/src/server/database.ts +++ b/src/server/database.ts @@ -230,7 +230,6 @@ export namespace Database { GooglePhotosUploadHistory = "uploadedFromGooglePhotos" } - const SanitizedCappedQuery = async (query: { [key: string]: any }, collection: string, cap: number, removeId = true) => { const cursor = await Instance.query(query, undefined, collection); const results = await cursor.toArray(); @@ -259,7 +258,7 @@ export namespace Database { }; export const Write = async (userId: string, token: any) => { - return Instance.insert({ userId, ...token }, GoogleAuthentication); + return Instance.insert({ userId, canAccess: [], ...token }, GoogleAuthentication); }; export const Update = async (userId: string, access_token: string, expiry_date: number) => { @@ -270,6 +269,8 @@ export namespace Database { } }; + export const DeleteAll = () => Instance.deleteAll(GoogleAuthentication, false); + } export const LogUpload = async (information: DashUploadUtils.UploadInformation) => { diff --git a/src/server/index.ts b/src/server/index.ts index 33d098e2c..ecfeaa5fa 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -892,6 +892,11 @@ app.get("/deleteWithAux", async (req, res) => { res.redirect(RouteStore.delete); }); +app.get("/deleteWithGoogleCredentials", async (req, res) => { + await Database.Auxiliary.GoogleAuthenticationToken.DeleteAll(); + res.redirect(RouteStore.delete); +}); + const UploadError = (count: number) => `Unable to upload ${count} images to Dash's server`; app.post(RouteStore.googlePhotosMediaDownload, async (req, res) => { const contents: { mediaItems: MediaItem[] } = req.body; |