mirror of
https://github.com/Permissionless-Software-Foundation/bch-dex.git
synced 2026-09-22 01:02:00 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a96eac8c9 | ||
|
|
a2acdef539 | ||
|
|
58ddbbcc4e | ||
|
|
5ff33ff19f | ||
|
|
682f599261 | ||
|
|
7c26e33a8c | ||
|
|
2595ee8295 | ||
|
|
531685c0e4 | ||
|
|
476fdcd0aa | ||
|
|
b6762b215e |
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
Database model for tracking deleted Nostr chat messages.
|
||||
*/
|
||||
|
||||
import mongoose from 'mongoose'
|
||||
|
||||
const DeletedChat = new mongoose.Schema({
|
||||
eventId: { type: String, required: true, default: null }, // Event ID of the deleted message.
|
||||
npub: { type: String, default: null }, // Nostr public key of the user who created the message.
|
||||
bchAddr: { type: String, default: null }, // bch address of the user who created the message.
|
||||
pubkey: { type: String, default: null }, // Nostr public key of the user who created the message.
|
||||
createdAt: { type: Date, default: Date.now },
|
||||
updatedAt: { type: Date, default: Date.now }
|
||||
})
|
||||
|
||||
export default mongoose.model('deletedChat', DeletedChat)
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
Database model for tracking deleted Nostr posts.
|
||||
*/
|
||||
|
||||
import mongoose from 'mongoose'
|
||||
|
||||
const DeletedPost = new mongoose.Schema({
|
||||
eventId: { type: String, required: true, default: null }, // Event ID of the deleted post.
|
||||
npub: { type: String, default: null }, // Nostr public key of the user who created the post.
|
||||
bchAddr: { type: String, default: null }, // bch address of the user who created the post.
|
||||
pubkey: { type: String, default: null }, // Nostr public key of the user who created the post.
|
||||
createdAt: { type: Date, default: Date.now },
|
||||
updatedAt: { type: Date, default: Date.now }
|
||||
})
|
||||
|
||||
export default mongoose.model('deletedPost', DeletedPost)
|
||||
@@ -0,0 +1,31 @@
|
||||
import mongoose from 'mongoose'
|
||||
import config from '../../../config/index.js'
|
||||
import User from '../../../src/adapters/localdb/models/users.js'
|
||||
|
||||
async function getUsers () {
|
||||
// Connect to the Mongo Database.
|
||||
mongoose.Promise = global.Promise
|
||||
mongoose.set('useCreateIndex', true) // Stop deprecation warning.
|
||||
await mongoose.connect(
|
||||
config.database,
|
||||
{ useNewUrlParser: true, useUnifiedTopology: true }
|
||||
)
|
||||
|
||||
// Find the user by email.
|
||||
const user = await User.findOne({
|
||||
email: 'test@test.com'
|
||||
}, '-password')
|
||||
// console.log('user: ', user)
|
||||
|
||||
// Update the users password
|
||||
user.password = 'test'
|
||||
|
||||
// Change the user to an admin
|
||||
// user.type = 'admin'
|
||||
|
||||
// Save the changes to the database.
|
||||
await user.save()
|
||||
|
||||
mongoose.connection.close()
|
||||
}
|
||||
getUsers()
|
||||
@@ -0,0 +1,32 @@
|
||||
import mongoose from 'mongoose'
|
||||
// import config from '../../config/index.js'
|
||||
import User from '../../src/adapters/localdb/models/users.js'
|
||||
|
||||
const mongooseConnectStr = 'mongodb://172.17.0.1:5666/bch-swap-service-prod'
|
||||
|
||||
async function getUsers () {
|
||||
// Connect to the Mongo Database.
|
||||
mongoose.Promise = global.Promise
|
||||
mongoose.set('useCreateIndex', true) // Stop deprecation warning.
|
||||
await mongoose.connect(
|
||||
mongooseConnectStr,
|
||||
{ useNewUrlParser: true, useUnifiedTopology: true }
|
||||
)
|
||||
|
||||
// Find the user by email.
|
||||
const user = await User.findOne({
|
||||
email: 'test@test.com'
|
||||
}, '-password')
|
||||
|
||||
// Update the users password
|
||||
// user.password = 'newpassword'
|
||||
|
||||
// Change the user to an admin
|
||||
// user.type = 'admin'
|
||||
|
||||
// Save the changes to the database.
|
||||
await user.save()
|
||||
|
||||
mongoose.connection.close()
|
||||
}
|
||||
getUsers()
|
||||
Reference in New Issue
Block a user