Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add queries admin tool. #699

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Add queries admin tool. #699

wants to merge 9 commits into from

Conversation

Andrei-Dolgolev
Copy link
Contributor

@Andrei-Dolgolev Andrei-Dolgolev commented Nov 14, 2022

Changes

Extend mnstr CLI:

Added command parser queries.

Available command:

ensure-canonical-tags

Go cross all BUGOUT_RESOURCE_QUERY_RESOLVER resources and check if entry have all required tags currently ["user_name", "query_name", "user_id", "query_id"] and update entry if they don't have that tags information getting from resource data.

mnstr queries ensure-canonical-tags

get users with queries stats

mnstr queries get-users

result:

{
    "<user_id>": {
        "user_id": "<user_id>",
        "user_name": "<user_name>",
        "queries_count": "<count of created queries>"
    },
...
}

get user queries

mnstr queries get-user-queries -u <user-id>

result:

<query_id> name: <query_name> status: [approved|preapprove]
<query_id> name: <query_name> status: [approved|preapprove]
...

copy queries from user to user

Copy queries from 1 user to another if query already approved and don't have preaprove tag will add approved as well

mnstr queries copy-user-queries -f <from_user_id> -t <to_user_token>

How to test these changes?

Related issues

Copy link
Contributor

@kompotkot kompotkot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lg

}

# get entries
for query_id in queries:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one suggestion to add in each loop some print with id to understand it is running

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants