first commit
This commit is contained in:
20
frontend/types/category.ts
Normal file
20
frontend/types/category.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
export interface Category {
|
||||
id?: number; // normalized id (from simplified responses)
|
||||
ID?: number; // raw Go/GORM ID field from some admin endpoints
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
deleted_at?: string | null;
|
||||
title: string;
|
||||
slug: string;
|
||||
description?: string;
|
||||
parent_id?: number | null;
|
||||
parent?: Category; // For displaying parent name if needed
|
||||
children?: Category[]; // if nested structure is returned
|
||||
}
|
||||
|
||||
export interface CategoryListResponse {
|
||||
items: Category[];
|
||||
total: number;
|
||||
page: number;
|
||||
per_page: number;
|
||||
}
|
||||
29
frontend/types/hero.ts
Normal file
29
frontend/types/hero.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
export interface Hero {
|
||||
ID: number
|
||||
CreatedAt: string
|
||||
UpdatedAt: string
|
||||
DeletedAt: string | null
|
||||
title: string
|
||||
text1: string
|
||||
text2: string
|
||||
text4: string
|
||||
text5: string
|
||||
color: string
|
||||
image: string
|
||||
is_active: boolean
|
||||
width: number
|
||||
height: number
|
||||
quality: number
|
||||
format: string
|
||||
}
|
||||
|
||||
export interface HeroResponse {
|
||||
items: Hero[]
|
||||
page: number
|
||||
per_page: number
|
||||
total: number
|
||||
}
|
||||
|
||||
export interface HeroDetailResponse {
|
||||
data: Hero
|
||||
}
|
||||
47
frontend/types/next-auth.d.ts
vendored
Normal file
47
frontend/types/next-auth.d.ts
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
import { DefaultSession } from "next-auth"
|
||||
|
||||
declare module "next-auth" {
|
||||
/**
|
||||
* Returned by `useSession`, `getSession` and received as a prop on the `SessionProvider` React Context
|
||||
*/
|
||||
interface Session {
|
||||
user: {
|
||||
id: string
|
||||
email: string
|
||||
name: string
|
||||
is_admin: boolean
|
||||
username?: string
|
||||
accessToken?: string // Added this line
|
||||
} & DefaultSession["user"]
|
||||
accessToken?: string
|
||||
refreshToken?: string
|
||||
roles?: string[]
|
||||
error?: string
|
||||
}
|
||||
|
||||
interface User {
|
||||
id: string
|
||||
email: string
|
||||
username: string
|
||||
is_admin: boolean
|
||||
accessToken?: string
|
||||
refreshToken?: string
|
||||
roles?: string[]
|
||||
accessTokenExpires?: number
|
||||
}
|
||||
}
|
||||
|
||||
declare module "next-auth/jwt" {
|
||||
/** Returned by the `jwt` callback and `getToken`, when using JWT sessions */
|
||||
interface JWT {
|
||||
id?: string
|
||||
email?: string
|
||||
name?: string
|
||||
is_admin?: boolean
|
||||
accessToken?: string
|
||||
refreshToken?: string
|
||||
roles?: string[]
|
||||
accessTokenExpires?: number
|
||||
error?: string
|
||||
}
|
||||
}
|
||||
34
frontend/types/post.ts
Normal file
34
frontend/types/post.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Category } from "./category";
|
||||
import { Tag } from "./tag";
|
||||
|
||||
export interface Post {
|
||||
id?: number; // normalized id (frontend kullanım)
|
||||
ID?: number; // GORM model ID (backend JSON)
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
deleted_at?: string | null;
|
||||
CreatedAt?: string; // GORM model timestamp alanları
|
||||
UpdatedAt?: string;
|
||||
DeletedAt?: string | null;
|
||||
title: string;
|
||||
slug: string;
|
||||
content: string;
|
||||
images: string;
|
||||
width: number;
|
||||
height: number;
|
||||
quality: number;
|
||||
format: string;
|
||||
categories?: Category[];
|
||||
tags?: Tag[];
|
||||
}
|
||||
|
||||
export interface PostListResponse {
|
||||
items: Post[];
|
||||
page: number;
|
||||
per_page: number;
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface PostDetailResponse {
|
||||
data: Post;
|
||||
}
|
||||
44
frontend/types/setting.ts
Normal file
44
frontend/types/setting.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
export interface Setting {
|
||||
ID: number
|
||||
CreatedAt: string
|
||||
UpdatedAt: string
|
||||
DeletedAt: string | null
|
||||
title: string
|
||||
meta_title: string
|
||||
meta_description: string
|
||||
phone: string
|
||||
url: string
|
||||
email: string
|
||||
facebook: string
|
||||
x: string
|
||||
instagram: string
|
||||
whatsapp: string
|
||||
pinterest: string
|
||||
linkedin: string
|
||||
slogan: string
|
||||
address: string
|
||||
copyright: string
|
||||
map_embed: string
|
||||
w_logo: string
|
||||
b_logo: string
|
||||
is_active: boolean
|
||||
w_width: number
|
||||
w_height: number
|
||||
w_quality: number
|
||||
w_format: string
|
||||
b_width: number
|
||||
b_height: number
|
||||
b_quality: number
|
||||
b_format: string
|
||||
}
|
||||
|
||||
export interface SettingResponse {
|
||||
items: Setting[]
|
||||
total: number
|
||||
page: number
|
||||
per_page: number
|
||||
}
|
||||
|
||||
export interface SettingDetailResponse {
|
||||
data: Setting
|
||||
}
|
||||
14
frontend/types/tag.ts
Normal file
14
frontend/types/tag.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
export interface Tag {
|
||||
id: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
deleted_at: string | null;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface TagListResponse {
|
||||
items: Tag[];
|
||||
total: number;
|
||||
page: number;
|
||||
per_page: number;
|
||||
}
|
||||
26
frontend/types/user.ts
Normal file
26
frontend/types/user.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
export interface User {
|
||||
id: number;
|
||||
username: string;
|
||||
email: string;
|
||||
email_verified: boolean;
|
||||
is_admin: boolean;
|
||||
deleted_at?: string;
|
||||
}
|
||||
|
||||
export interface UserListResponse {
|
||||
items: User[] | null;
|
||||
page: number;
|
||||
per_page: number;
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface UserResponse {
|
||||
data: User;
|
||||
}
|
||||
|
||||
export interface UserPayload {
|
||||
username: string;
|
||||
email: string;
|
||||
is_admin?: boolean;
|
||||
password?: string; // Optional for updates
|
||||
}
|
||||
Reference in New Issue
Block a user