Adding fixes that lets us pull a myster in the db into a json file
This commit is contained in:
@@ -25,7 +25,7 @@ export type LevelTemplateOption = { versionId: string; slug: string; name: strin
|
||||
export type Utterer = 'npc' | 'player'
|
||||
export type UtteranceDto = {
|
||||
id: string; nodeId: string; utterer: Utterer; npcId: string | null; poseKey: string | null; text: string
|
||||
parentUtteranceId: string | null; terminalId: string | null
|
||||
parentUtteranceId: string | null; terminalId: string | null; awardsFlag: string | null; requiresFlag: string | null
|
||||
xpos: number; ypos: number; sortOrder: number
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ export function createStoryGraphRepository(pool: Pool): StoryGraphRepository {
|
||||
|
||||
async listUtterances(nodeId) {
|
||||
const result = await pool.query<UtteranceRow>(
|
||||
`SELECT id,node_id,utterer,npc_id,pose_key,text,parent_utterance_id,terminal_id,xpos,ypos,sort_order
|
||||
`SELECT id,node_id,utterer,npc_id,pose_key,text,parent_utterance_id,terminal_id,awards_flag,requires_flag,xpos,ypos,sort_order
|
||||
FROM osint.utterances WHERE node_id=$1 ORDER BY sort_order,id`, [nodeId])
|
||||
return result.rows.map(mapUtterance)
|
||||
},
|
||||
@@ -203,7 +203,7 @@ export function createStoryGraphRepository(pool: Pool): StoryGraphRepository {
|
||||
await pool.query('INSERT INTO osint.utterances (id,node_id,utterer,text,xpos,ypos,sort_order) VALUES ($1,$2,$3,$4,$5,$6,$7)',
|
||||
[id, nodeId, input.utterer, input.text || '', input.xpos, input.ypos, order.rows[0].next])
|
||||
const created = await pool.query<UtteranceRow>(
|
||||
`SELECT id,node_id,utterer,npc_id,pose_key,text,parent_utterance_id,terminal_id,xpos,ypos,sort_order FROM osint.utterances WHERE id=$1`, [id])
|
||||
`SELECT id,node_id,utterer,npc_id,pose_key,text,parent_utterance_id,terminal_id,awards_flag,requires_flag,xpos,ypos,sort_order FROM osint.utterances WHERE id=$1`, [id])
|
||||
return mapUtterance(created.rows[0])
|
||||
},
|
||||
|
||||
@@ -333,13 +333,14 @@ export function createStoryGraphRepository(pool: Pool): StoryGraphRepository {
|
||||
|
||||
type UtteranceRow = {
|
||||
id: string; node_id: string; utterer: Utterer; npc_id: string | null; pose_key: string | null; text: string
|
||||
parent_utterance_id: string | null; terminal_id: string | null
|
||||
parent_utterance_id: string | null; terminal_id: string | null; awards_flag: string | null; requires_flag: string | null
|
||||
xpos: number; ypos: number; sort_order: number
|
||||
}
|
||||
function mapUtterance(row: UtteranceRow): UtteranceDto {
|
||||
return {
|
||||
id: row.id, nodeId: row.node_id, utterer: row.utterer, npcId: row.npc_id, poseKey: row.pose_key, text: row.text,
|
||||
parentUtteranceId: row.parent_utterance_id, terminalId: row.terminal_id,
|
||||
awardsFlag: row.awards_flag, requiresFlag: row.requires_flag,
|
||||
xpos: row.xpos, ypos: row.ypos, sortOrder: row.sort_order,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user