ca25a7e28e8b016d24ffe0bc4c556d2db30e7bc0 — Cédric Bonhomme 6 months ago abd6d3f
added a command to delete inactive users (number of months given in parameter).
1 files changed, 16 insertions(+), 1 deletions(-)

M newspipe/commands.py
M newspipe/commands.py => newspipe/commands.py +16 -1
@@ 3,7 3,8 @@

import logging
import os
from datetime import datetime
from dateutil.relativedelta import relativedelta
from datetime import datetime, date

import click
from werkzeug.security import generate_password_hash

@@ 62,6 63,20 @@ def delete_user(user_id=None):

@click.option('--last-seen', default=6, help='Number of months since last seen.')
def delete_inactive_users(last_seen):
    "Delete inactive users."
    filter["last_seen__lt"] = date.today() - relativedelta(months=last_seen)
        user = UserController().read(**filter).all()
        for us in user:
        print("Inactive users deleted.")
    except Exception as e:

@click.option('--user-id', default=None, help='Id of the user')
@click.option('--feed-id', default=None, help='If of the feed')