Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

refactor: parameters created and updated by journal #33

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions packages/admin-api/src/clients/JournalClient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HttpClient } from '@halo-dev/rest-api-client'
import { buildPath } from '../url'
import { Journal, JournalQuery, JournalType, JournalWithCmtCount, Page, Response } from '../types'
import { Journal, JournalParam, JournalQuery, JournalWithCmtCount, Page, Response } from '../types'

export class JournalClient {
private client: HttpClient
Expand Down Expand Up @@ -41,7 +41,7 @@ export class JournalClient {
* @param params parameter for creates
* @returns A response of created journal.
*/
public create(params: Journal): Promise<Response<Journal>> {
public create(params: JournalParam): Promise<Response<Journal>> {
const path = buildPath({
endpointName: 'journals',
})
Expand All @@ -55,13 +55,7 @@ export class JournalClient {
* @param params parameter for updates
* @returns A response of updated journal.
*/
public update(
journalId: number,
params: {
sourceContent: string
type?: JournalType
},
): Promise<Response<Journal>> {
public update(journalId: number, params: JournalParam): Promise<Response<Journal>> {
const path = buildPath({
endpointName: `journals/${journalId}`,
})
Expand Down
7 changes: 7 additions & 0 deletions packages/admin-api/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@ export type Journal = {
type: JournalType
}

export type JournalParam = {
sourceContent: string
content: string
type: JournalType
keepRaw?: boolean
}

export interface JournalCommentWithJournal extends BaseComment {
journal: Journal
}
Expand Down