minhnt-dev: article api
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
interface Base {
|
||||
createdBy?: string | number
|
||||
createdOn?: string
|
||||
updatedBy?: string | number
|
||||
updatedOn?: string
|
||||
}
|
||||
interface Article extends Base {
|
||||
id?: number; // ID của bài viết
|
||||
siteId?: number; // ID của trang web
|
||||
articleId?: number; // ID của bài viết
|
||||
originalId?: number; // ID còn bài viết gốc
|
||||
sub?: string; // Tiêu đề phụ
|
||||
title?: string; // Tiêu đề
|
||||
slug?: string; // Đường dẫn thân thiện cho SEO
|
||||
code?: string; // Mã bài viết
|
||||
intro?: string; // Phần giới thiệu
|
||||
brief?: string; // Tóm tắt
|
||||
detail?: string; // Nội dung chi tiết
|
||||
summary?: string; // Tóm tắt ngắn gọn
|
||||
thumbnail?: string; // Đường dẫn hình ảnh đại diện
|
||||
represent?: string; // Đại diện cho bài viết
|
||||
redirect?: string; // Đường dẫn chuyển hướng
|
||||
keywords?: string; // Từ khóa
|
||||
description?: string; // Mô tả
|
||||
type?: number; // Loại bài viết
|
||||
layoutType?: number; // Loại giao diện
|
||||
contentType?: number; // Loại nội dung
|
||||
priority?: number; // Ưu tiên
|
||||
features?: string; // Các tính năng
|
||||
taxonomy?: string; // Phân loại
|
||||
interaction?: string; // Tương tác
|
||||
language?: string; // Ngôn ngữ
|
||||
settings?: string; // Các tùy chọn
|
||||
categoryId?: number; // ID của danh mục
|
||||
categoryIds?: string; // Các ID danh mục liên quan
|
||||
topicIds?: string; // Các ID chủ đề liên quan
|
||||
eventIds?: string; // Các ID sự kiện liên quan
|
||||
collectionIds?: string; // Các ID bộ sưu tập liên quan
|
||||
urlIds?: string; // Các ID URL liên quan
|
||||
sourceIds?: string; // Các ID nguồn liên quan
|
||||
relatedArticleIds?: string; // Các ID liên quan
|
||||
advertisementIds?: string; // Các ID quảng cáo liên quan
|
||||
attachmentIds?: string; // Các ID tệp đính kèm liên quan
|
||||
authorIds?: string; // Các ID tác giả liên quan
|
||||
views?: number; // Số lượt xem
|
||||
likes?: number; // Số lượt thích
|
||||
rates?: number; // Đánh giá
|
||||
follows?: number; // Số lượt theo dõi
|
||||
shares?: number; // Số lượt chia sẻ
|
||||
reports?: number; // Số lượt báo cáo
|
||||
comments?: number; // Số lượt bình luận
|
||||
statistics?: string; // Thống kê khác
|
||||
isPublished?: boolean; // Đã xuất bản hay chưa
|
||||
publishedBy?: number; // ID người xuất bản
|
||||
publishedOn?: Date; // Ngày xuất bản
|
||||
expiresOn?: Date; // Ngày hết hạn
|
||||
order?: number; // Thứ tự
|
||||
status?: number; // Trạng thái
|
||||
}
|
||||
|
||||
export const getArticleById = async (event : any) => {
|
||||
try {
|
||||
const { apiUrl } = useRuntimeConfig().public
|
||||
const id = event.context.params.id;
|
||||
const { item }: any = await $fetch(`${apiUrl}/cms/digital-Article/${id}`, {
|
||||
headers: new Headers({
|
||||
site: '1' || 1,
|
||||
}),
|
||||
})
|
||||
return item
|
||||
} catch (error) {
|
||||
handleError(error);
|
||||
}
|
||||
}
|
||||
|
||||
export const getArticleBySlug = async (event : any) => {
|
||||
try {
|
||||
const { apiUrl } = useRuntimeConfig().public
|
||||
const slug = event.context.params.slug;
|
||||
const { item }: any = await $fetch(`${apiUrl}/cms/digital-Article/slug:${slug}`, {
|
||||
headers: new Headers({
|
||||
site: '1' || 1,
|
||||
}),
|
||||
})
|
||||
return item
|
||||
} catch (error) {
|
||||
handleError(error);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,6 @@ interface PageComponentSettings {
|
||||
dataQuery?: string; // Truy vấn dữ liệu: IDS | NEW | VIEW | SQL | REQUEST | ...
|
||||
dataResult?: string; // Kết quả dữ liệu (Json)
|
||||
}
|
||||
|
||||
interface PageSection extends Base {
|
||||
id?: number; // Mã định danh
|
||||
siteId?: number; // Mã hệ thống
|
||||
@@ -102,12 +101,12 @@ export const getDynamicPageByCode = async (event : any) => {
|
||||
try {
|
||||
const { apiUrl } = useRuntimeConfig().public
|
||||
const slug = event.context.params.slug;
|
||||
|
||||
const { item }: any = await $fetch(`${apiUrl}/cms/overview-page/slug:${slug}`)
|
||||
console.log('============')
|
||||
console.log(item)
|
||||
console.log('============')
|
||||
return { item }
|
||||
const { item }: any = await $fetch(`${apiUrl}/cms/overview-page/slug:${slug}`, {
|
||||
headers: new Headers({
|
||||
site: '1' || 1,
|
||||
}),
|
||||
})
|
||||
return item
|
||||
} catch (error) {
|
||||
handleError(error);
|
||||
}
|
||||
@@ -117,11 +116,8 @@ export const getDynamicPageById = async (event : any) => {
|
||||
try {
|
||||
const { apiUrl } = useRuntimeConfig().public
|
||||
const id = event.context.params.id;
|
||||
|
||||
const { item }: any = await $fetch(`${apiUrl}/cms/overview-page/${id}`, {
|
||||
method: 'GET',
|
||||
})
|
||||
return { item }
|
||||
const { item }: any = await $fetch(`${apiUrl}/cms/overview-page/${id}`)
|
||||
return item
|
||||
} catch (error) {
|
||||
handleError(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user