Once we have our data out in to a datasource, we can add it to our repository pattern and we are soooo nearly there !
Code for these posts is avalible in our TimeDashboard Repository FrontEnd (typescript) & Backend (c#)
Tree Repository.
Again to save on so much code, we are extending an umbraco UmbTreeRepositoryBase class. 
This class takes our item/entity models. which is why we set them up first.
export class TimeTreeRepository extends 
    UmbTreeRepositoryBase<TimeTreeItemModel, TimeTreeRootModel>
    implements UmbApi
in our constructore we pass our datasource, and a refernce to the store context.
    constructor(host: UmbControllerHost) {
        super(host, TimeTreeServerDataSource, TIME_TREE_STORE_CONTEXT);
    }
The all we have to do is prodivde a requestTreeRoot method to return our tree route model
    async requestTreeRoot() {
        const data: TimeTreeRootModel = {
            unique: null,
            entityType: TIME_TREE_ROOT_ITEM_TYPE,
            name: 'time',
            hasChildren: true,
            isFolder: true,
        };
        return { data };
    }
now we have a repo, we are set to define everything....
 

 
    
Top comments (0)