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

Commit

Permalink
refactor: parameters created and updated by journal (#33)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Wang <i@ryanc.cc>
  • Loading branch information
ruibaby authored Mar 11, 2022
1 parent b0ed8ad commit dfa838f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
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

0 comments on commit dfa838f

Please sign in to comment.