Complete visual overhaul of the go-crm web interface: - New shared layout system (internal/templates/ui.go) with dark zinc industrial theme, JetBrains Mono typography, grid/noise textures - Redesigned all pages: Dashboard, Login/Signup, Clients, Customers, Services, Scheduling, Payments, Questions, Answers, Leads, Review Queue, Report, Keyword Mapping - Tailwind CSS via CDN with custom color palette (amber/emerald/rose/sky) - HTMX-powered interactions with CSS swap animations - Status pills, KPI cards, data tables, empty states, inline forms - Mobile-responsive sidebar with collapsible navigation - All existing tests updated and passing - Zero new build dependencies — works with existing go run/air workflow
484 lines
19 KiB
Go
484 lines
19 KiB
Go
package handlers
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"strconv"
|
|
"time"
|
|
|
|
"go-crm/internal/db"
|
|
"go-crm/internal/templates"
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
)
|
|
|
|
func (a *App) ListQuestions(w http.ResponseWriter, r *http.Request) {
|
|
accountID, ok := a.requireAuth(w, r)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
limit, _ := strconv.Atoi(r.URL.Query().Get("limit"))
|
|
offset, _ := strconv.Atoi(r.URL.Query().Get("offset"))
|
|
clientID, _ := strconv.ParseInt(r.URL.Query().Get("client_id"), 10, 64)
|
|
if limit == 0 {
|
|
limit = 20
|
|
}
|
|
|
|
questions, err := db.ListQuestions(a.DB, clientID, limit, offset)
|
|
if err != nil {
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
return
|
|
}
|
|
|
|
clients, err := db.ListClients(a.DB, accountID, limit, offset)
|
|
if err != nil {
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
return
|
|
}
|
|
|
|
customers, err := db.ListCustomers(a.DB, accountID, clientID, limit, offset)
|
|
if err != nil {
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
return
|
|
}
|
|
|
|
var clientOptions, customerOptions string
|
|
clientNames := make(map[int64]string)
|
|
customerNames := make(map[int64]string)
|
|
for _, c := range clients {
|
|
clientOptions += fmt.Sprintf(`<option value="%d">%s</option>`, c.ClientID, htmlEscape(c.Name))
|
|
clientNames[c.ClientID] = c.Name
|
|
}
|
|
for _, cu := range customers {
|
|
customerOptions += fmt.Sprintf(`<option value="%d">%s</option>`, cu.CustomerID, htmlEscape(cu.Name))
|
|
customerNames[cu.CustomerID] = cu.Name
|
|
}
|
|
|
|
buf := templates.BufRender()
|
|
actions := `<button type="button" onclick="document.getElementById('questionForm').classList.toggle('hidden')" class="btn-primary"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg> Add Question</button>`
|
|
fmt.Fprint(buf, templates.PageHeader("Questions", "Customer inquiries and Q&A", actions))
|
|
|
|
fmt.Fprintf(buf, `
|
|
<div id="questionForm" class="hidden mb-6 animate-slide-up">
|
|
<div class="card-industrial p-5">
|
|
<h3 class="text-sm font-semibold text-zinc-200 mb-4">New Question</h3>
|
|
<form hx-post="/questions" hx-target="#questionList" hx-swap="innerHTML" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
|
|
<select name="client_id" required class="input-industrial"><option value="">Select Client</option>%s</select>
|
|
<select name="customer_id" required class="input-industrial"><option value="">Select Customer</option>%s</select>
|
|
<textarea name="question" placeholder="Question text" required class="input-industrial sm:col-span-2" rows="2"></textarea>
|
|
<select name="status" class="input-industrial"><option value="pending">Pending</option><option value="answered">Answered</option></select>
|
|
<div class="flex items-end"><button type="submit" class="btn-primary">Save</button></div>
|
|
</form>
|
|
</div>
|
|
</div>`, clientOptions, customerOptions)
|
|
|
|
if len(questions) == 0 {
|
|
fmt.Fprint(buf, templates.EmptyState(`<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>`, "No questions recorded yet."))
|
|
} else {
|
|
fmt.Fprintf(buf, `<div class="card-industrial overflow-hidden animate-slide-up stagger-1"><div class="overflow-x-auto">`)
|
|
fmt.Fprint(buf, templates.TableStart([]string{"Client", "Customer", "Question", "Status", "Actions"}))
|
|
for _, q := range questions {
|
|
clientName := clientNames[q.ClientID]
|
|
if clientName == "" {
|
|
clientName = strconv.FormatInt(q.ClientID, 10)
|
|
}
|
|
customerName := customerNames[q.CustomerID]
|
|
if customerName == "" {
|
|
customerName = strconv.FormatInt(q.CustomerID, 10)
|
|
}
|
|
statusPill := `<span class="pill pill-amber">pending</span>`
|
|
if q.Status == "answered" {
|
|
statusPill = `<span class="pill pill-emerald">answered</span>`
|
|
}
|
|
fmt.Fprintf(buf, `<tr>
|
|
<td class="text-zinc-300 text-sm">%s</td>
|
|
<td class="text-zinc-300 text-sm">%s</td>
|
|
<td class="text-zinc-400 text-xs max-w-xs truncate">%s</td>
|
|
<td>%s</td>
|
|
<td>
|
|
<div class="flex items-center gap-2">
|
|
<a href="/questions/%d" class="btn-ghost btn-sm">View</a>
|
|
<button type="button" onclick="document.getElementById('editQ%d').classList.toggle('hidden')" class="btn-ghost btn-sm">Edit</button>
|
|
<form hx-delete="/questions/%d" hx-target="closest tr" hx-swap="outerHTML" style="display:inline">
|
|
<button type="submit" class="btn-danger btn-sm" onclick="return confirm('Delete?')">Delete</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>`, htmlEscape(clientName), htmlEscape(customerName), htmlEscape(q.Question), statusPill, q.QuestionID, q.QuestionID, q.QuestionID)
|
|
}
|
|
fmt.Fprint(buf, templates.TableEnd())
|
|
fmt.Fprintf(buf, `</div></div>`)
|
|
|
|
for _, q := range questions {
|
|
clientName := clientNames[q.ClientID]
|
|
customerName := customerNames[q.CustomerID]
|
|
fmt.Fprintf(buf, `
|
|
<div id="editQ%d" class="hidden mt-4 animate-slide-up">
|
|
<div class="card-industrial p-5 border-amber-400/10">
|
|
<h3 class="text-sm font-semibold text-zinc-200 mb-3">Edit Question #%d</h3>
|
|
<form hx-put="/questions/%d" hx-target="#questionList" hx-swap="innerHTML" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3">
|
|
<select name="client_id" class="input-industrial text-xs"><option value="%d">%s</option>%s</select>
|
|
<select name="customer_id" class="input-industrial text-xs"><option value="%d">%s</option>%s</select>
|
|
<textarea name="question" class="input-industrial text-xs sm:col-span-2" rows="2">%s</textarea>
|
|
<select name="status" class="input-industrial text-xs"><option value="%s">%s</option><option value="pending">Pending</option><option value="answered">Answered</option></select>
|
|
<div class="flex items-end gap-2">
|
|
<button type="submit" class="btn-primary btn-sm">Save</button>
|
|
<button type="button" onclick="document.getElementById('editQ%d').classList.add('hidden')" class="btn-ghost btn-sm">Cancel</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>`, q.QuestionID, q.QuestionID, q.QuestionID, q.ClientID, htmlEscape(clientName), clientOptions, q.CustomerID, htmlEscape(customerName), customerOptions, htmlEscape(q.Question), q.Status, q.Status, q.QuestionID)
|
|
}
|
|
}
|
|
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
templates.WritePage(w, buf, "Questions", "questions")
|
|
}
|
|
|
|
func (a *App) CreateQuestion(w http.ResponseWriter, r *http.Request) {
|
|
_, ok := a.requireAuth(w, r)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
r.ParseForm()
|
|
clientID, _ := strconv.ParseInt(r.FormValue("client_id"), 10, 64)
|
|
customerID, _ := strconv.ParseInt(r.FormValue("customer_id"), 10, 64)
|
|
question := db.Question{
|
|
ClientID: clientID,
|
|
CustomerID: customerID,
|
|
Question: r.FormValue("question"),
|
|
Timestamp: time.Now().Unix(),
|
|
Status: r.FormValue("status"),
|
|
CreatedAt: time.Now().Unix(),
|
|
}
|
|
|
|
if err := question.Create(a.DB); err != nil {
|
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
|
return
|
|
}
|
|
|
|
w.Header().Set("HX-Refresh", "true")
|
|
}
|
|
|
|
func (a *App) ViewQuestion(w http.ResponseWriter, r *http.Request) {
|
|
_, ok := a.requireAuth(w, r)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
id, _ := strconv.ParseInt(chi.URLParam(r, "id"), 10, 64)
|
|
var q db.Question
|
|
err := a.DB.QueryRow("SELECT question_id, client_id, customer_id, question, timestamp, status, created_at FROM questions WHERE question_id = ?", id).Scan(&q.QuestionID, &q.ClientID, &q.CustomerID, &q.Question, &q.Timestamp, &q.Status, &q.CreatedAt)
|
|
if err != nil {
|
|
http.Error(w, "Question not found", http.StatusNotFound)
|
|
return
|
|
}
|
|
|
|
buf := templates.BufRender()
|
|
fmt.Fprint(buf, templates.PageHeader("Question", "Inquiry details"))
|
|
statusPill := `<span class="pill pill-amber">pending</span>`
|
|
if q.Status == "answered" {
|
|
statusPill = `<span class="pill pill-emerald">answered</span>`
|
|
}
|
|
fmt.Fprintf(buf, `
|
|
<div class="max-w-lg animate-slide-up">
|
|
<div class="card-industrial p-6">
|
|
<div class="flex items-center gap-2 mb-4">%s</div>
|
|
<div class="text-sm text-zinc-200 leading-relaxed mb-6">%s</div>
|
|
<div class="space-y-2 text-xs text-zinc-500 font-mono">
|
|
<div>Client ID: %d</div>
|
|
<div>Customer ID: %d</div>
|
|
</div>
|
|
<div class="mt-6">
|
|
<a href="/questions" class="btn-ghost btn-sm">Back</a>
|
|
</div>
|
|
</div>
|
|
</div>`, statusPill, htmlEscape(q.Question), q.ClientID, q.CustomerID)
|
|
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
templates.WritePage(w, buf, "Question", "questions")
|
|
}
|
|
|
|
func (a *App) UpdateQuestion(w http.ResponseWriter, r *http.Request) {
|
|
_, ok := a.requireAuth(w, r)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
id, _ := strconv.ParseInt(chi.URLParam(r, "id"), 10, 64)
|
|
r.ParseForm()
|
|
clientID, _ := strconv.ParseInt(r.FormValue("client_id"), 10, 64)
|
|
customerID, _ := strconv.ParseInt(r.FormValue("customer_id"), 10, 64)
|
|
_, err := a.DB.Exec("UPDATE questions SET client_id=?, customer_id=?, question=?, status=? WHERE question_id=?", clientID, customerID, r.FormValue("question"), r.FormValue("status"), id)
|
|
if err != nil {
|
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
|
return
|
|
}
|
|
w.Header().Set("HX-Refresh", "true")
|
|
}
|
|
|
|
func (a *App) DeleteQuestion(w http.ResponseWriter, r *http.Request) {
|
|
_, ok := a.requireAuth(w, r)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
id, _ := strconv.ParseInt(chi.URLParam(r, "id"), 10, 64)
|
|
a.DB.Exec("DELETE FROM questions WHERE question_id = ?", id)
|
|
}
|
|
|
|
// --- Answers (in same file as original) ---
|
|
|
|
func (a *App) ListAnswers(w http.ResponseWriter, r *http.Request) {
|
|
accountID, ok := a.requireAuth(w, r)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
limit, _ := strconv.Atoi(r.URL.Query().Get("limit"))
|
|
offset, _ := strconv.Atoi(r.URL.Query().Get("offset"))
|
|
questionID, _ := strconv.ParseInt(r.URL.Query().Get("question_id"), 10, 64)
|
|
if limit == 0 {
|
|
limit = 20
|
|
}
|
|
|
|
answers, err := db.ListAnswersWithDetails(a.DB, accountID, questionID, limit, offset)
|
|
if err != nil {
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
return
|
|
}
|
|
|
|
questions, err := db.ListQuestions(a.DB, 0, limit, offset)
|
|
if err != nil {
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
return
|
|
}
|
|
|
|
var questionOptions string
|
|
questionText := make(map[int64]string)
|
|
for _, q := range questions {
|
|
questionOptions += fmt.Sprintf(`<option value="%d">%s</option>`, q.QuestionID, htmlEscape(q.Question))
|
|
questionText[q.QuestionID] = q.Question
|
|
}
|
|
|
|
buf := templates.BufRender()
|
|
actions := `<button type="button" onclick="document.getElementById('answerForm').classList.toggle('hidden')" class="btn-primary"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg> Add Answer</button>`
|
|
fmt.Fprint(buf, templates.PageHeader("Answers", "Responses to customer questions", actions))
|
|
|
|
fmt.Fprintf(buf, `
|
|
<div id="answerForm" class="hidden mb-6 animate-slide-up">
|
|
<div class="card-industrial p-5">
|
|
<h3 class="text-sm font-semibold text-zinc-200 mb-4">New Answer</h3>
|
|
<form hx-post="/answers" hx-target="#answerList" hx-swap="innerHTML" class="grid grid-cols-1 gap-4">
|
|
<select name="question_id" required class="input-industrial max-w-md"><option value="">Select Question</option>%s</select>
|
|
<textarea name="answer" placeholder="Answer text" required class="input-industrial" rows="3"></textarea>
|
|
<div><button type="submit" class="btn-primary">Save</button></div>
|
|
</form>
|
|
</div>
|
|
</div>`, questionOptions)
|
|
|
|
if len(answers) == 0 {
|
|
fmt.Fprint(buf, templates.EmptyState(`<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"/>`, "No answers recorded yet."))
|
|
} else {
|
|
fmt.Fprintf(buf, `<div class="card-industrial overflow-hidden animate-slide-up stagger-1"><div class="overflow-x-auto">`)
|
|
fmt.Fprint(buf, templates.TableStart([]string{"Client", "Customer", "Question", "Answer", "Actions"}))
|
|
for _, a2 := range answers {
|
|
qText := a2.QuestionText
|
|
if qText == "" {
|
|
qText = questionText[a2.QuestionID]
|
|
if qText == "" {
|
|
qText = strconv.FormatInt(a2.QuestionID, 10)
|
|
}
|
|
}
|
|
clientName := a2.ClientName
|
|
if clientName == "" {
|
|
clientName = strconv.FormatInt(a2.ClientID, 10)
|
|
}
|
|
customerName := a2.CustomerName
|
|
if customerName == "" {
|
|
customerName = "Unknown"
|
|
}
|
|
fmt.Fprintf(buf, `<tr>
|
|
<td class="text-zinc-300 text-sm">%s</td>
|
|
<td class="text-zinc-300 text-sm">%s</td>
|
|
<td class="text-zinc-400 text-xs max-w-[200px] truncate">%s</td>
|
|
<td class="text-zinc-400 text-xs max-w-[300px] truncate">%s</td>
|
|
<td>
|
|
<div class="flex items-center gap-2">
|
|
<a href="/answers/%d" class="btn-ghost btn-sm">View</a>
|
|
<button type="button" onclick="document.getElementById('editA%d').classList.toggle('hidden')" class="btn-ghost btn-sm">Edit</button>
|
|
<form hx-delete="/answers/%d" hx-target="closest tr" hx-swap="outerHTML" style="display:inline">
|
|
<button type="submit" class="btn-danger btn-sm" onclick="return confirm('Delete?')">Delete</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>`, htmlEscape(clientName), htmlEscape(customerName), htmlEscape(qText), htmlEscape(a2.Answer), a2.AnswerID, a2.AnswerID, a2.AnswerID)
|
|
}
|
|
fmt.Fprint(buf, templates.TableEnd())
|
|
fmt.Fprintf(buf, `</div></div>`)
|
|
|
|
for _, a2 := range answers {
|
|
qText := a2.QuestionText
|
|
if qText == "" {
|
|
qText = questionText[a2.QuestionID]
|
|
if qText == "" {
|
|
qText = strconv.FormatInt(a2.QuestionID, 10)
|
|
}
|
|
}
|
|
fmt.Fprintf(buf, `
|
|
<div id="editA%d" class="hidden mt-4 animate-slide-up">
|
|
<div class="card-industrial p-5 border-amber-400/10">
|
|
<h3 class="text-sm font-semibold text-zinc-200 mb-3">Edit Answer #%d</h3>
|
|
<form hx-put="/answers/%d" hx-target="#answerList" hx-swap="innerHTML" class="grid grid-cols-1 gap-3">
|
|
<select name="question_id" class="input-industrial text-xs max-w-md"><option value="%d">%s</option>%s</select>
|
|
<textarea name="answer" class="input-industrial text-xs" rows="3">%s</textarea>
|
|
<div class="flex items-end gap-2">
|
|
<button type="submit" class="btn-primary btn-sm">Save</button>
|
|
<button type="button" onclick="document.getElementById('editA%d').classList.add('hidden')" class="btn-ghost btn-sm">Cancel</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>`, a2.AnswerID, a2.AnswerID, a2.AnswerID, a2.QuestionID, htmlEscape(qText), questionOptions, htmlEscape(a2.Answer), a2.AnswerID)
|
|
}
|
|
}
|
|
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
templates.WritePage(w, buf, "Answers", "answers")
|
|
}
|
|
|
|
func (a *App) CreateAnswer(w http.ResponseWriter, r *http.Request) {
|
|
accountID, ok := a.requireAuth(w, r)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
r.ParseForm()
|
|
questionID, _ := strconv.ParseInt(r.FormValue("question_id"), 10, 64)
|
|
|
|
var clientID int64
|
|
err := a.DB.QueryRow("SELECT client_id FROM questions WHERE question_id = ?", questionID).Scan(&clientID)
|
|
if err != nil {
|
|
http.Error(w, "Question not found", http.StatusBadRequest)
|
|
return
|
|
}
|
|
|
|
var checkID int64
|
|
err = a.DB.QueryRow("SELECT client_id FROM clients WHERE client_id = ? AND account_id = ?", clientID, accountID).Scan(&checkID)
|
|
if err != nil {
|
|
http.Error(w, "Invalid question", http.StatusBadRequest)
|
|
return
|
|
}
|
|
|
|
answer := db.Answer{
|
|
ClientID: clientID,
|
|
QuestionID: questionID,
|
|
Answer: r.FormValue("answer"),
|
|
Timestamp: time.Now().Unix(),
|
|
Status: "active",
|
|
CreatedAt: time.Now().Unix(),
|
|
}
|
|
|
|
if err := answer.Create(a.DB); err != nil {
|
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
|
return
|
|
}
|
|
|
|
w.Header().Set("HX-Refresh", "true")
|
|
}
|
|
|
|
func (a *App) ViewAnswer(w http.ResponseWriter, r *http.Request) {
|
|
_, ok := a.requireAuth(w, r)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
id, _ := strconv.ParseInt(chi.URLParam(r, "id"), 10, 64)
|
|
var ans db.Answer
|
|
err := a.DB.QueryRow("SELECT answer_id, client_id, question_id, answer, timestamp, status, created_at FROM answers WHERE answer_id = ?", id).Scan(&ans.AnswerID, &ans.ClientID, &ans.QuestionID, &ans.Answer, &ans.Timestamp, &ans.Status, &ans.CreatedAt)
|
|
if err != nil {
|
|
http.Error(w, "Answer not found", http.StatusNotFound)
|
|
return
|
|
}
|
|
|
|
buf := templates.BufRender()
|
|
fmt.Fprint(buf, templates.PageHeader("Answer", "Response details"))
|
|
fmt.Fprintf(buf, `
|
|
<div class="max-w-lg animate-slide-up">
|
|
<div class="card-industrial p-6">
|
|
<div class="text-sm text-zinc-200 leading-relaxed mb-6">%s</div>
|
|
<div class="space-y-2 text-xs text-zinc-500 font-mono">
|
|
<div>Question ID: %d</div>
|
|
<div>Client ID: %d</div>
|
|
</div>
|
|
<div class="mt-6">
|
|
<a href="/answers" class="btn-ghost btn-sm">Back</a>
|
|
</div>
|
|
</div>
|
|
</div>`, htmlEscape(ans.Answer), ans.QuestionID, ans.ClientID)
|
|
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
templates.WritePage(w, buf, "Answer", "answers")
|
|
}
|
|
|
|
func (a *App) UpdateAnswer(w http.ResponseWriter, r *http.Request) {
|
|
_, ok := a.requireAuth(w, r)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
id, _ := strconv.ParseInt(chi.URLParam(r, "id"), 10, 64)
|
|
r.ParseForm()
|
|
questionID, _ := strconv.ParseInt(r.FormValue("question_id"), 10, 64)
|
|
_, err := a.DB.Exec("UPDATE answers SET question_id=?, answer=? WHERE answer_id=?", questionID, r.FormValue("answer"), id)
|
|
if err != nil {
|
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
|
return
|
|
}
|
|
w.Header().Set("HX-Refresh", "true")
|
|
}
|
|
|
|
func (a *App) DeleteAnswer(w http.ResponseWriter, r *http.Request) {
|
|
_, ok := a.requireAuth(w, r)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
id, _ := strconv.ParseInt(chi.URLParam(r, "id"), 10, 64)
|
|
a.DB.Exec("DELETE FROM answers WHERE answer_id = ?", id)
|
|
}
|
|
|
|
// --- package-level shims ---
|
|
|
|
func ListQuestions(w http.ResponseWriter, r *http.Request) {
|
|
(&App{DB: DB, WAConnector: WAConnector}).ListQuestions(w, r)
|
|
}
|
|
func CreateQuestion(w http.ResponseWriter, r *http.Request) {
|
|
(&App{DB: DB, WAConnector: WAConnector}).CreateQuestion(w, r)
|
|
}
|
|
func ViewQuestion(w http.ResponseWriter, r *http.Request) {
|
|
(&App{DB: DB, WAConnector: WAConnector}).ViewQuestion(w, r)
|
|
}
|
|
func UpdateQuestion(w http.ResponseWriter, r *http.Request) {
|
|
(&App{DB: DB, WAConnector: WAConnector}).UpdateQuestion(w, r)
|
|
}
|
|
func DeleteQuestion(w http.ResponseWriter, r *http.Request) {
|
|
(&App{DB: DB, WAConnector: WAConnector}).DeleteQuestion(w, r)
|
|
}
|
|
func ListAnswers(w http.ResponseWriter, r *http.Request) {
|
|
(&App{DB: DB, WAConnector: WAConnector}).ListAnswers(w, r)
|
|
}
|
|
func CreateAnswer(w http.ResponseWriter, r *http.Request) {
|
|
(&App{DB: DB, WAConnector: WAConnector}).CreateAnswer(w, r)
|
|
}
|
|
func ViewAnswer(w http.ResponseWriter, r *http.Request) {
|
|
(&App{DB: DB, WAConnector: WAConnector}).ViewAnswer(w, r)
|
|
}
|
|
func UpdateAnswer(w http.ResponseWriter, r *http.Request) {
|
|
(&App{DB: DB, WAConnector: WAConnector}).UpdateAnswer(w, r)
|
|
}
|
|
func DeleteAnswer(w http.ResponseWriter, r *http.Request) {
|
|
(&App{DB: DB, WAConnector: WAConnector}).DeleteAnswer(w, r)
|
|
}
|