mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
* [document-updater] adopt strict zod types and extend test coverage * [saas-e2e] add test for project restore with binary and linked file GitOrigin-RevId: a8e45bd1e46b6ac8a293da24c8b8ad7b236fd9bd
46 lines
954 B
JavaScript
46 lines
954 B
JavaScript
let MockProjectHistoryApi
|
|
const { expressify } = require('@overleaf/promise-utils')
|
|
const express = require('express')
|
|
const {
|
|
handleValidationError,
|
|
parseReq,
|
|
z,
|
|
zz,
|
|
} = require('@overleaf/validation-tools')
|
|
const app = express()
|
|
|
|
const flushProjectSchema = z.object({
|
|
params: z.strictObject({
|
|
project_id: zz.objectId(),
|
|
}),
|
|
})
|
|
|
|
module.exports = MockProjectHistoryApi = {
|
|
async flushProject(docId) {},
|
|
|
|
run() {
|
|
app.post(
|
|
'/project/:project_id/flush',
|
|
expressify(async (req, res, next) => {
|
|
const { params } = parseReq(req, flushProjectSchema)
|
|
try {
|
|
await this.flushProject(params.project_id)
|
|
return res.sendStatus(204)
|
|
} catch (error) {
|
|
return res.sendStatus(500)
|
|
}
|
|
})
|
|
)
|
|
|
|
app.use(handleValidationError)
|
|
|
|
return app.listen(3054, error => {
|
|
if (error != null) {
|
|
throw error
|
|
}
|
|
})
|
|
},
|
|
}
|
|
|
|
MockProjectHistoryApi.run()
|