Added shortcode to agents

This commit is contained in:
Franklin 2023-04-14 14:42:52 -04:00
parent aea56100e2
commit 43a336d82f
8 changed files with 36 additions and 16 deletions

View File

@ -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

View File

@ -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,

View File

@ -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;

View File

@ -1,5 +1,6 @@
SELECT
id,
shortcode,
full_name,
credential,
credential_type as "credential_type: _",

View 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;

View File

@ -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

View File

@ -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: _",

View File

@ -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: _",