(input: CloseUpstreamInput)
| 261 | * without creating a stamp. |
| 262 | */ |
| 263 | export function closeUpstreamDML(input: CloseUpstreamInput): string[] { |
| 264 | const hopField = sqlStringOrNull(input.hopUri); |
| 265 | |
| 266 | const deleteCompletion = `DELETE FROM completions WHERE wanted_id='${escapeSqlString(input.wantedId)}'`; |
| 267 | |
| 268 | const insertCompletion = |
| 269 | `INSERT IGNORE INTO completions (id, wanted_id, completed_by, evidence, hop_uri, completed_at) ` + |
| 270 | `VALUES ('${escapeSqlString(input.completionId)}', '${escapeSqlString(input.wantedId)}', ` + |
| 271 | `'${escapeSqlString(input.completedBy)}', '${escapeSqlString(input.evidence)}', ${hopField}, NOW())`; |
| 272 | |
| 273 | const updateWanted = |
| 274 | `UPDATE wanted SET status='completed', claimed_by='${escapeSqlString(input.completedBy)}', ` + |
| 275 | `evidence_url='${escapeSqlString(input.evidence)}', updated_at=NOW() ` + |
| 276 | `WHERE id='${escapeSqlString(input.wantedId)}'`; |
| 277 | |
| 278 | return [deleteCompletion, insertCompletion, updateWanted]; |
| 279 | } |
| 280 | |
| 281 | // UpdateWantedDML (commons.go:783) |
| 282 |
no test coverage detected