fix contents

This commit is contained in:
monoid 2021-01-06 22:10:01 +09:00
parent 9abf57bdf0
commit 74a4d01fcc
2 changed files with 1 additions and 20 deletions

View File

@ -1,20 +0,0 @@
import Knex from "knex";
exports.seed = async function(knex:Knex) {
// Deletes ALL existing entries
await knex('contents').del();
await knex('contents').insert({
title:"aaa",
basepath:"testdata",
content_type:"manga",
filename:"test_zip.zip",
additional:JSON.stringify({comment:"comment"})
});
await knex('contents').insert({
title:"aaa",
basepath:"testdata",
content_type:"video",
filename:"video_test.mp4",
additional:JSON.stringify({comment:"test comment"})
});
};

View File

@ -34,6 +34,7 @@ class KnexContentsAccessor implements ContentAccessor{
};
async del(id:number) {
if (await this.findById(id) !== undefined){
await this.knex.delete().from("content_tag_relation").where({content_id:id});
await this.knex.delete().from("contents").where({id:id});
return true;
}