aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/database.ts5
-rw-r--r--src/server/index.ts5
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;