small naming improvments
This commit is contained in:
parent
3b71faa3e7
commit
3327b6a1ee
3 changed files with 6 additions and 9 deletions
|
|
@ -7,7 +7,7 @@ source "$(dirname "$0")/../.env"
|
||||||
UUID=$(uuidgen)
|
UUID=$(uuidgen)
|
||||||
|
|
||||||
# Create a fake inviter_npub (using a random string here)
|
# Create a fake inviter_npub (using a random string here)
|
||||||
INVITER_NPUB="fake_inviter_${RANDOM}"
|
INVITER_PUB_KEY="fake_inviter_${RANDOM}"
|
||||||
|
|
||||||
# Get the current timestamp for created_at
|
# Get the current timestamp for created_at
|
||||||
CREATED_AT=$(date +"%Y-%m-%d %H:%M:%S")
|
CREATED_AT=$(date +"%Y-%m-%d %H:%M:%S")
|
||||||
|
|
@ -18,13 +18,13 @@ POSTGRES_CONTAINER_NAME=$(docker compose ps -q postgres | xargs docker inspect -
|
||||||
# Connect to the Postgres container and insert the fake record into the app_invite table
|
# Connect to the Postgres container and insert the fake record into the app_invite table
|
||||||
docker exec -i "$POSTGRES_CONTAINER_NAME" psql -v -U "$POSTGRES_USER" -d "$POSTGRES_DB" -h localhost -p 5432 -c "
|
docker exec -i "$POSTGRES_CONTAINER_NAME" psql -v -U "$POSTGRES_USER" -d "$POSTGRES_DB" -h localhost -p 5432 -c "
|
||||||
INSERT INTO app_invite_created (uuid, inviter_npub, created_at)
|
INSERT INTO app_invite_created (uuid, inviter_npub, created_at)
|
||||||
VALUES ('$UUID', '$INVITER_NPUB', '$CREATED_AT')
|
VALUES ('$UUID', '$INVITER_PUB_KEY', '$CREATED_AT')
|
||||||
RETURNING *;
|
RETURNING *;
|
||||||
"
|
"
|
||||||
|
|
||||||
# Print the generated values
|
# Print the generated values
|
||||||
echo "Inserted app_invite_created Record:"
|
echo "Inserted app_invite_created Record:"
|
||||||
echo "UUID: $UUID"
|
echo "UUID: $UUID"
|
||||||
echo "Inviter Npub: $INVITER_NPUB"
|
echo "Inviter Npub: $INVITER_PUB_KEY"
|
||||||
echo "Created At: $CREATED_AT"
|
echo "Created At: $CREATED_AT"
|
||||||
echo "Try it at http://localhost/invite/$UUID"
|
echo "Try it at http://localhost/invite/$UUID"
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ const AppInviteCreated = sequelize.define('AppInviteCreated', {
|
||||||
unique: true,
|
unique: true,
|
||||||
primaryKey: true
|
primaryKey: true
|
||||||
},
|
},
|
||||||
inviter_npub: {
|
inviter_pub_key: {
|
||||||
type: DataTypes.STRING,
|
type: DataTypes.STRING,
|
||||||
allowNull: false,
|
allowNull: false,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,7 @@ const AppInviteCreated = require('../models/AppInviteCreated');
|
||||||
const SignUpChallengeCreated = require('../models/SignUpChallengeCreated');
|
const SignUpChallengeCreated = require('../models/SignUpChallengeCreated');
|
||||||
const SignUpChallengeCompleted = require('../models/SignUpChallengeCompleted');
|
const SignUpChallengeCompleted = require('../models/SignUpChallengeCompleted');
|
||||||
|
|
||||||
|
|
||||||
const errors = require('../errors');
|
const errors = require('../errors');
|
||||||
const NostrChallengeCompleted = require('../models/NostrChallengeCompleted');
|
|
||||||
const { sortEvents } = require('nostr-tools');
|
|
||||||
|
|
||||||
async function appInviteExists(inviteUuid) {
|
async function appInviteExists(inviteUuid) {
|
||||||
const invite = await AppInviteCreated.findOne({ where: { uuid: inviteUuid } });
|
const invite = await AppInviteCreated.findOne({ where: { uuid: inviteUuid } });
|
||||||
|
|
@ -36,10 +33,10 @@ async function isAppInviteSpent(appInviteUuid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createAppInvite(inviterNpub) {
|
async function createAppInvite(inviterPubKey) {
|
||||||
return await AppInviteCreated.create({
|
return await AppInviteCreated.create({
|
||||||
uuid: uuid.v7(),
|
uuid: uuid.v7(),
|
||||||
inviter_npub: inviterNpub,
|
inviter_pub_key: inviterPubKey,
|
||||||
created_at: new Date().toISOString()
|
created_at: new Date().toISOString()
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue