openfun / joanie

👛 A headless ERP for education to manage course enrollment/subscription, payment and certificates delivery.
MIT License
22 stars 2 forks source link

♻️ Model Versioning - Product, Contract Definition, Certificate Definition #417

Open jbpenrath opened 1 year ago

jbpenrath commented 1 year ago

Feature Request

Is your feature request related to a problem or unsupported use case? Please describe.

Currently, Joanie does not manage model versioning. But, this appears to be relevant for Product, ContractDefinition and CertificateDefinition models.

Indeed, about Product, currently, on order creation, we are copying target course relations from Product to Order that does not scale very well. About, ContractDefinition and CertificateDefinition models, if one definition change, the issued document related to this definition will reflect those changes, that is weird.

Describe the solution you'd like

  1. Add a ForeignKey field on those models to create inheritance relation between resources.
  2. Make those models immutable. (Prevent to update those resources from api endpoint).

Describe alternatives you've considered

sampaccoud commented 1 year ago

I'm not sure about CertificateDefinition. The information is that you have complete a course with a certain grades. This information is held on the Certificate model. If you change name, or we change the template, I would argue that the certificate should change as well. What do you think?

jbpenrath commented 1 year ago

Actually, I thought about that because currently if we update CertificateDefinition template, we could have to update the Certificate document context (if new data are required by the template). From my point view, versioning CertificateDefinition will prevent this drawback. But this is surely something acceptable to update existing Certificate context if we update the CertificateDefinition template.