(file)
| 11 | * Read uploaded file content as UTF-8 text |
| 12 | */ |
| 13 | const readCodeFile = (file) => { |
| 14 | try { |
| 15 | return file.buffer.toString("utf-8"); |
| 16 | } catch (error) { |
| 17 | throw new ApiError(400, "Error reading the uploaded file"); |
| 18 | } |
| 19 | }; |
| 20 | |
| 21 | /** |
| 22 | * Ensure user is owner of the component or an admin |
| 23 | */ |
| 24 | const checkOwnershipOrAdmin = (component, userId, isAdmin, action) => { |
| 25 | if (component.submittedBy.toString() !== userId.toString() && !isAdmin) { |
no outgoing calls
no test coverage detected