Slide 17
Slide 17 text
ϫʔΫϑϩʔΛ (SBQI2-NVUBUJPO͔Βݺͼ *0ͰαϯυΠον͢Δ
builder.mutationField('updateTablePattern', (t) =>
t.field({
type: UpdateTablePatternPayload,
args: {
patternId: t.arg({ type: 'UUID', description: 'テーブルパターンID' }),
input: t.arg({ type: TablePatternInput }),
},
authScopes: (_parent, { patternId }, context) => canUpdateTablePattern(context, patternId),
resolve: (_parent, { patternId, input }, context) => {
// ドメインサービスを DI してワークフローを作る
const workflow = updateTablePatternWorkFlow(checkTablePatternExists(context))
const preprocess = ok(patternId)
.andThen(TablePatternId)
.asyncAndThen(getTablePatternById(context))
.map((pattern) => toUnvalidatedCommand({ input, pattern }))
const result = preprocess.andThen(workflow).andThen(updateTablePattern(context))
return result.match(
(pattern) => ({ pattern }),
(error) => {
throw error
},
)
},
}),
)
σʔλऔಘ
σʔλอଘ ߋ৽