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: { round: {
type: Number, type: Number,
required: false, required: true
default: true
}, },
transactionHash: { transactionHash: {
type: String, type: String,

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,54 @@
import mongoose from 'mongoose'; 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({ const MonthlyStatSchema = new mongoose.Schema({
// Static props // Static props
year: { year: {
@ -123,12 +172,12 @@ const MonthlyStatSchema = new mongoose.Schema({
default: 0 default: 0
}, },
winningTicketsReceived: { winningTicketsReceived: {
type: [Object], type: [WinningTicketSchema],
required: false, required: false,
default: [] default: []
}, },
winningTicketsSent: { winningTicketsSent: {
type: [Object], type: [WinningTicketSchema],
required: false, required: false,
default: [] default: []
}, },
@ -144,18 +193,18 @@ const MonthlyStatSchema = new mongoose.Schema({
default: 0 default: 0
}, },
winningTicketsRedeemed: { winningTicketsRedeemed: {
type: [Object], type: [WinningTicketSchema],
required: false, required: false,
default: [] default: []
}, },
// History for theGraph current data for that month // History for theGraph current data for that month
latestCommission: { latestCommission: {
type: [Object], type: [OrchCommissionSchema],
required: false, required: false,
default: null default: null
}, },
latestTotalStake: { latestTotalStake: {
type: [Object], type: [OrchStakeSchema],
required: false, required: false,
default: null default: null
}, },

File diff suppressed because it is too large Load Diff