Reviewed-on: #413 Co-authored-by: miteruzo <miteruzo@naver.com> Co-committed-by: miteruzo <miteruzo@naver.com>
このコミットはPull リクエスト #413 でマージされました.
このコミットが含まれているのは:
@@ -0,0 +1,53 @@
|
||||
import type { PostImportRow } from '@/lib/postImportTypes'
|
||||
|
||||
export const buildPostImportRow = (
|
||||
overrides: Partial<PostImportRow> = {},
|
||||
): PostImportRow => {
|
||||
const attributes = {
|
||||
title: '',
|
||||
thumbnailBase: '',
|
||||
originalCreatedFrom: '',
|
||||
originalCreatedBefore: '',
|
||||
duration: '',
|
||||
tags: '',
|
||||
parentPostIds: '',
|
||||
...overrides.attributes }
|
||||
const provenance = {
|
||||
url: 'manual' as const,
|
||||
title: 'automatic' as const,
|
||||
thumbnailBase: 'automatic' as const,
|
||||
originalCreatedFrom: 'automatic' as const,
|
||||
originalCreatedBefore: 'automatic' as const,
|
||||
duration: 'automatic' as const,
|
||||
tags: 'automatic' as const,
|
||||
parentPostIds: 'automatic' as const,
|
||||
...overrides.provenance }
|
||||
const fieldWarnings = { ...overrides.fieldWarnings }
|
||||
const baseWarnings = [...(overrides.baseWarnings ?? [])]
|
||||
const tagSources = {
|
||||
automatic: overrides.tagSources?.automatic ?? '',
|
||||
manual: overrides.tagSources?.manual ?? '' }
|
||||
const url = overrides.url ?? 'https://example.com/post'
|
||||
|
||||
return {
|
||||
...overrides,
|
||||
sourceRow: overrides.sourceRow ?? 1,
|
||||
url,
|
||||
attributes,
|
||||
fieldWarnings,
|
||||
baseWarnings,
|
||||
validationErrors: overrides.validationErrors ?? {},
|
||||
provenance,
|
||||
tagSources,
|
||||
status: overrides.status ?? 'ready',
|
||||
recoverable: overrides.recoverable,
|
||||
resetSnapshot: overrides.resetSnapshot ?? {
|
||||
url,
|
||||
attributes: { ...attributes },
|
||||
provenance: { ...provenance },
|
||||
tagSources: { ...tagSources },
|
||||
fieldWarnings: Object.fromEntries (
|
||||
Object.entries (fieldWarnings).map (([key, values]) => [key, [...values]])),
|
||||
baseWarnings: [...baseWarnings],
|
||||
metadataUrl: overrides.metadataUrl } }
|
||||
}
|
||||
新しい課題から参照
ユーザをブロックする