From 12f5b4ff0f82bd17ecab4a8970894a5ee0ab1277 Mon Sep 17 00:00:00 2001 From: Lucas Jensen Date: Sun, 1 Dec 2024 19:29:03 -0800 Subject: [PATCH] cleanup TS type imports, remove programmatic version info --- client/src/Api.tsx | 14 ++++++-------- client/src/App.tsx | 15 +++++++-------- client/src/types/MeganJohns.tsx | 11 +++++------ server/app/controller/controller.py | 6 ------ server/app/main.py | 7 ------- 5 files changed, 18 insertions(+), 35 deletions(-) diff --git a/client/src/Api.tsx b/client/src/Api.tsx index d70531e..1ee47eb 100644 --- a/client/src/Api.tsx +++ b/client/src/Api.tsx @@ -1,10 +1,10 @@ import axios from "axios"; -import { MeganJohns } from "./types/MeganJohns"; -import { Artwork } from "./types/Artwork"; -import { Quote } from "./types/Quote"; -import { Video } from "./types/Video"; -import { Album } from "./types/Album"; -import { Bio, ProfessionalService } from "./types/Bio"; +import type { MeganJohns } from "./types/MeganJohns"; +import type { Artwork } from "./types/Artwork"; +import type { Quote } from "./types/Quote"; +import type { Video } from "./types/Video"; +import type { Album } from "./types/Album"; +import type { Bio, ProfessionalService } from "./types/Bio"; const baseURL = import.meta.env.VITE_API_URL as string; @@ -19,7 +19,6 @@ export const getMeganJohns = async (): Promise => { const bio = response.data.bio as Bio; const professional_services = response.data .professional_services as ProfessionalService[]; - const version = response.data.version as string; return { artwork, videos, @@ -27,6 +26,5 @@ export const getMeganJohns = async (): Promise => { quotes, bio, professional_services, - version, } as MeganJohns; }; diff --git a/client/src/App.tsx b/client/src/App.tsx index b36657b..b9ad305 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -1,11 +1,11 @@ import { useEffect, useState } from "react"; import { getMeganJohns } from "./Api"; -import { MeganJohns } from "./types/MeganJohns"; -import { Album } from "./types/Album"; -import { Artwork } from "./types/Artwork"; -import { Quote } from "./types/Quote"; -import { Video } from "./types/Video"; -import { Bio, ProfessionalService } from "./types/Bio"; +import type { MeganJohns } from "./types/MeganJohns"; +import type { Album } from "./types/Album"; +import type { Artwork } from "./types/Artwork"; +import type { Quote } from "./types/Quote"; +import type { Video } from "./types/Video"; +import type { Bio, ProfessionalService } from "./types/Bio"; import MjSection from "./MjSection"; import Header from "./Header/Header"; import About from "./About/Homepage"; @@ -29,7 +29,7 @@ function App() { }, (error) => { console.error(error); - }, + } ); }, []); @@ -56,7 +56,6 @@ function App() { -

{mj.version}

); diff --git a/client/src/types/MeganJohns.tsx b/client/src/types/MeganJohns.tsx index 0cda1e3..9513f32 100644 --- a/client/src/types/MeganJohns.tsx +++ b/client/src/types/MeganJohns.tsx @@ -1,8 +1,8 @@ -import { Album } from "./Album"; -import { Artwork } from "./Artwork"; -import { Bio, ProfessionalService } from "./Bio"; -import { Quote } from "./Quote"; -import { Video } from "./Video"; +import type { Album } from "./Album"; +import type { Artwork } from "./Artwork"; +import type { Bio, ProfessionalService } from "./Bio"; +import type { Quote } from "./Quote"; +import type { Video } from "./Video"; export interface MeganJohns { artwork: Artwork[]; @@ -11,5 +11,4 @@ export interface MeganJohns { quotes: Quote[]; bio: Bio; professional_services: ProfessionalService[]; - version: string; } diff --git a/server/app/controller/controller.py b/server/app/controller/controller.py index cf4cd31..fc514a1 100644 --- a/server/app/controller/controller.py +++ b/server/app/controller/controller.py @@ -12,12 +12,6 @@ class Controller: def __init__(self) -> None: pass - async def get_version(self) -> str: - repo = Repo(Path.cwd().parent.joinpath(".git")) - tags = [tag.tag for tag in repo.tags if tag.tag is not None] - tags.sort(key=lambda t: t.tagged_date) - return tags[-1].tag - async def get_all_videos(self) -> list[Video]: return Video.select_all() diff --git a/server/app/main.py b/server/app/main.py index 9497c78..b7f8a73 100644 --- a/server/app/main.py +++ b/server/app/main.py @@ -43,7 +43,6 @@ class MeganJohns(BaseModel): videos: list[Video] bio: Bio professional_services: list[ProfessionalService] - version: str @app.get("/") @@ -63,10 +62,4 @@ async def root() -> MeganJohns: videos=videos, bio=bio, professional_services=services, - version=await controller.get_version(), ) - - -@app.get("/version") -async def version() -> str: - return await controller.get_version()