Compare commits
No commits in common. "b4d3d1cb7e8a4ad3c9742f890a90eadd27df2bf7" and "8b21ef3ac1ab69f87f94fd4740efcf44c0d76a80" have entirely different histories.
b4d3d1cb7e
...
8b21ef3ac1
3 changed files with 7 additions and 26 deletions
|
@ -503,7 +503,6 @@ th.operations, td.operations {
|
||||||
width: 300px;
|
width: 300px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
position: fixed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#app-title a {
|
#app-title a {
|
||||||
|
@ -520,10 +519,6 @@ th.operations, td.operations {
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
|
|
||||||
#main-sidebar-content {
|
|
||||||
padding-top: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#main-sidebar-content h5 {
|
#main-sidebar-content h5 {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
<div id="general" class="tab" style="display: block">
|
<div id="general" class="tab" style="display: block">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s12 m6 l6">
|
<div class="col m6 s12">
|
||||||
<p>
|
<p>
|
||||||
<label for="item-title">Title</label>
|
<label for="item-title">Title</label>
|
||||||
<input name="Title" id="item-title" type="text" value="{{.item.Title}}" />
|
<input name="Title" id="item-title" type="text" value="{{.item.Title}}" />
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
{{ widget_select "Type_id" "Type" .item.Type_id .types `style="width: 100%"` }}
|
{{ widget_select "Type_id" "Type" .item.Type_id .types `style="width: 100%"` }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col s12 m6 l6">
|
<div class="col m6 s12">
|
||||||
<p>
|
<p>
|
||||||
{{ widget_checkboxes "Notebooks" "Notebooks" .item.Notebooks .notebooks `` }}
|
{{ widget_checkboxes "Notebooks" "Notebooks" .item.Notebooks .notebooks `` }}
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
package models
|
package models
|
||||||
|
|
||||||
import (
|
import "brainminder.speedtech.it/internal/database"
|
||||||
"brainminder.speedtech.it/internal/database"
|
|
||||||
"database/sql"
|
|
||||||
"errors"
|
|
||||||
)
|
|
||||||
|
|
||||||
type ItemShareModel struct {
|
type ItemShareModel struct {
|
||||||
DB *database.DB
|
DB *database.DB
|
||||||
|
@ -13,18 +9,20 @@ type ItemShareModel struct {
|
||||||
type ItemShare struct {
|
type ItemShare struct {
|
||||||
Id int64 `db:"id"`
|
Id int64 `db:"id"`
|
||||||
Token string `db:"token"`
|
Token string `db:"token"`
|
||||||
|
Summary string `db:"summary"`
|
||||||
Item_id int64 `db:"item_id"`
|
Item_id int64 `db:"item_id"`
|
||||||
|
Read int `db:"crypted"`
|
||||||
Update int `db:"hidden"`
|
Update int `db:"hidden"`
|
||||||
Start_datetime string `db:"start_datetime"`
|
Start_datetime string `db:"start_datetime"`
|
||||||
End_datetime string `db:"end_datetime"`
|
End_datetime string `db:"end_datetime"`
|
||||||
Password string `db:"password"`
|
password string `db:"password"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (model *ItemShareModel) Create(ItemShare *ItemShare) (int64, error) {
|
func (model *ItemShareModel) Create(ItemShare *ItemShare) (int64, error) {
|
||||||
ctx, cancel := database.GetContext()
|
ctx, cancel := database.GetContext()
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
query := `INSERT INTO bm_items_share (token, item_id, update, start_datetime, end_datetime, password) VALUES (:token, :item_id, :update, :start_datetime, :end_datetime, :password)`
|
query := `INSERT INTO bm_items_share (title, description, icon, hidden) VALUES (:title, :description, :icon, :hidden)`
|
||||||
|
|
||||||
result, err := model.DB.NamedExecContext(ctx, query, ItemShare)
|
result, err := model.DB.NamedExecContext(ctx, query, ItemShare)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -38,15 +36,3 @@ func (model *ItemShareModel) Create(ItemShare *ItemShare) (int64, error) {
|
||||||
|
|
||||||
return id, err
|
return id, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (model *ItemShareModel) Delete(id int) (bool, error) {
|
|
||||||
ctx, cancel := database.GetContext()
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
_, err := model.DB.ExecContext(ctx, `DELETE FROM bm_item_share WHERE id = $1`, id)
|
|
||||||
if errors.Is(err, sql.ErrNoRows) {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return true, err
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue