~abyxcos/axolotlfeeds

b31f5ff07d2ae60158349c28c0437492512b22bb — abyxcos 2 years ago 2347225 master
Minor SQL cleanup.
2 files changed, 2 insertions(+), 21 deletions(-)

M axolotl/post.go
M axolotl/user.go
M axolotl/post.go => axolotl/post.go +0 -15
@@ 68,21 68,6 @@ func (user User) AddPost(post Post) error {
	_, err := db.NamedExec(fmt.Sprintf(
		`INSERT INTO posts_%s (folder, name, uuid, url, date, title, text, rendered, image, caption, read, fetched)
		 VALUES (:folder, :name, :uuid, :url, :date, :title, :text, :rendered, :image, :caption, :read, :fetched)`, user.UUID), &post)
/*
			ON CONFLICT (uuid) DO UPDATE SET
				-- Post data
				url=excluded.url,
				title=excluded.title,
				text=excluded.text,
				-- Rendered post data
				rendered=excluded.rendered,
				image=excluded.image,
				caption=excluded.caption,
				-- Post status info
				read=excluded.read,
				fetched=excluded.fetched
			WHERE excluded.date>posts_%s.date`,
*/
	return err
}


M axolotl/user.go => axolotl/user.go +2 -6
@@ 16,16 16,12 @@ func GetUserBySession(token string) (User, error) {
	var uuid string
	var user User

	err = db.Get(&uuid,
		"SELECT uuid FROM sessions WHERE token=$1",
		token)
	err = db.Get(&uuid, "SELECT uuid FROM sessions WHERE token=$1", token)
	if err != nil {
		return user, err
	}

	err = db.Get(&user,
		"SELECT * FROM users WHERE uuid=$1",
		uuid)
	err = db.Get(&user, "SELECT * FROM users WHERE uuid=$1", uuid)
	if err != nil {
		return user, err
	}