2026-06-15 13:08:54 +00:00
|
|
|
import {
|
|
|
|
|
AnnouncementCommentDto,
|
|
|
|
|
AnnouncementDto,
|
|
|
|
|
EventCommentDto,
|
|
|
|
|
EventDto,
|
|
|
|
|
IntranetDashboardDto,
|
|
|
|
|
SocialCommentDto,
|
|
|
|
|
SocialPostDto,
|
|
|
|
|
} from '@/proxy/intranet/models'
|
2026-05-05 17:59:30 +00:00
|
|
|
import apiService, { Config } from './api.service'
|
|
|
|
|
|
2026-05-06 13:47:18 +00:00
|
|
|
export interface CreateSocialPostInput {
|
|
|
|
|
content: string
|
|
|
|
|
media?: {
|
|
|
|
|
type: 'image' | 'video' | 'poll'
|
|
|
|
|
urls?: string[]
|
|
|
|
|
pollQuestion?: string
|
|
|
|
|
pollOptions?: { text: string }[]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-05 17:59:30 +00:00
|
|
|
export class IntranetService {
|
|
|
|
|
apiName = 'Default'
|
|
|
|
|
|
|
|
|
|
getDashboard = (config?: Partial<Config>) =>
|
|
|
|
|
apiService.fetchData<IntranetDashboardDto>(
|
|
|
|
|
{
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '/api/app/intranet/intranet-dashboard',
|
|
|
|
|
},
|
|
|
|
|
{ apiName: this.apiName, ...config },
|
|
|
|
|
)
|
2026-05-06 07:54:04 +00:00
|
|
|
|
2026-05-08 21:48:23 +00:00
|
|
|
getIntranetSocialPosts = (skipCount: number, maxResultCount: number, config?: Partial<Config>) =>
|
|
|
|
|
apiService.fetchData<SocialPostDto[]>(
|
|
|
|
|
{
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '/api/app/intranet/intranet-social-posts',
|
|
|
|
|
params: { skipCount, maxResultCount },
|
|
|
|
|
},
|
|
|
|
|
{ apiName: this.apiName, ...config },
|
|
|
|
|
)
|
|
|
|
|
|
2026-05-06 13:47:18 +00:00
|
|
|
createSurveyResponse = (
|
2026-05-06 07:54:04 +00:00
|
|
|
surveyId: string,
|
|
|
|
|
answers: { questionId: string; questionType: string; value: string }[],
|
|
|
|
|
config?: Partial<Config>,
|
|
|
|
|
) =>
|
|
|
|
|
apiService.fetchData<void>(
|
|
|
|
|
{
|
|
|
|
|
method: 'POST',
|
2026-05-06 13:47:18 +00:00
|
|
|
url: '/api/app/intranet/survey-response',
|
2026-05-06 07:54:04 +00:00
|
|
|
data: { surveyId, answers },
|
|
|
|
|
},
|
|
|
|
|
{ apiName: this.apiName, ...config },
|
|
|
|
|
)
|
2026-05-06 13:47:18 +00:00
|
|
|
|
|
|
|
|
createSocialPost = (input: CreateSocialPostInput, config?: Partial<Config>) =>
|
|
|
|
|
apiService.fetchData<SocialPostDto, CreateSocialPostInput>(
|
|
|
|
|
{
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: '/api/app/intranet/social-post',
|
|
|
|
|
data: input,
|
|
|
|
|
},
|
|
|
|
|
{ apiName: this.apiName, ...config },
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
deleteSocialPost = (id: string, config?: Partial<Config>) =>
|
|
|
|
|
apiService.fetchData<void>(
|
|
|
|
|
{
|
|
|
|
|
method: 'DELETE',
|
|
|
|
|
url: `/api/app/intranet/${id}/social-post`,
|
|
|
|
|
},
|
|
|
|
|
{ apiName: this.apiName, ...config },
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
likeSocialPost = (id: string, config?: Partial<Config>) =>
|
|
|
|
|
apiService.fetchData<SocialPostDto>(
|
|
|
|
|
{
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: `/api/app/intranet/like-social-post`,
|
|
|
|
|
params: { id },
|
|
|
|
|
},
|
|
|
|
|
{ apiName: this.apiName, ...config },
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
commentSocialPost = (id: string, content: string, config?: Partial<Config>) =>
|
|
|
|
|
apiService.fetchData<SocialCommentDto>(
|
|
|
|
|
{
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: `/api/app/intranet/comment-social-post`,
|
|
|
|
|
params: { id, content },
|
|
|
|
|
},
|
|
|
|
|
{ apiName: this.apiName, ...config },
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
voteSocialPoll = (postId: string, optionId: string, config?: Partial<Config>) =>
|
|
|
|
|
apiService.fetchData<void>(
|
|
|
|
|
{
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: `/api/app/intranet/vote-social-poll`,
|
|
|
|
|
params: { postId, optionId },
|
|
|
|
|
},
|
|
|
|
|
{ apiName: this.apiName, ...config },
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
incrementAnnouncementViewCount = (id: string, config?: Partial<Config>) =>
|
|
|
|
|
apiService.fetchData<void>(
|
|
|
|
|
{
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: `/api/app/intranet/${id}/announcement-view`,
|
|
|
|
|
},
|
|
|
|
|
{ apiName: this.apiName, ...config },
|
|
|
|
|
)
|
2026-05-07 14:25:06 +00:00
|
|
|
|
2026-06-15 13:08:54 +00:00
|
|
|
getAnnouncementComments = (announcementId: string, config?: Partial<Config>) =>
|
|
|
|
|
apiService.fetchData<AnnouncementCommentDto[]>(
|
|
|
|
|
{
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: `/api/app/intranet/announcement-comments/${announcementId}`,
|
|
|
|
|
},
|
|
|
|
|
{ apiName: this.apiName, ...config },
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
createAnnouncementComment = (
|
|
|
|
|
announcementId: string,
|
|
|
|
|
content: string,
|
|
|
|
|
config?: Partial<Config>,
|
|
|
|
|
) =>
|
|
|
|
|
apiService.fetchData<AnnouncementCommentDto>(
|
|
|
|
|
{
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: `/api/app/intranet/announcement-comment/${announcementId}`,
|
|
|
|
|
params: { content },
|
|
|
|
|
},
|
|
|
|
|
{ apiName: this.apiName, ...config },
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
likeAnnouncement = (id: string, config?: Partial<Config>) =>
|
|
|
|
|
apiService.fetchData<AnnouncementDto>(
|
|
|
|
|
{
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: `/api/app/intranet/like-announcement`,
|
|
|
|
|
params: { id },
|
|
|
|
|
},
|
|
|
|
|
{ apiName: this.apiName, ...config },
|
|
|
|
|
)
|
|
|
|
|
|
2026-05-07 14:25:06 +00:00
|
|
|
getEventComments = (eventId: string, config?: Partial<Config>) =>
|
|
|
|
|
apiService.fetchData<EventCommentDto[]>(
|
|
|
|
|
{
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: `/api/app/intranet/event-comments/${eventId}`,
|
|
|
|
|
},
|
|
|
|
|
{ apiName: this.apiName, ...config },
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
createEventComment = (eventId: string, content: string, config?: Partial<Config>) =>
|
|
|
|
|
apiService.fetchData<EventCommentDto>(
|
|
|
|
|
{
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: `/api/app/intranet/event-comment/${eventId}`,
|
|
|
|
|
params: { content },
|
|
|
|
|
},
|
|
|
|
|
{ apiName: this.apiName, ...config },
|
|
|
|
|
)
|
2026-05-08 18:11:56 +00:00
|
|
|
|
|
|
|
|
likeEvent = (id: string, config?: Partial<Config>) =>
|
|
|
|
|
apiService.fetchData<EventDto>(
|
|
|
|
|
{
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: `/api/app/intranet/like-event`,
|
|
|
|
|
params: { id },
|
|
|
|
|
},
|
|
|
|
|
{ apiName: this.apiName, ...config },
|
|
|
|
|
)
|
2026-05-05 17:59:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const intranetService = new IntranetService()
|