• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

scriptype / writ-cms / 29583467882

17 Jul 2026 01:18PM UTC coverage: 48.863% (-1.5%) from 50.411%
29583467882

push

github

scriptype
Implement ContentTypeEditor & updateContentType

todo:
- createContentType

maydo:
- introduce mandatory/required/optional for attributes
- maybe aliases are not necessary in model configs?
- archetype/composition

also:
- Added pathName (file name without extension, similar to title in all
else) and contentRaw (unparsed md content) to contentTypes.

666 of 1409 branches covered (47.27%)

Branch coverage included in aggregate %.

2 of 135 new or added lines in 6 files covered. (1.48%)

2279 of 4618 relevant lines covered (49.35%)

1417.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/cms/server/router/api/contentTypes.js
1
const express = require('express')
×
2
const skipWatcher = require('../../middleware/skipWatcher')
×
3

4
module.exports = (state) => express.Router()
×
5
  .get('/', async (req, res) => {
6
    try {
×
7
      res.status(200).json(
×
8
        await req.api.contentTypes.get()
9
      )
10
    } catch (e) {
11
      console.log('Error getting contentTypes', e)
×
12
      return res.status(500).send(e)
×
13
    }
14
  })
15
  .post('/', async (req, res) => {
16
    try {
×
17
      res.status(200).json(
×
18
        await req.api.contentTypes.create(req.body)
19
      )
20
    } catch (e) {
21
      console.log('Error creating contentType', e)
×
22
      return res.status(500).send(e)
×
23
    }
24
  })
25
  .put('/', skipWatcher(state), async (req, res) => {
NEW
26
    try {
×
NEW
27
      const response = await req.api.contentTypes.update(
×
28
        req.query.path,
29
        JSON.parse(req.body.data)
30
      )
NEW
31
      state.setState(
×
32
        await req.api.ssg.build(state.getSSGOptions())
33
      )
NEW
34
      res.status(200).send(response)
×
35
    } catch (e) {
NEW
36
      console.log('Error updating content-type', e)
×
NEW
37
      res.status(500).send(e)
×
38
    }
39
  })
40
  .delete('/', skipWatcher(state), async (req, res) => {
41
    try {
×
42
      await req.api.contentTypes.delete(req.query.path)
×
43
      state.setState(
×
44
        await req.api.ssg.build(state.getSSGOptions())
45
      )
46
      res.sendStatus(204)
×
47
    } catch (e) {
48
      if (e.message === 'content type not found') {
×
49
        return res.status(404).send(e)
×
50
      }
51
      console.log('Error deleting content type', e)
×
52
      res.status(500).send(e)
×
53
    }
54
  })
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc