This project can be used as a seed when you want to start building a Carol app.
Carol is a data platform with Machine Learning developed and maintained by Totvs Labs.
This project is constantly maintained and updated by TOTVS Labs. At the same time we encourage you to open a PR with your improvements and contribute.
The project was generated with Angular CLI version 7.1.3, it also contains PO-UI 2.3.0 and some extra features to make your life easier when building a Carol App and retrieving data from Carol.
- Ability to easily change the target Tenant. For this edit the file
proxy.conf.json
in the root of the project. - Authentication page.
- An interceptor that will automatically add the auth token in every HTTP request.
- PO-UI is ready to use.
- A script that will connect to your tenant, download the Data Models schema and generate Typescript classes so you have typings in the FE.
- A service called
carol.service.ts
which wraps the logic to build queries, save and delete data.
- Install Node.js
- Clone this repo
git clone https://github.com/totvslabs/carolapp-std-tface
- Install Angular as a global dependency:
npm install -g @angular/cli
- Install the project dependencies:
npm install
- Set your tenant in the file
proxy.conf.json
- Run the command
npm run update-datamodels
to generate the classes for the data models available in your tenant - Start coding
The easiest way to get data from Carol is generating the Data Models and using the built-in Carol service, it should support the most common types of Queries.
Inject the Carol service:
import { Carol } from 'src/app/services/carol.service';
constructor(
private carol: Carol
) {}
Build a query using the Data Models generated:
this.carol.query<Customer>()
.from(Customer)
.and(Customer.mdmGoldenFieldAndValues.mdmname).equals('John')
.pageSize(1)
.execute()
.subscribe(response => {
...
});
To save a Golden record you can also use the Carol service:
const customer = new Customer();
customer.mdmGoldenFieldAndValues.mdmname = 'John';
this.carol.postGolden(Customer, customer.mdmGoldenFieldAndValues)
.subscribe(response => {
...
});
To update a golden record:
const customer: Customer;
customer.mdmGoldenFieldAndValues.mdmname = 'John';
this.carol.updateGolden(Customer, customer.mdmId, customer.mdmGoldenFieldAndValues)
.subscribe(response => {
...
});
To delete a golden record:
const customer: Customer;
this.carol.deleteGolden(Customer, customer.mdmId).subscribe(response => ...);
To run a Named Query:
this.carol.query()
.named('myNamedQuery')
.params({
name: 'John'
})
.execute()
.subscribe(response => {
...
});
- Keep the dependencies up-to-date
- Improve the Query builder with more complex Aggregations
- Improve the Documentation
- Generate model for Named Queries and Type named queries response
- Automate the process to deploy the app
Run npm start
for a dev server. Navigate to http://localhost:3000/
. The app will automatically reload if you change any of the source files.
Run ng build --prod
to build the project. The build artifacts will be stored in the dist/
directory.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
For further help feel free to open an issue.