more boilerplate and dev environment
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @typedef {Object} Note
|
||||
* @property {string} objectId
|
||||
* @property {'note'} type
|
||||
* @property {string} text
|
||||
* @property {string[]} childIds
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a Note object.
|
||||
*
|
||||
* @param {string} objectId
|
||||
* @param {string} text
|
||||
* @param {string[]} [childIds=[]]
|
||||
* @returns {Note}
|
||||
*/
|
||||
export function createNoteModel(objectId, text, childIds = []) {
|
||||
return { objectId, type: 'note', text, childIds };
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @typedef {Object} ObjectRecord
|
||||
* @property {string} objectId
|
||||
* @property {string} userId
|
||||
* @property {string} objectData
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create an ObjectRecord object.
|
||||
*
|
||||
* @param {string} objectId
|
||||
* @param {string} userId
|
||||
* @param {string} objectData
|
||||
* @returns {ObjectRecord}
|
||||
*/
|
||||
export function createObjectModel(objectId, userId, objectData) {
|
||||
return { objectId, userId, objectData };
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @typedef {Object} Project
|
||||
* @property {string} objectId
|
||||
* @property {'project'} type
|
||||
* @property {string} name
|
||||
* @property {string[]} childIds
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a Project object.
|
||||
*
|
||||
* @param {string} objectId
|
||||
* @param {string} name
|
||||
* @param {string[]} [childIds=[]]
|
||||
* @returns {Project}
|
||||
*/
|
||||
export function createProjectModel(objectId, name, childIds = []) {
|
||||
return { objectId, type: 'project', name, childIds };
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* @typedef {Object} Root
|
||||
* @property {string} objectId
|
||||
* @property {'root'} type
|
||||
* @property {string[]} childIds
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a Root object.
|
||||
*
|
||||
* @param {string} objectId
|
||||
* @param {string[]} [childIds=[]]
|
||||
* @returns {Root}
|
||||
*/
|
||||
export function createRootModel(objectId, childIds = []) {
|
||||
return { objectId, type: 'root', childIds };
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @typedef {'not-started' | 'in-progress' | 'completed' | 'cancelled'} TaskStatus
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} Task
|
||||
* @property {string} objectId
|
||||
* @property {'task'} type
|
||||
* @property {string} text
|
||||
* @property {TaskStatus} status
|
||||
* @property {string[]} childIds
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a Task object.
|
||||
*
|
||||
* @param {string} objectId
|
||||
* @param {string} text
|
||||
* @param {TaskStatus} [status='not-started']
|
||||
* @param {string[]} [childIds=[]]
|
||||
* @returns {Task}
|
||||
*/
|
||||
export function createTaskModel(objectId, text, status = 'not-started', childIds = []) {
|
||||
return { objectId, type: 'task', text, status, childIds };
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* @typedef {Object} User
|
||||
* @property {string} userId
|
||||
* @property {string} rootObjectId
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a User object.
|
||||
*
|
||||
* @param {string} userId
|
||||
* @param {string} rootObjectId
|
||||
* @returns {User}
|
||||
*/
|
||||
export function createUserModel(userId, rootObjectId) {
|
||||
return { userId, rootObjectId };
|
||||
}
|
||||
Reference in New Issue
Block a user