diff --git a/backend/src/auth/jobs/jobs.service.ts b/backend/src/auth/jobs/jobs.service.ts
index 58334d4..688d2f3 100644
--- a/backend/src/auth/jobs/jobs.service.ts
+++ b/backend/src/auth/jobs/jobs.service.ts
@@ -6,37 +6,39 @@ import * as moment from "moment";
@Injectable()
export class JobsService {
- constructor(
- private prisma: PrismaService,
- private fileService: FileService
- ) {
+ constructor(
+ private prisma: PrismaService,
+ private fileService: FileService
+ ) {}
+
+ @Cron("0 * * * *")
+ async deleteExpiredShares() {
+ const expiredShares = await this.prisma.share.findMany({
+ where: {
+ // We want to remove only shares that have an expiration date less than the current date, but not 0
+ AND: [
+ { expiration: { lt: new Date() } },
+ { expiration: { not: moment(0).toDate() } },
+ ],
+ },
+ });
+
+ for (const expiredShare of expiredShares) {
+ await this.prisma.share.delete({
+ where: { id: expiredShare.id },
+ });
+
+ await this.fileService.deleteAllFiles(expiredShare.id);
}
- @Cron("0 * * * *")
- async deleteExpiredShares() {
- const expiredShares = await this.prisma.share.findMany({
- where: {
- // We want to remove only shares that have an expiration date less than the current date, but not 0
- AND: [{expiration: {lt: new Date()}}, {expiration: {not: moment(0).toDate()}}]
- },
- });
+ console.log(`job: deleted ${expiredShares.length} expired shares`);
+ }
- for (const expiredShare of expiredShares) {
- await this.prisma.share.delete({
- where: {id: expiredShare.id},
- });
-
- await this.fileService.deleteAllFiles(expiredShare.id);
- }
-
- console.log(`job: deleted ${expiredShares.length} expired shares`);
- }
-
- @Cron("0 * * * *")
- async deleteExpiredRefreshTokens() {
- const expiredShares = await this.prisma.refreshToken.deleteMany({
- where: {expiresAt: {lt: new Date()}},
- });
- console.log(`job: deleted ${expiredShares.count} expired refresh tokens`);
- }
+ @Cron("0 * * * *")
+ async deleteExpiredRefreshTokens() {
+ const expiredShares = await this.prisma.refreshToken.deleteMany({
+ where: { expiresAt: { lt: new Date() } },
+ });
+ console.log(`job: deleted ${expiredShares.count} expired refresh tokens`);
+ }
}
diff --git a/backend/src/share/guard/shareSecurity.guard.ts b/backend/src/share/guard/shareSecurity.guard.ts
index b768452..028689c 100644
--- a/backend/src/share/guard/shareSecurity.guard.ts
+++ b/backend/src/share/guard/shareSecurity.guard.ts
@@ -34,7 +34,11 @@ export class ShareSecurityGuard implements CanActivate {
include: { security: true },
});
- if (!share || (moment().isAfter(share.expiration) && moment(share.expiration).unix() !== 0))
+ if (
+ !share ||
+ (moment().isAfter(share.expiration) &&
+ moment(share.expiration).unix() !== 0)
+ )
throw new NotFoundException("Share not found");
if (share.security?.password && !shareToken)
diff --git a/frontend/package.json b/frontend/package.json
index 4042ea7..fe0793f 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -6,7 +6,7 @@
"build": "next build",
"start": "dotenv next start",
"lint": "next lint",
- "format": "prettier --write \"src/**/*.ts\""
+ "format": "prettier --write \"src/**/*.ts*\""
},
"dependencies": {
"@emotion/react": "^11.10.4",
diff --git a/frontend/src/components/Footer.tsx b/frontend/src/components/Footer.tsx
index dc6eeb4..869e795 100644
--- a/frontend/src/components/Footer.tsx
+++ b/frontend/src/components/Footer.tsx
@@ -5,7 +5,10 @@ const Footer = () => {