Infohub JS API
Loading...
Searching...
No Matches
ProjectServices Class Reference

Public Member Functions

 constructor (ctx)
async createCoordinationModel (project_sid, reqBody)
async createProject (reqBody, cb)
async deleteCoordinationModelByObjectId (object_id)
async deleteCoordinationModelByShortId (short_id)
async getCoordinationModelByObjectId (object_id, query={ members:['info'] })
async getCoordinationModelByShortId (short_id, query={ members:['info'] })
async getCoordinationModels (project_sid, query=null)
async getProjectById (project_id, cb, query=null)
 getProjectByShortId (project_sid, cb, query={ members:['info'] })
async getProjectList (cb, query=null)
async getUsersOfProject (project_sid, membersOnly=false)
async getUsersOfProjectAsArray (project_sid)

Function Documentation

◆ constructor()

constructor ( ctx)
Since
1.0, 09.2025, jh
Parameters
{Context}ctx - Context instance

◆ createCoordinationModel()

async createCoordinationModel ( project_sid,
reqBody )

Create a new coordination model in project.

Uses cnObjectServices for object operations (follows OOP principles: DRY, Separation of Concerns)

This method:

  1. Uses getObject() to find cn_federatedmodels container by object_id within project context
  2. Uses createObject() to create the coordination model as a child of the container
Parameters
{String}project_sid
{Object}reqBody - Request body with coordination model data
Returns
{Promise<ApiResponse>} Promise resolving to ApiResponse with created CoordModel as cnObject with: { info: { object_id: "string", // Object ID object_name: "string", // Object name
object_type: "all_container##CM_FEDERATION", // Object type // ... other info properties }, properties: { // Property key-value pairs } // ... other GOM members (geometry, relations, etc.) }

◆ createProject()

async createProject ( reqBody,
cb )

Create a new project on CN infohub.

Parameters
{Object}reqBody {
{ "object_name": "string", // Project Name "object_id": "string", // Project Number "object_type": "string", // all_project, all_project##... "properties": { "additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string" } }
{*}cb Call Back

◆ deleteCoordinationModelByObjectId()

async deleteCoordinationModelByObjectId ( object_id)

Delete a coordination model.

Uses cnObjectServices.deleteObject() (follows OOP principles: DRY, Separation of Concerns)

Parameters
{string}object_id - Coordination model object ID
Returns
{Promise<ApiResponse>} Promise resolving to ApiResponse

◆ deleteCoordinationModelByShortId()

async deleteCoordinationModelByShortId ( short_id)

Delete a coordination model by short ID Uses RestServices for direct node deletion by short_id.

Parameters
{string}short_id - Coordination model short ID
Returns
{Promise<ApiResponse>} Promise resolving to ApiResponse

◆ getCoordinationModelByObjectId()

async getCoordinationModelByObjectId ( object_id,
query = { members: ['info'] } )

Get coordination model by object ID.

Uses cnObjectServices.getObject() (follows OOP principles: DRY, Separation of Concerns)

Parameters
{string}object_id - Coordination model object ID
{*}query - Optional query parameters
Returns
{Promise<ApiResponse>} Promise resolving to ApiResponse with CoordModel data

◆ getCoordinationModelByShortId()

async getCoordinationModelByShortId ( short_id,
query = { members: ['info'] } )

Get coordination model as object from infohub by short ID.

the current project (project shortid) is used as context and must be set.

Parameters
{string}short_id - Coordination model short ID
{*}query - Optional query parameters
Returns
{Promise<ApiResponse>} Promise resolving to ApiResponse with CoordModel data

◆ getCoordinationModels()

async getCoordinationModels ( project_sid,
query = null )

Get all coordination models for a project.

Uses cnObjectServices for object operations

Parameters
{string}project_sid - Project short ID
{*}query - Optional query parameters
Returns
{Promise<ApiResponse>} Promise resolving to ApiResponse with array of CoordModels

◆ getProjectById()

async getProjectById ( project_id,
cb,
query = null )
Parameters
{*}project_id
{*}cb Return an ApiResponse withz object of type Project as data.
{*}query

◆ getProjectByShortId()

getProjectByShortId ( project_sid,
cb,
query = { members: ['info'] } )

Get project as object from infohub by project shortid.

Parameters
{*}project_sid
{*}cb
{*}query

◆ getProjectList()

async getProjectList ( cb,
query = null )

Get list of projects.

Parameters
{*}cb callback
{*}query optional query filter { 'members' : 'info,nodes', 'nodes' : "{ "filter" : "$object_type ~in~ [ 'all_project' , 'all_container##CM_FEDERATION' ] "members" : "info" }"" }

◆ getUsersOfProject()

async getUsersOfProject ( project_sid,
membersOnly = false )

@description Get users in all groups of a given project.

Returns a list of users with their email and the groups they belong to.

Parameters
{string}project_sid - The project short ID.
{boolean}membersOnly - Whether to include only the members the project or all contacts, notice: members of the projet are temporarly the users of the project admin group.
Returns
{Promise<ApiResponse>} ApiResponse with:
  • status 200 and data as an array of user objects, each containing:
    • user {string} - The user's email address.
    • usergroups {Array<Object>} - Array of group info objects, each with:
      • info {Object} - Group info object, with:
      • id {string} - Group UUID
      • name {string} - Group name
      • description {string} - Group description
      • projcatid {string} - Project catalog ID
      • created {string} - Creation timestamp
      • createdby {string} - Creator email
      • updated {string} - Update timestamp
      • updatedby {string} - Updater email
      • permissions {Object} - Group permissions object:
        • groups {string} - Group permissions, e.g.: { "groups": "delete" } Example:
          [
          {
          user: "amr.abdou@colneo.email",
          usergroups: [{
          info: { id: "...", name: "Projektleitung", description: "..." },
          permissions: { ... },
          },
          {
          info: { id: "...", name: "ddd", description: "..." }
          permissions: { ... },
          }
          ]
Since
1.0

◆ getUsersOfProjectAsArray()

async getUsersOfProjectAsArray ( project_sid)