cleanup TS type imports, remove programmatic version info

This commit is contained in:
Lucas Jensen
2024-12-01 19:29:03 -08:00
parent 925b334e4c
commit 12f5b4ff0f
5 changed files with 18 additions and 35 deletions

View File

@@ -1,10 +1,10 @@
import axios from "axios"; import axios from "axios";
import { MeganJohns } from "./types/MeganJohns"; import type { MeganJohns } from "./types/MeganJohns";
import { Artwork } from "./types/Artwork"; import type { Artwork } from "./types/Artwork";
import { Quote } from "./types/Quote"; import type { Quote } from "./types/Quote";
import { Video } from "./types/Video"; import type { Video } from "./types/Video";
import { Album } from "./types/Album"; import type { Album } from "./types/Album";
import { Bio, ProfessionalService } from "./types/Bio"; import type { Bio, ProfessionalService } from "./types/Bio";
const baseURL = import.meta.env.VITE_API_URL as string; const baseURL = import.meta.env.VITE_API_URL as string;
@@ -19,7 +19,6 @@ export const getMeganJohns = async (): Promise<MeganJohns> => {
const bio = response.data.bio as Bio; const bio = response.data.bio as Bio;
const professional_services = response.data const professional_services = response.data
.professional_services as ProfessionalService[]; .professional_services as ProfessionalService[];
const version = response.data.version as string;
return { return {
artwork, artwork,
videos, videos,
@@ -27,6 +26,5 @@ export const getMeganJohns = async (): Promise<MeganJohns> => {
quotes, quotes,
bio, bio,
professional_services, professional_services,
version,
} as MeganJohns; } as MeganJohns;
}; };

View File

@@ -1,11 +1,11 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { getMeganJohns } from "./Api"; import { getMeganJohns } from "./Api";
import { MeganJohns } from "./types/MeganJohns"; import type { MeganJohns } from "./types/MeganJohns";
import { Album } from "./types/Album"; import type { Album } from "./types/Album";
import { Artwork } from "./types/Artwork"; import type { Artwork } from "./types/Artwork";
import { Quote } from "./types/Quote"; import type { Quote } from "./types/Quote";
import { Video } from "./types/Video"; import type { Video } from "./types/Video";
import { Bio, ProfessionalService } from "./types/Bio"; import type { Bio, ProfessionalService } from "./types/Bio";
import MjSection from "./MjSection"; import MjSection from "./MjSection";
import Header from "./Header/Header"; import Header from "./Header/Header";
import About from "./About/Homepage"; import About from "./About/Homepage";
@@ -29,7 +29,7 @@ function App() {
}, },
(error) => { (error) => {
console.error(error); console.error(error);
}, }
); );
}, []); }, []);
@@ -56,7 +56,6 @@ function App() {
<MjSection sectionTitle="artwork" works={artwork} /> <MjSection sectionTitle="artwork" works={artwork} />
<Videos videos={videos} /> <Videos videos={videos} />
<About bio={bio} quotes={quotes} services={services} /> <About bio={bio} quotes={quotes} services={services} />
<p>{mj.version}</p>
</Container> </Container>
</Container> </Container>
); );

View File

@@ -1,8 +1,8 @@
import { Album } from "./Album"; import type { Album } from "./Album";
import { Artwork } from "./Artwork"; import type { Artwork } from "./Artwork";
import { Bio, ProfessionalService } from "./Bio"; import type { Bio, ProfessionalService } from "./Bio";
import { Quote } from "./Quote"; import type { Quote } from "./Quote";
import { Video } from "./Video"; import type { Video } from "./Video";
export interface MeganJohns { export interface MeganJohns {
artwork: Artwork[]; artwork: Artwork[];
@@ -11,5 +11,4 @@ export interface MeganJohns {
quotes: Quote[]; quotes: Quote[];
bio: Bio; bio: Bio;
professional_services: ProfessionalService[]; professional_services: ProfessionalService[];
version: string;
} }

View File

@@ -12,12 +12,6 @@ class Controller:
def __init__(self) -> None: def __init__(self) -> None:
pass 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]: async def get_all_videos(self) -> list[Video]:
return Video.select_all() return Video.select_all()

View File

@@ -43,7 +43,6 @@ class MeganJohns(BaseModel):
videos: list[Video] videos: list[Video]
bio: Bio bio: Bio
professional_services: list[ProfessionalService] professional_services: list[ProfessionalService]
version: str
@app.get("/") @app.get("/")
@@ -63,10 +62,4 @@ async def root() -> MeganJohns:
videos=videos, videos=videos,
bio=bio, bio=bio,
professional_services=services, professional_services=services,
version=await controller.get_version(),
) )
@app.get("/version")
async def version() -> str:
return await controller.get_version()