Skip to content

Latest commit

 

History

History
39 lines (25 loc) · 2.23 KB

File metadata and controls

39 lines (25 loc) · 2.23 KB

Shared

This package contains utility functions, classes, types, etc. that are shared between the frontend and the backend.

Keep in mind to add new exports to the index.ts file in the folde r.

Architecture

Updates to state schema and migrations

Note that whenever the state types get updated you have to increase currentStateVersion in state.ts.

In addition, you have to add a migration in state-migrations. Look at ./src/state-migrations/migration-functions.ts for more information.

To test the migrations, you can run the tests.

Adding new actions

When writing new actions, note the comments in src/store/action-reducer.ts and src/store/action-reducers/action-reducers.ts. You can orient yourself at the already existing actions in src/store/action-reducers. Note especially that new actions have to be registered in actionReducers in src/store/action-reducers/action-reducers.ts.

Adding new models

When adding new models to the state, you should write a new schema within src/models and add a new attribute to the exercise state.

Validation

We are using Zod schemas for validating all elements in the state and all actions. It is desirable to narrow down the types of the validation as much as possible, within reason.