Added shortcode to agents
This commit is contained in:
parent
aea56100e2
commit
43a336d82f
@ -32,4 +32,6 @@ This client did not ask for any renting. So everything will be sale only, the pr
|
||||
|
||||
In reality, this specific backend is pretty much done (although there's more to come). The only thing left to do is add authentication to all the admin routes.
|
||||
For this, there's a couple of choices.
|
||||
One is connect with user service (Our already created service for authentication). But this does not have email or sms access in case the client forgets his password. So I would instead connect this with a service like google authentication so that the client can connect his account with google. This means the database must have a new table named admins that contains everything regarding authentication. A part of the migration should be adding the client's user, as for now it shall only be him.
|
||||
One is connect with user service (Our already created service for authentication). But this does not have email or sms access in case the client forgets his password. So I would instead connect this with a service like google authentication so that the client can connect his account with google. This means the database must have a new table named admins that contains everything regarding authentication. A part of the migration should be adding the client's user, as for now it shall only be him.
|
||||
|
||||
Filtering by rooms as well
|
@ -1,5 +1,6 @@
|
||||
CREATE TABLE IF NOT EXISTS "agent" (
|
||||
id UUID PRIMARY KEY,
|
||||
shortcode VARCHAR UNIQUE NOT NULL,
|
||||
full_name VARCHAR NOT NULL,
|
||||
credential VARCHAR NOT NULL,
|
||||
credential_type VARCHAR NOT NULL,
|
||||
|
@ -1,5 +1,6 @@
|
||||
SELECT
|
||||
id,
|
||||
shortcode,
|
||||
full_name,
|
||||
credential,
|
||||
credential_type as "credential_type: _",
|
||||
@ -7,4 +8,4 @@ SELECT
|
||||
time_created,
|
||||
last_updated
|
||||
FROM agent
|
||||
ORDER BY time_created DESC;
|
||||
ORDER BY full_name DESC;
|
@ -1,5 +1,6 @@
|
||||
SELECT
|
||||
id,
|
||||
shortcode,
|
||||
full_name,
|
||||
credential,
|
||||
credential_type as "credential_type: _",
|
||||
|
11
sql/agent/fetch_with_shortcode.sql
Normal file
11
sql/agent/fetch_with_shortcode.sql
Normal file
@ -0,0 +1,11 @@
|
||||
SELECT
|
||||
id,
|
||||
shortcode,
|
||||
full_name,
|
||||
credential,
|
||||
credential_type as "credential_type: _",
|
||||
profile_picture_url,
|
||||
time_created,
|
||||
last_updated
|
||||
FROM agent where shortcode = $1
|
||||
ORDER BY time_created DESC;
|
@ -1,9 +1,10 @@
|
||||
SELECT
|
||||
id,
|
||||
full_name,
|
||||
credential,
|
||||
credential_type as "credential_type: _",
|
||||
profile_picture_url,
|
||||
time_created,
|
||||
last_updated
|
||||
id,
|
||||
shortcode,
|
||||
full_name,
|
||||
credential,
|
||||
credential_type as "credential_type: _",
|
||||
profile_picture_url,
|
||||
time_created,
|
||||
last_updated
|
||||
FROM agent WHERE id = $1
|
@ -1,9 +1,10 @@
|
||||
INSERT INTO agent (
|
||||
id, full_name, credential, credential_type, profile_picture_url, time_created, last_updated
|
||||
id, shortcode, full_name, credential, credential_type, profile_picture_url, time_created, last_updated
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5, $6, $6
|
||||
$1, $2, $3, $4, $5, $6, $7, $7
|
||||
) RETURNING
|
||||
id,
|
||||
shortcode
|
||||
full_name,
|
||||
credential,
|
||||
credential_type as "credential_type: _",
|
||||
|
@ -1,12 +1,14 @@
|
||||
UPDATE agent SET
|
||||
full_name = $1,
|
||||
credential = $2,
|
||||
credential_type = $3,
|
||||
profile_picture_url = $4,
|
||||
last_updated = $5
|
||||
WHERE id = $6
|
||||
shortcode = $2,
|
||||
credential = $3,
|
||||
credential_type = $4,
|
||||
profile_picture_url = $5,
|
||||
last_updated = $6
|
||||
WHERE id = $7
|
||||
RETURNING
|
||||
id,
|
||||
shortcode,
|
||||
full_name,
|
||||
credential,
|
||||
credential_type as "credential_type: _",
|
||||
|
Loading…
Reference in New Issue
Block a user