hop, ajout a la file d'attente de messages
This commit is contained in:
parent
dfd24253db
commit
d8917676ef
BIN
assets/not_published/default_picture.jpg
Executable file
BIN
assets/not_published/default_picture.jpg
Executable file
Binary file not shown.
After Width: | Height: | Size: 130 KiB |
Binary file not shown.
@ -16,6 +16,7 @@ router.get('/', function (req, res, next) {
|
||||
res.render('index', {title: 'Express'});
|
||||
});
|
||||
|
||||
|
||||
// publier un message avec un certain compte
|
||||
router.get('/publish', function (req, res, next) {
|
||||
res.render('index', {title: 'Express'});
|
||||
@ -64,10 +65,39 @@ function createTables(newdb) {
|
||||
const prepared = prepare();
|
||||
}
|
||||
|
||||
// ajouter un message à la file d'attente avec un certain compte
|
||||
router.post('/add-to-queue', function (req, res, next) {
|
||||
// get account
|
||||
// get content*
|
||||
// add to sql DB
|
||||
|
||||
// insert into posts_scheduled
|
||||
// values (NULL, "modominem", "un message d'example", NULL);
|
||||
var db = new sqlite3.Database(database_masto, sqlite3.OPEN_READWRITE | sqlite3.OPEN_CREATE, (err) => {
|
||||
}
|
||||
)
|
||||
db.serialize(() => {
|
||||
db.run('INSERT INTO posts_scheduled VALUES(?,?,?,?,?)', [null, req.body.author, req.body.message, req.body.fichier, null], function (err) {
|
||||
if (err) {
|
||||
return console.log(err.message);
|
||||
res.render('index', {message: 'erreur '+err.message});
|
||||
|
||||
}
|
||||
console.log("nouveau post ajouté", req.body.author, req.body.message);
|
||||
|
||||
res.render('index', {message: 'message ajouté OK'});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
function getAllPosts(db) {
|
||||
return db.query(sql`SELECT *
|
||||
FROM posts_scheduled
|
||||
ORDER BY action_id ASC LIMIT 15;`)
|
||||
ORDER BY action_id DESC LIMIT 15;`)
|
||||
}
|
||||
|
||||
router.get('/init-db', function (req, res, next) {
|
||||
|
@ -4,7 +4,9 @@ block content
|
||||
div.column-header__wrapper
|
||||
h1.button.column-header Publier un message
|
||||
|
||||
form(action="/submit",method="post")
|
||||
if message
|
||||
p.alert.alert-error=message
|
||||
form(action="/add-to-queue",method="post")
|
||||
span.account
|
||||
span compte
|
||||
br
|
||||
@ -37,7 +39,7 @@ block content
|
||||
br
|
||||
label
|
||||
span Fichier à joindre
|
||||
textarea.autosuggest-textarea__textarea(name="fichier", width="500", lines="1")
|
||||
textarea.autosuggest-textarea__textarea(name="fichier", width="500", lines="1",value="default_picture.jpg")
|
||||
br
|
||||
div.composer--publisher
|
||||
input.button.primary(type=submit, value="ajouter à la file d'attente")
|
||||
input.button.primary(type="submit", value="ajouter à la file d'attente")
|
||||
|
Loading…
Reference in New Issue
Block a user