From e91c43fa683299d7bd0d64b7b7abb63f56a454f1 Mon Sep 17 00:00:00 2001 From: TED Vortex Date: Wed, 10 May 2023 16:50:27 +0200 Subject: [PATCH] fix: correct rolled back build --- .eslintrc.js | 1 - src/github/entities/db-reaction.entity.ts | 4 ++++ .../github/entities/db-user-highlight.entity.ts | 7 +------ src/s3-file-storage/s3-file-storage.service.ts | 1 + .../highlight-card/highlight-card.service.ts | 12 ++++++++++-- src/social-card/user-card/user-card.service.ts | 9 +++++++-- typings/RequiresUpdateMeta.ts | 7 ------- 7 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 src/github/entities/db-reaction.entity.ts rename typings/global.d.ts => src/github/entities/db-user-highlight.entity.ts (74%) delete mode 100644 typings/RequiresUpdateMeta.ts diff --git a/.eslintrc.js b/.eslintrc.js index 14e1696..bc524e9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -38,7 +38,6 @@ module.exports = { "public", "/**/node_modules/*", ".eslintrc.js", - "migrations", ], rules: { // eslint:recommended diff --git a/src/github/entities/db-reaction.entity.ts b/src/github/entities/db-reaction.entity.ts new file mode 100644 index 0000000..608964b --- /dev/null +++ b/src/github/entities/db-reaction.entity.ts @@ -0,0 +1,4 @@ +export interface DbReaction { + emoji_id: string; + reaction_count: string; +} diff --git a/typings/global.d.ts b/src/github/entities/db-user-highlight.entity.ts similarity index 74% rename from typings/global.d.ts rename to src/github/entities/db-user-highlight.entity.ts index dbd449f..0f1a643 100644 --- a/typings/global.d.ts +++ b/src/github/entities/db-user-highlight.entity.ts @@ -1,4 +1,4 @@ -interface DbHighlight { +export interface DbUserHighlight { readonly id: string; readonly user_id: string; readonly url: string; @@ -10,8 +10,3 @@ interface DbHighlight { readonly deleted_at: string | null; readonly login: string; } - -interface DbReaction { - emoji_id: string; - reaction_count: string; -} diff --git a/src/s3-file-storage/s3-file-storage.service.ts b/src/s3-file-storage/s3-file-storage.service.ts index 6ee89ad..400e454 100644 --- a/src/s3-file-storage/s3-file-storage.service.ts +++ b/src/s3-file-storage/s3-file-storage.service.ts @@ -5,6 +5,7 @@ import { Readable } from "node:stream"; import DigitalOceanConfig from "../config/digital-ocean.config"; + @Injectable() export class S3FileStorageService { private readonly s3Client: S3Client; diff --git a/src/social-card/highlight-card/highlight-card.service.ts b/src/social-card/highlight-card/highlight-card.service.ts index e0f6667..74cdd99 100644 --- a/src/social-card/highlight-card/highlight-card.service.ts +++ b/src/social-card/highlight-card/highlight-card.service.ts @@ -11,7 +11,9 @@ import userProfileRepos from "../templates/shared/user-repos"; import tailwindConfig from "../templates/tailwind.config"; import { firstValueFrom } from "rxjs"; import highlightCardTemplate from "../templates/highlight-card.template"; -import RequiresUpdateMeta from "../../../typings/RequiresUpdateMeta"; +import { DbUserHighlight } from "../../github/entities/db-user-highlight.entity"; +import { DbReaction } from "../../github/entities/db-reaction.entity"; +import { RequiresUpdateMeta } from "../user-card/user-card.service"; interface HighlightCardData { title: string, @@ -38,7 +40,13 @@ export class HighlightCardService { ) {} private async getHighlightData (highlightId: number): Promise { - const highlightReq = await firstValueFrom(this.httpService.get(`https://api.opensauced.pizza/v1/user/highlights/${highlightId}`)); + const langs: Record = {}; + const today = (new Date); + const today30daysAgo = new Date((new Date).setDate(today.getDate() - 30)); + + const highlightReq = await firstValueFrom(this.httpService.get(`https://api.opensauced.pizza/v1/user/highlights/${highlightId}`)); const { login, title, highlight: body, updated_at, url } = highlightReq.data; const reactionsReq = await firstValueFrom(this.httpService.get(`https://api.opensauced.pizza/v1/highlights/${highlightId}/reactions`)); diff --git a/src/social-card/user-card/user-card.service.ts b/src/social-card/user-card/user-card.service.ts index 7d93ea0..4406c57 100644 --- a/src/social-card/user-card/user-card.service.ts +++ b/src/social-card/user-card/user-card.service.ts @@ -11,9 +11,8 @@ import userLangs from "../templates/shared/user-langs"; import userProfileRepos from "../templates/shared/user-repos"; import userProfileCardTemplate from "../templates/user-profile-card.template"; import tailwindConfig from "../templates/tailwind.config"; -import RequiresUpdateMeta from "../../../typings/RequiresUpdateMeta"; -interface UserCardData { +export interface UserCardData { id: User["databaseId"], name: User["name"], langs: (Language & { @@ -25,6 +24,12 @@ interface UserCardData { formattedName: string, } +export interface RequiresUpdateMeta { + fileUrl: string, + hasFile: boolean; + needsUpdate: boolean; + lastModified: Date | null, +} @Injectable() export class UserCardService { diff --git a/typings/RequiresUpdateMeta.ts b/typings/RequiresUpdateMeta.ts deleted file mode 100644 index 1165248..0000000 --- a/typings/RequiresUpdateMeta.ts +++ /dev/null @@ -1,7 +0,0 @@ - -export default interface RequiresUpdateMeta { - fileUrl: string, - hasFile: boolean; - needsUpdate: boolean; - lastModified: Date | null, -}