add CommentsAndWorkNotes
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -66,4 +66,11 @@ INSERT into worknotes (
|
||||
) VALUES(
|
||||
?, ?, CURRENT_TIMESTAMP
|
||||
)
|
||||
RETURNING *;
|
||||
RETURNING *;
|
||||
|
||||
-- name: GetIncidentWorkNotes :many
|
||||
SELECT * from worknotes
|
||||
WHERE incident_number = sqlc.arg('incidentNumber');
|
||||
|
||||
-- name: ListWorkNotes :many
|
||||
SELECT * from worknotes;
|
@@ -246,6 +246,39 @@ func (q *Queries) GetIncidentReport(ctx context.Context) ([]GetIncidentReportRow
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getIncidentWorkNotes = `-- name: GetIncidentWorkNotes :many
|
||||
SELECT id, incident_number, note, created_at from worknotes
|
||||
WHERE incident_number = ?1
|
||||
`
|
||||
|
||||
func (q *Queries) GetIncidentWorkNotes(ctx context.Context, incidentnumber string) ([]Worknote, error) {
|
||||
rows, err := q.db.QueryContext(ctx, getIncidentWorkNotes, incidentnumber)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []Worknote
|
||||
for rows.Next() {
|
||||
var i Worknote
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.IncidentNumber,
|
||||
&i.Note,
|
||||
&i.CreatedAt,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const listIncidents = `-- name: ListIncidents :many
|
||||
SELECT id, external_id, created_at, incident_number, description, short_description, urgency, impact, state, assignment_group, assigned_to, category, sub_category, sys_id FROM incidents
|
||||
`
|
||||
@@ -331,6 +364,38 @@ func (q *Queries) ListIncoming(ctx context.Context) ([]Incoming, error) {
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const listWorkNotes = `-- name: ListWorkNotes :many
|
||||
SELECT id, incident_number, note, created_at from worknotes
|
||||
`
|
||||
|
||||
func (q *Queries) ListWorkNotes(ctx context.Context) ([]Worknote, error) {
|
||||
rows, err := q.db.QueryContext(ctx, listWorkNotes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []Worknote
|
||||
for rows.Next() {
|
||||
var i Worknote
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.IncidentNumber,
|
||||
&i.Note,
|
||||
&i.CreatedAt,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const updateIncident = `-- name: UpdateIncident :exec
|
||||
UPDATE incidents
|
||||
SET
|
||||
|
Reference in New Issue
Block a user