From 9ef712dc3b66c906d7fcc1d1f282d47f01a8bb1e Mon Sep 17 00:00:00 2001 From: Mini256 Date: Mon, 27 Jun 2022 15:42:08 +0800 Subject: [PATCH] query: add get user by login query (#486) * query: add get user by login query * fix: fix login param pattern --- api/queries/get-user-by-login/params.json | 10 ++++++++++ api/queries/get-user-by-login/template.sql | 1 + 2 files changed, 11 insertions(+) create mode 100644 api/queries/get-user-by-login/params.json create mode 100644 api/queries/get-user-by-login/template.sql diff --git a/api/queries/get-user-by-login/params.json b/api/queries/get-user-by-login/params.json new file mode 100644 index 00000000000..e6e6088f0c7 --- /dev/null +++ b/api/queries/get-user-by-login/params.json @@ -0,0 +1,10 @@ +{ + "cacheHours": 1, + "params": [ + { + "name": "login", + "replaces": "Mini256", + "pattern": "^[a-zA-Z0-9][a-zA-Z0-9-\\[\\]]{0,38}$" + } + ] +} diff --git a/api/queries/get-user-by-login/template.sql b/api/queries/get-user-by-login/template.sql new file mode 100644 index 00000000000..4a36035f7d3 --- /dev/null +++ b/api/queries/get-user-by-login/template.sql @@ -0,0 +1 @@ +select actor_id AS id, 'Mini256' AS login from github_events where actor_login = 'Mini256' limit 1;