Browse Source

Revert formatting to 80 print width

pull/4023/head
Andrew Kingston 6 years ago
parent
commit
609b039d4c
  1. 3
      .prettierrc
  2. 9
      packages/server/src/api/controllers/record.js
  3. 6
      packages/server/src/api/routes/tests/couchTestUtils.js
  4. 32
      packages/server/src/api/routes/workflow.js

3
.prettierrc

@ -4,6 +4,5 @@
"singleQuote": false,
"trailingComma": "es5",
"plugins": ["prettier-plugin-svelte"],
"svelteSortOrder" : "scripts-markup-styles",
"printWidth": 100
"svelteSortOrder" : "scripts-markup-styles"
}

9
packages/server/src/api/controllers/record.js

@ -110,7 +110,9 @@ exports.save = async function(ctx) {
const doc = row.doc
return {
...doc,
[model.name]: doc[model.name] ? [...doc[model.name], record._id] : [record._id],
[model.name]: doc[model.name]
? [...doc[model.name], record._id]
: [record._id],
}
})
@ -201,7 +203,10 @@ async function validate({ instanceId, modelId, record, model }) {
}
const errors = {}
for (let fieldName in model.schema) {
const res = validateJs.single(record[fieldName], model.schema[fieldName].constraints)
const res = validateJs.single(
record[fieldName],
model.schema[fieldName].constraints
)
if (res) errors[fieldName] = res
}
return { valid: Object.keys(errors).length === 0, errors }

6
packages/server/src/api/routes/tests/couchTestUtils.js

@ -263,7 +263,11 @@ exports.builderEndpointShouldBlockNormalUsers = async ({
appId,
instanceId,
}) => {
const headers = await createUserWithAdminPermissions(request, appId, instanceId)
const headers = await createUserWithAdminPermissions(
request,
appId,
instanceId
)
await createRequest(request, method, url, body)
.set(headers)

32
packages/server/src/api/routes/workflow.js

@ -37,13 +37,35 @@ const workflowValidator = joiValidator.body(Joi.object({
}).unknown(true))
router
.get("/api/workflows/trigger/list", authorized(BUILDER), controller.getTriggerList)
.get("/api/workflows/action/list", authorized(BUILDER), controller.getActionList)
.get("/api/workflows/logic/list", authorized(BUILDER), controller.getLogicList)
.get(
"/api/workflows/trigger/list",
authorized(BUILDER),
controller.getTriggerList
)
.get(
"/api/workflows/action/list",
authorized(BUILDER),
controller.getActionList
)
.get(
"/api/workflows/logic/list",
authorized(BUILDER),
controller.getLogicList
)
.get("/api/workflows", authorized(BUILDER), controller.fetch)
.get("/api/workflows/:id", authorized(BUILDER), controller.find)
.put("/api/workflows", authorized(BUILDER), workflowValidator, controller.update)
.post("/api/workflows", authorized(BUILDER), workflowValidator, controller.create)
.put(
"/api/workflows",
authorized(BUILDER),
workflowValidator,
controller.update
)
.post(
"/api/workflows",
authorized(BUILDER),
workflowValidator,
controller.create
)
.post("/api/workflows/:id/trigger", controller.trigger)
.delete("/api/workflows/:id/:rev", authorized(BUILDER), controller.destroy)

Loading…
Cancel
Save