More changes for db migration
This commit is contained in:
parent
de0284e48a
commit
889dc02945
33 changed files with 740 additions and 100 deletions
|
@ -135,12 +135,13 @@ export default class Uploader {
|
|||
|
||||
*checkLimit() {
|
||||
const count = yield models.file.count({
|
||||
userId: this.context.user.id,
|
||||
createdAt: {
|
||||
$gt: Math.ceil(Date.now() / 1000) - 86400,
|
||||
where: {
|
||||
userId: this.context.user.id,
|
||||
createdAt: {
|
||||
$gt: Date.now() - 86400000,
|
||||
},
|
||||
},
|
||||
});
|
||||
debug(count);
|
||||
const userLimit = this.context.user.daily_upload_allowance;
|
||||
const underLimit = (count < userLimit || userLimit === 'unlimited');
|
||||
if (!underLimit) {
|
||||
|
@ -158,6 +159,7 @@ export default class Uploader {
|
|||
*finalise() {
|
||||
this.file.size = this.receivedSize;
|
||||
this.file.status = 'active';
|
||||
this.file.processed = 'true';
|
||||
yield this.file.save();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue