MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / closeUpstreamDML

Function closeUpstreamDML

packages/wl-sdk/src/commons/dml.generated.ts:263–279  ·  view source on GitHub ↗
(input: CloseUpstreamInput)

Source from the content-addressed store, hash-verified

261 * without creating a stamp.
262 */
263export 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

Callers 1

Calls 2

sqlStringOrNullFunction · 0.90
escapeSqlStringFunction · 0.90

Tested by

no test coverage detected