setAct

setAct: (actInp: ActInp)

set Actions to main service


Example
    
      const coreApp = lesan();
      const locationPure = {
        name: string(),
        population: number(),
        abb: string(),
      };
      const cities = coreApp.odm.newModel(
        "city",
        locationPure,
        {
          country: {
            schemaName: "country",
            type: "single",
            optional: false,
            relatedRelations: {
              cities: {
                type: "multiple",
                limit: 5,
                sort: {
                  field: "_id",
                  order: "asc",
                },
              },
            },
          },
        },
      );

const setAddCityAct = coreApp.acts.setAct({ schema: "city", actName: "addCity", validator: addCityValidator(), fn: addCity, });

Return Of Example
    
{
  "validator": {
    "type": "object",
    "schema": {
      "set": {
        "type": "object",
        "schema": {
          "name": { "type": "string", "schema": null },
          "population": { "type": "number", "schema": null },
          "abb": { "type": "string", "schema": null },
          "isCapital": { "type": "boolean", "schema": null },
          "country": { "type": "union", "schema": null }
        }
      },
      "get": {
        "type": "object",
        "schema": {
          "_id": { "type": "enums", "schema": { "0": 0, "1": 1 } },
          "name": { "type": "enums", "schema": { "0": 0, "1": 1 } },
          "population": { "type": "enums", "schema": { "0": 0, "1": 1 } },
          "abb": { "type": "enums", "schema": { "0": 0, "1": 1 } },
          "country": {
            "type": "object",
            "schema": {
              "_id": { "type": "enums", "schema": { "0": 0, "1": 1 } },
              "name": { "type": "enums", "schema": { "0": 0, "1": 1 } },
              "population": { "type": "enums", "schema": { "0": 0, "1": 1 } },
              "abb": { "type": "enums", "schema": { "0": 0, "1": 1 } }
            }
          },
          "users": {
            "type": "object",
            "schema": {
              "_id": { "type": "enums", "schema": { "0": 0, "1": 1 } },
              "name": { "type": "enums", "schema": { "0": 0, "1": 1 } },
              "age": { "type": "enums", "schema": { "0": 0, "1": 1 } }
            }
          },
          "lovedByUser": {
            "type": "object",
            "schema": {
              "_id": { "type": "enums", "schema": { "0": 0, "1": 1 } },
              "name": { "type": "enums", "schema": { "0": 0, "1": 1 } },
              "age": { "type": "enums", "schema": { "0": 0, "1": 1 } }
            }
          }
        }
      }
    }
  },
  "validationRunType": "assert"
}
    
  

Parameters

  
    actInp: ActInp