saving data
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,8 +3,6 @@ package-lock.json
|
||||
node_modules
|
||||
_/build
|
||||
content
|
||||
db/*
|
||||
server/db/users.json
|
||||
server/.env
|
||||
abetaccredited.html
|
||||
qrCodes/qr_codes
|
||||
|
||||
321
db/db.json
Normal file
321
db/db.json
Normal file
@@ -0,0 +1,321 @@
|
||||
{
|
||||
"nodes": {
|
||||
"HY-1": {
|
||||
"fullName": "Founder"
|
||||
},
|
||||
"MEMBER-samrussell99@pm.me": {
|
||||
"email": "samrussell99@pm.me",
|
||||
"firstName": "Sam",
|
||||
"lastName": "Russell",
|
||||
"password": "$argon2id$v=19$m=65536,t=3,p=4$LEd8Zx9YXccDMQyyBYp1oA$+zNo5x6BRRhCcsKvX2zcEAvdth/+tqwN1uqZ8Di/71w",
|
||||
"address": {
|
||||
"address1": "2014 E 9th St",
|
||||
"address2": "Unit A",
|
||||
"zip": "78702",
|
||||
"state": "Texas",
|
||||
"city": "Austin"
|
||||
}
|
||||
},
|
||||
"TOKEN-810387b6-851e-4883-b9a3-c59703dc0fc9": {
|
||||
"index": 1,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "810387b6-851e-4883-b9a3-c59703dc0fc9",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-d0b417c4-d69a-4958-9e1d-0658176d2710": {
|
||||
"index": 2,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "d0b417c4-d69a-4958-9e1d-0658176d2710",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-1719b6d8-9b13-4720-ab94-9af5cbe42137": {
|
||||
"index": 3,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "1719b6d8-9b13-4720-ab94-9af5cbe42137",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-16659e04-afbb-4192-9195-90f2f49277b2": {
|
||||
"index": 4,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "16659e04-afbb-4192-9195-90f2f49277b2",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-88abc4b3-8416-4499-9fa7-6778841e4b23": {
|
||||
"index": 5,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "88abc4b3-8416-4499-9fa7-6778841e4b23",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-e3342dd5-a214-4280-9488-f48f91e728ce": {
|
||||
"index": 6,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "e3342dd5-a214-4280-9488-f48f91e728ce",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-a8176432-4e72-42b7-ac9a-2d799039f729": {
|
||||
"index": 7,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "a8176432-4e72-42b7-ac9a-2d799039f729",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-1d57b6e0-e6c3-4ab6-808f-72b64b8303ee": {
|
||||
"index": 8,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "1d57b6e0-e6c3-4ab6-808f-72b64b8303ee",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-67264f06-c4b1-4334-8ba8-0e5e045021df": {
|
||||
"index": 9,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "67264f06-c4b1-4334-8ba8-0e5e045021df",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-e9fa5701-d90f-45d0-8e2b-7c3ef9022362": {
|
||||
"index": 10,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "e9fa5701-d90f-45d0-8e2b-7c3ef9022362",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-c082880a-f12c-4eb0-b136-e11df9e6bde8": {
|
||||
"index": 11,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "c082880a-f12c-4eb0-b136-e11df9e6bde8",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-083a18f5-6491-4dbf-9a28-2b22b6b4a5bd": {
|
||||
"index": 12,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "083a18f5-6491-4dbf-9a28-2b22b6b4a5bd",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-af94443c-a0c5-4c58-a2e5-16a8c6d573c8": {
|
||||
"index": 13,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "af94443c-a0c5-4c58-a2e5-16a8c6d573c8",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-5673dd07-25b1-441f-abbc-89b5e5a2b3e9": {
|
||||
"index": 14,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "5673dd07-25b1-441f-abbc-89b5e5a2b3e9",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-f2b30979-1ece-41e1-87ec-6a102a21e809": {
|
||||
"index": 15,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "f2b30979-1ece-41e1-87ec-6a102a21e809",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-d52c1bcc-8b97-4535-8395-dfdab4ee543a": {
|
||||
"index": 16,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "d52c1bcc-8b97-4535-8395-dfdab4ee543a",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-7fed8604-1801-4500-8615-2ac8eb50c896": {
|
||||
"index": 17,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "7fed8604-1801-4500-8615-2ac8eb50c896",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-e312c854-8df7-4c68-9f3f-1822b718b092": {
|
||||
"index": 18,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "e312c854-8df7-4c68-9f3f-1822b718b092",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-5979853c-1755-4403-bea5-3b111384ffb3": {
|
||||
"index": 19,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "5979853c-1755-4403-bea5-3b111384ffb3",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-d93307e4-a0a0-4b4a-86d0-897ca5382cdd": {
|
||||
"index": 20,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "d93307e4-a0a0-4b4a-86d0-897ca5382cdd",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-b73b803a-c49d-4ea9-b8ed-f04be0373157": {
|
||||
"index": 21,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "b73b803a-c49d-4ea9-b8ed-f04be0373157",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-5a0a7a8c-f080-4708-a2e1-fcd2d613adb1": {
|
||||
"index": 22,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "5a0a7a8c-f080-4708-a2e1-fcd2d613adb1",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-99c547fe-1ec1-4ddc-bfcb-b95d73fdd907": {
|
||||
"index": 23,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "99c547fe-1ec1-4ddc-bfcb-b95d73fdd907",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-6da35b58-81ea-478f-9ef5-8a70b407bfcf": {
|
||||
"index": 24,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "6da35b58-81ea-478f-9ef5-8a70b407bfcf",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-402f4f83-165b-4b5a-b1f2-3dccc7ec5ef6": {
|
||||
"index": 25,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "402f4f83-165b-4b5a-b1f2-3dccc7ec5ef6",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-04afd891-1250-4a6d-b239-3bdd06082c71": {
|
||||
"index": 26,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "04afd891-1250-4a6d-b239-3bdd06082c71",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-c807c67f-2d8d-4f54-b657-8cb3aaf19b28": {
|
||||
"index": 27,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "c807c67f-2d8d-4f54-b657-8cb3aaf19b28",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-5cf7639e-22b3-4469-8155-d490cc164367": {
|
||||
"index": 28,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "5cf7639e-22b3-4469-8155-d490cc164367",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-90e82173-c7f8-47d9-9619-b333e032d1af": {
|
||||
"index": 29,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "90e82173-c7f8-47d9-9619-b333e032d1af",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-5eed9d33-81ea-420f-834b-a71b01eb6f54": {
|
||||
"index": 30,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "5eed9d33-81ea-420f-834b-a71b01eb6f54",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-2e96ecaa-bf8e-403c-89f3-8b2924788df3": {
|
||||
"index": 31,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "2e96ecaa-bf8e-403c-89f3-8b2924788df3",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-7edb52b1-35ce-42c6-8cd0-341f3ee38f4c": {
|
||||
"index": 32,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "7edb52b1-35ce-42c6-8cd0-341f3ee38f4c",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-ad5f483d-338f-4efc-936d-8253854b38a5": {
|
||||
"index": 33,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "ad5f483d-338f-4efc-936d-8253854b38a5",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-d49a3c80-d0b8-4796-b1e2-f42d5ae0cc69": {
|
||||
"index": 34,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "d49a3c80-d0b8-4796-b1e2-f42d5ae0cc69",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-382a7ffd-9227-4edc-8bc6-8c3ae82ccf14": {
|
||||
"index": 35,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "382a7ffd-9227-4edc-8bc6-8c3ae82ccf14",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-27762835-f211-4c72-8187-b3f87ccb846c": {
|
||||
"index": 36,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "27762835-f211-4c72-8187-b3f87ccb846c",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-7344f7ce-2609-46f4-b2cb-28dafc547270": {
|
||||
"index": 37,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "7344f7ce-2609-46f4-b2cb-28dafc547270",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-fd23ce26-d78a-49fc-b198-1a73071a2db4": {
|
||||
"index": 38,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "fd23ce26-d78a-49fc-b198-1a73071a2db4",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-869227be-1c80-421f-a17e-e052929c43e3": {
|
||||
"index": 39,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "869227be-1c80-421f-a17e-e052929c43e3",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-3ac9b048-a132-4fad-bb2d-9bb1820592c8": {
|
||||
"index": 40,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "3ac9b048-a132-4fad-bb2d-9bb1820592c8",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-7d9c71ac-646b-4a6b-b758-f55f632cec6f": {
|
||||
"index": 41,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "7d9c71ac-646b-4a6b-b758-f55f632cec6f",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-6ad3a682-14fa-48d7-96bd-fd61b2b314dd": {
|
||||
"index": 42,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "6ad3a682-14fa-48d7-96bd-fd61b2b314dd",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-c02ae012-089a-4c3b-bd28-8d7cedc2df0d": {
|
||||
"index": 43,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "c02ae012-089a-4c3b-bd28-8d7cedc2df0d",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-df82c2b6-bd8c-4b69-bc8c-a1d7df53727c": {
|
||||
"index": 44,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "df82c2b6-bd8c-4b69-bc8c-a1d7df53727c",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-1444c46c-4985-4e52-8cbf-f6d77795deae": {
|
||||
"index": 45,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "1444c46c-4985-4e52-8cbf-f6d77795deae",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-38954160-0865-4f55-b190-e2a5a2268df1": {
|
||||
"index": 46,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "38954160-0865-4f55-b190-e2a5a2268df1",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-0e88166f-936a-4156-a89d-e71e825db36e": {
|
||||
"index": 47,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "0e88166f-936a-4156-a89d-e71e825db36e",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-a94aee8f-c47d-4606-a734-69355dfc642e": {
|
||||
"index": 48,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "a94aee8f-c47d-4606-a734-69355dfc642e",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-de407269-9e31-485b-a857-5ba5d1a5ca5b": {
|
||||
"index": 49,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "de407269-9e31-485b-a857-5ba5d1a5ca5b",
|
||||
"used": false
|
||||
},
|
||||
"TOKEN-f2016b40-a179-47ec-a415-84caa7da8521": {
|
||||
"index": 50,
|
||||
"url": "https://hyperia.so/signup?token=",
|
||||
"uuid": "f2016b40-a179-47ec-a415-84caa7da8521",
|
||||
"used": false
|
||||
}
|
||||
},
|
||||
"edges": {}
|
||||
}
|
||||
BIN
db/images/1.jpg
Normal file
BIN
db/images/1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 179 KiB |
37
db/processJSON.js
Normal file
37
db/processJSON.js
Normal file
@@ -0,0 +1,37 @@
|
||||
import fs from "fs/promises";
|
||||
import path from "path";
|
||||
|
||||
async function processJSON() {
|
||||
// 1. Read original JSON
|
||||
const inputPath = path.join(process.cwd(), "db/tokens.json");
|
||||
const raw = await fs.readFile(inputPath, "utf8");
|
||||
const data = JSON.parse(raw);
|
||||
|
||||
// 2. Create a new result object
|
||||
const result = {};
|
||||
|
||||
// 3. Loop through all entries and modify as needed
|
||||
const entries = Object.entries(data);
|
||||
|
||||
for (const [i, [key, value]] of entries.entries()) {
|
||||
console.log(i);
|
||||
// ==== CHANGE THINGS HERE ====
|
||||
const newValue = {
|
||||
"labels": value.labels,
|
||||
"index": i+1,
|
||||
"url": value.url,
|
||||
"used": false
|
||||
};
|
||||
// =============================
|
||||
|
||||
// 4. Put modified entry into result
|
||||
result[key] = newValue;
|
||||
}
|
||||
|
||||
// 5. Write output JSON
|
||||
const outputPath = path.join(process.cwd(), "db/output.json");
|
||||
const jsonString = JSON.stringify(result, null, 2);
|
||||
await fs.writeFile(outputPath, jsonString, "utf8");
|
||||
}
|
||||
|
||||
processJSON();
|
||||
@@ -46,10 +46,37 @@ export default class Database {
|
||||
} catch(e) {
|
||||
throw e
|
||||
}
|
||||
|
||||
}
|
||||
this.saveData()
|
||||
}
|
||||
|
||||
async saveData() {
|
||||
let data = {
|
||||
"nodes": {
|
||||
|
||||
},
|
||||
"edges": {
|
||||
|
||||
}
|
||||
}
|
||||
let arrs = [
|
||||
this.titles.entries,
|
||||
this.members.entries,
|
||||
this.tokens.entries
|
||||
]
|
||||
let ids = [
|
||||
Object.entries(this.titles.ids),
|
||||
Object.entries(this.members.ids),
|
||||
Object.entries(this.tokens.ids),
|
||||
]
|
||||
for(let i=0; i<arrs.length; i++) {
|
||||
let arr = arrs[i]
|
||||
for(let j=0; j<arr.length; j++) {
|
||||
data.nodes[ids[i][j][0]] = arr[j]
|
||||
}
|
||||
}
|
||||
|
||||
saveData() {
|
||||
|
||||
await fs.writeFile(path.join(process.cwd(), 'db/db.json'), JSON.stringify(data, null, 4), "utf8");
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ export default class Members extends OrderedObject {
|
||||
} else {
|
||||
throw new global.ServerError(400, "Invalid Member Data!");
|
||||
}
|
||||
global.db.saveData()
|
||||
}
|
||||
|
||||
getByEmail(email) {
|
||||
|
||||
Reference in New Issue
Block a user