refactor: simplify db and cmd flags, reduce code duplication
- Abstract property flags into addPropertyFlags in cmd/root.go and apply to commands - Remove unused GetUserByUsername from db.go (it's redundant with service.resolveUserIDByName) - Use configured user in WithMentions directly in inbox command - Refactor resolve methods in node_service_sqlite.go to reduce duplication
This commit is contained in:
11
db/db.go
11
db/db.go
@@ -70,14 +70,3 @@ func Open(path string) (*DB, error) {
|
||||
return &DB{DB: db, path: path}, nil
|
||||
}
|
||||
|
||||
func (db *DB) GetUserByUsername(username string) (string, error) {
|
||||
var id string
|
||||
err := db.QueryRow(`
|
||||
SELECT n.id FROM nodes n
|
||||
JOIN tags t ON n.id = t.node_id
|
||||
WHERE n.title = ? AND t.tag = '_type::user'`, username).Scan(&id)
|
||||
if err == sql.ErrNoRows {
|
||||
return "", nil
|
||||
}
|
||||
return id, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user