Backend rework complete

This commit is contained in:
Marco van Dijk 2022-04-21 10:48:12 +02:00
parent c821dbee8e
commit 95be1e5614
7 changed files with 434 additions and 299 deletions

View File

@ -11,8 +11,7 @@ const ActivateEventSchema = new mongoose.Schema({
},
round: {
type: Number,
required: false,
default: true
required: true
},
transactionHash: {
type: String,

View File

@ -7,7 +7,7 @@ const StakeEventSchema = new mongoose.Schema({
},
from: {
type: String,
required: true
required: false
},
to: {
type: String,

View File

@ -10,7 +10,7 @@ const TransferEventSchema = new mongoose.Schema({
required: true
},
amount: {
type: number,
type: Number,
required: true
},
transactionHash: {

View File

@ -1,6 +1,6 @@
import mongoose from 'mongoose';
const WithdrawEventSchema = new mongoose.Schema({
const WithdrawFeesEventSchema = new mongoose.Schema({
address: {
type: String,
required: true
@ -23,5 +23,5 @@ const WithdrawEventSchema = new mongoose.Schema({
}
}, { timestamps: false });
const WithdrawEvent = mongoose.model('WithdrawEvent', WithdrawEventSchema);
export default WithdrawEvent;
const WithdrawFeesEvent = mongoose.model('WithdrawFeesEvent', WithdrawFeesEventSchema);
export default WithdrawFeesEvent;

View File

@ -1,6 +1,6 @@
import mongoose from 'mongoose';
const WithdrawEventSchema = new mongoose.Schema({
const WithdrawStakeEventSchema = new mongoose.Schema({
address: {
type: String,
required: true
@ -27,5 +27,5 @@ const WithdrawEventSchema = new mongoose.Schema({
}
}, { timestamps: false });
const WithdrawEvent = mongoose.model('WithdrawEvent', WithdrawEventSchema);
export default WithdrawEvent;
const WithdrawStakeEvent = mongoose.model('WithdrawStakeEvent', WithdrawStakeEventSchema);
export default WithdrawStakeEvent;

View File

@ -1,5 +1,54 @@
import mongoose from 'mongoose';
const WinningTicketSchema = new mongoose.Schema({
address: {
type: String,
required: true
},
sum: {
type: Number,
required: true
},
count: {
type: Number,
required: true
},
});
const OrchCommissionSchema = new mongoose.Schema({
address: {
type: String,
required: true
},
feeCommission: {
type: Number,
required: true
},
rewardCommission: {
type: Number,
required: true
},
timestamp: {
type: Number,
required: true
}
});
const OrchStakeSchema = new mongoose.Schema({
address: {
type: String,
required: true
},
totalStake: {
type: Number,
required: true
},
timestamp: {
type: Number,
required: true
}
});
const MonthlyStatSchema = new mongoose.Schema({
// Static props
year: {
@ -123,12 +172,12 @@ const MonthlyStatSchema = new mongoose.Schema({
default: 0
},
winningTicketsReceived: {
type: [Object],
type: [WinningTicketSchema],
required: false,
default: []
},
winningTicketsSent: {
type: [Object],
type: [WinningTicketSchema],
required: false,
default: []
},
@ -144,18 +193,18 @@ const MonthlyStatSchema = new mongoose.Schema({
default: 0
},
winningTicketsRedeemed: {
type: [Object],
type: [WinningTicketSchema],
required: false,
default: []
},
// History for theGraph current data for that month
latestCommission: {
type: [Object],
type: [OrchCommissionSchema],
required: false,
default: null
},
latestTotalStake: {
type: [Object],
type: [OrchStakeSchema],
required: false,
default: null
},

File diff suppressed because it is too large Load Diff