init

Initialises user with additional information

init(group, workingGroup)

Arguments

groups (Record<string, Array<string>>): Groups in which user belongs to

workingGroup (Record<string, string>): Current groups in which user belongs

Returns

(Promise): Returns the user object with id, group and workingGroup

Example

// create group
const group: Record<string, string[]> = {};
group["teacherId"] = ["t1", "t2", "t3"];
group["classId"] = ["c1"];

// create working group
const workingGroup: Record<string, string> = {};
workingGroup["teacherId"] = "t1";
workingGroup["classId"] = "c1";

init("user1", group, workingGroup);
// Result of promise
/*
    {
        id: "user1",
        group: {
            "teacherId": ["t1", "t2", "t3"],
            "classId": ["c1"]
        },
        workingGroup: {
            "teacherId": "t1",
            "classId": "c1"
        }
    }
*/

Last updated