openfun / joanie

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

⚡️(back) improve client certificate endpoint performance #703

Closed lunika closed 5 months ago

lunika commented 5 months ago

Purpose

The client certificate endpoint has a performace issue. The sql query executed is not perofrmant at all. There are a lot of join made and the where clause is filtering on two of the join made (between enrollment and user + order and user). On the retrieve action, the username check is made once the certificate retrieve in database. On the list action, we filter certificated linked only on order or enrollment but never both at the same time. For this, a filterset is created and customize to have the type filter with a default value on order.

Proposal