( req: MonkeyRequest<undefined, ApproveQuoteRequest>, )
| 68 | } |
| 69 | |
| 70 | export async function approveQuote( |
| 71 | req: MonkeyRequest<undefined, ApproveQuoteRequest>, |
| 72 | ): Promise<ApproveQuoteResponse> { |
| 73 | const { uid } = req.ctx.decodedToken; |
| 74 | const { quoteId, editText, editSource } = req.body; |
| 75 | |
| 76 | const { name } = await getPartialUser(uid, "approve quote", ["name"]); |
| 77 | |
| 78 | if (!name) { |
| 79 | throw new MonkeyError(500, "Missing name field"); |
| 80 | } |
| 81 | |
| 82 | const data = await NewQuotesDAL.approve(quoteId, editText, editSource, name); |
| 83 | void addLog("system_quote_approved", data, uid); |
| 84 | |
| 85 | return new MonkeyResponse(data.message, data.quote); |
| 86 | } |
| 87 | |
| 88 | export async function refuseQuote( |
| 89 | req: MonkeyRequest<undefined, RejectQuoteRequest>, |
nothing calls this directly
no test coverage detected