Aggregation with two different conditions

Hi everyone,

I need to do a aggregation using 2 different columns like Date and Quantity, where the result of quantity need to be less of 100 and the diff of days need to be less than 30 days

ex database:

date | qty

01/01/2024 | 30

01/02/2024 | 50

01/03/2024 | 40

01/04/2024 | 30

03/01/2024 | 20

05/01/2024 | 10

result:

start date | end date | qty

01/01/2024 | 01/02/2024 | 80

01/03/2024 | 01/04/2024 | 70

03/01/2024 | 03/01/2024 | 20

05/01/2024 | 05/01/2024 | 10