The AOC Framework
github logodiscord logo

FRONTEND

Model Configs #

The model-configs are configurations linked to a model that are used on the client.

They are classes that extend AocModelConfig, "injectable", and can also be a "pipe".

In general, it is used to define various aspects of how certain framework elements should behave regarding model management.

Property Description Example
allow Defines which operations will be possible with the models (all, only add, edit, delete...) "all"
form Defines the load route of the form that will open in a window, lazy-loading can be used with an import { loadComponent: () => import('../(path)/client-form.component'), aocUiWindowDynConfig: { width: 1280, height: 800 } }
socketExtraSubscriptions Array of model types on which changes will also be listened to [ClientType]
payload A server AocFilter (function) that will be executed (used for searches), or directly define the search criteria with a Query builder { fnName: 'clientFilter', type: 'filter' }
transform Pipe to convert the model to a string transform(client: Client) {

It provides methods that are shortcuts: canAdd(), canEdit(), canDelete(), canClone(), cloneWith(...).

Examples #

Allow #

Of type AocModelConfigAllow, accepts values like 'all' or 'none'.

  readonly allow: AocModelConfigAllow = 'all';

Form #

Lazy-loading of a form (which will appear in a window)

  readonly form = {
    loadComponent: () => import('../../features/schemas/customer/customers/customer-form.component'),
    aocUiWindowDynConfig: {
      width: 1280,
      height: 800
    }
  };

Socketextrasubscriptions #

Models on which changes (database operations) will be notified are defined.

  readonly socketExtraSubscriptions: AocModelConfigSocketExtraSubscriptions = [CustomerType];

Payload #

Of type AocModelConfigServerPayload, here the filter function registered on the server with the name customerFilter would be executed.

  readonly payload: AocModelConfigServerPayload = {
    fnName: 'customerFilter',
    type: 'filter'
  };

Transform #

It is the implementation of the transform method, which, if we add @Pipe in the modelConfig class, we can use in the templates.

  transform(customer: Customer) {
    return `${customer.code} - ${customer.fiscal_name}`;
  }

Clone #

The implemented clone function will receive a model and should return either a new model (i.e., cloned) or a promise returning that model.

Complete example at quest-client/src/app/model-configs/customers/customer-model-config.ts

Api #

Full definition in the API.

Please note, browse Issues and Discussions in Github for more information

© 2025 Atlantis of Code. All rights reserved.
All trademarks are the property of their respective owners.