In Hyperledger Fabric, one asset has multiple transactions. These transactions update the state of the asset and maintain a trace as well.
Currently, if I want to have different transaction types for one asset, then I've written different functions in the chaincode which correspond to transaction types.
For example: If my assets are Cars, then each asset can have transactions of types sale, purchase, service, repair, etc. For each of these purchase, repair, service, etc., I've written a function in chaincode which gets invoked based on the type of transaction that is sent as input (type of transaction is sent as an argument in peer chaincode invoke command).
Do you think this is a good approach? What do you follow? What is recommended to achieve different transaction types? Also, how can I enforce different endorsement policies for different transaction types?
Note: I'm aware of the asset based (or key based) endorsement policies (Fabric v1.4) that can be written in chaincode. But this does not allow me to configure endorsement policies based on transaction types.