Commit f57c1278 authored by Anthony Jacob's avatar Anthony Jacob
Browse files

centralize type

parent 52b701ce
Loading
Loading
Loading
Loading
+200 −0
Original line number Diff line number Diff line

import type { JwtPayload } from "jsonwebtoken";

export type AboutTranslation = {
    language_code: string;
    content: string;
    picture?: string;
};

export type EnabledLanguage = {
    languages?: { language_code: string; enabled: boolean }[]
}

export interface ClientAboutProps {
    data: { abouts?: { translations?: AboutTranslation[]; picture?: string }[] };
    enabledLanguage: EnabledLanguage;
}

export type ApiKey = {
    id: number;
    api_key: string;
    is_valid: boolean;
    label: string;
    last_usage: Date | null;
    valid_until: Date;
}

export interface ClientApiKeyEditProps {
    data: ApiKey;
}

export interface ClientApiKeyListProps {
    data: {
        apikeys?: ApiKey[];
    }
}

export type DiplomaTranslation = {
    language_code: string;
    title: string;
    description: string;
    link: string;
    link_text: string;
};

export type Diploma = {
    id: number;
    start_date?: string | null;
    end_date?: string | null;
    translations?: DiplomaTranslation[];
};

export interface DiplomaListClientProps {
    data: { diplomas?: Diploma[] };
}

export type DiplomaTranslationAlt = {
    [language_code: string]: DiplomaTranslation;
};

export interface ClientDiplomaEditProps {
    data: Diploma;
    enabledLanguage: EnabledLanguage;
}


export type ExperienceTranslation = {
    job_title: string;
    language_code: string;
    job_description: string;
    job_place: string;
};

export type ExperienceTranslations = {
    [language_code: string]: ExperienceTranslation;
};

export type Experience = {
    id: number;
    start_date?: string | null;
    end_date?: string | null;
    translations?: ExperienceTranslation[];
};

export interface ExperienceEditPageClientProps {
    data: Experience & { logo?: string; website?: string };
    enabledLanguage: EnabledLanguage;
}

export interface ExperienceListClientProps {
    data: { experiences?: Experience[] };
}


export type Keyword = {
    id: number;
    keyword: string;
    language_code: string;
    position: number;
}

export interface KeywordListClientProps {
    data: { keywords?: Keyword[] };
    enabledLanguage: EnabledLanguage;
}

export interface SortableRowProps {
    keyword: Keyword;
    handleSelect: (id: number, checked: boolean) => void;
    selectedKeyword: Record<number, boolean>;
    onEdit: (keyword: Keyword) => void;
    isEditing: boolean;
    editingValue: string;
    setEditingValue: (v: string) => void;
    onSaveEdit: (keyword: Keyword) => void;
    onCancelEdit: () => void;
    savingEdit: boolean;
    suppressHydrationWarning?: boolean;
}

export type Language = {
    id: number;
    language_code: string;
    enabled: boolean;
};

export interface LanguageListProps {
    data: { languages?: Language[] };
}


export type Resume = {
    language_code: string;
    file: string;
}

export type ResumeData = {
    resumes?: Resume[];
}

export interface ClientResumeProps {
    data: ResumeData;
    enabledLanguage: EnabledLanguage;
}


export type ServiceTranslation = {
    title: string;
    language_code: string;
    content: string;
};

export type ServiceTranslations = {
    [language_code: string]: ServiceTranslation;
};


export type Service = {
    id: number;
    start_date?: string | null;
    end_date?: string | null;
    translations?: ServiceTranslation[];
    logo?: string | null;
    position?: number; // Added position property
};

export interface ServiceListClientProps {
    data: { services?: Service[] };
}

export interface ServiceEditPageClientProps {
    data: Service;
    enabledLanguage: EnabledLanguage;
}

export type User = {
    id: number;
    login: string;
    last_login: string;
    is_active: boolean;
    password: string;
    force_jwt_reconnect: boolean;
};


export type MyJwtPayload = JwtPayload & {
    sub?: {
        username?: string;
        id?: number;
    }
}

export interface UserListClientProps {
    data: { users?: User[] },
    connectedUser: MyJwtPayload | null;
}

export interface USerEditPageClientProps {
    data: User;
}
 No newline at end of file