What is Atom

Atom is the most basic element of CabloyJS, such as article, announcement, leave application, etc.

Why to called Atom

In chemical reactions, atoms are the most basic particles. In CabloyJS, any desired solutions such as CMS, OA, CRM, ERP, etc., can be realized through the combination of atoms

Benifits of Atom

It is precisely because a general concept of Atom has been abstracted from various business models, that CabloyJS realizes many common features and functions for Atom, thus enabling various practical business conveniently

Business Module Template: module-business

If business logics to be developed, it is recommended that the business module template module-business be used to create the file skeleton of the business module. This template automatically creates business-related code, greatly simplifying the workload

  1. 1$ cd /path/to/project
  2. 2$ npm run cli :create:module moduleName -- [--template=] [--suite=] [--force]
  • suite:the suite name which contains the new module

  • force:force create when the module name exists

  • template:three module templates are currently available:

名称 说明
module-business this template creates business-related code that greatly simplifies the workload
module-business-details module-business + details related code files
module this template contains only the basic skeleton code files

Create Atom Class

Create a business module using the template module-business, and the system will automatically create a series of source code files related to atom class. In addition, we can directly add new atom class to the existing business module

  1. 1$ npm run cli :create:atom atomClassName -- [--module=]

Unified Storage

The basic information of all atoms are stored in the data table aAtom, and the business related fields are stored in the business table, such as testParty. aAtom and business table are one-to-one relationships

This storage mechanism embodies the unity of commonness and difference, and has the following advantages:

  1. Unified configuration of data permission
  2. Unified operations of CRUD
  3. Unified operations of Star and Label
  4. Unified operation of Search
  5. Unified supporting of Draft
  6. Unified supporting of Simple Workflow

Core Fields of aAtom

Name Type Default Description
id int auto-increment this field is referenced in other tables by the name of atomId generally
createdAt timestamp CURRENT_TIMESTAMP Atom Created Time
updatedAt timestamp CURRENT_TIMESTAMP Atom Updated time
deleted int 0 soft deletion
iid int 0 instance id
itemId int 0 corresponding business table’s item id
atomEnabled int 0 Atom’s state: 0:Draft, 1:Normal
atomFlag int 0 Atom’s Flag, related to atom custom actions
atomClassId int 0 AtomClass’s id
atomName varchar NULL atom’s name
userIdCreated int 0 userId who create this atom
userIdUpdated int 0 userId who update this atom
allowComment int 1 allow comments or not
starCount int 0 amount of stars
commentCount int 0 amount of comments
attachmentCount int 0 amount of attachments
readCount int 0 amount of views

Atom Class

AtomClass is the metadata information corresponding to Atom, which is also set in meta of the module

src/suite-vendor/test-party/modules/test-party/backend/src/meta.js

  1. 1const meta = {
  2. 2 base: {
  3. 3 atoms: {
  4. 4 party: {
  5. 5 info: {
  6. 6 title: 'Party',
  7. 7 tableName: 'testPartyView',
  8. 8 },
  9. 9 },
  10. 10 },
  11. 11 },
  12. 12};
Name Description
title AtomClass’s title
tableName The name of the data table or view

Star & Label

You can set star mark for atoms, or add different labels to facilitate the rapid classification, sorting and viewing of atoms