- added title field to the db
This commit is contained in:
parent
954ee0ca5a
commit
10ce5eeef0
|
|
@ -35,4 +35,5 @@ type Ticket struct {
|
|||
CreatedAt pgtype.Timestamptz
|
||||
DeletedAt pgtype.Timestamptz
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
Title pgtype.Text
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,20 +43,21 @@ func (q *Queries) CloseTask(ctx context.Context, arg CloseTaskParams) (Task, err
|
|||
|
||||
const createTicket = `-- name: CreateTicket :one
|
||||
INSERT INTO tickets (
|
||||
key, channelID
|
||||
key, channelID, title
|
||||
) VALUES (
|
||||
$1, $2
|
||||
$1, $2, $3
|
||||
)
|
||||
RETURNING id, key, channelid, project_git, build_git, folder, created_at, deleted_at, updated_at
|
||||
RETURNING id, key, channelid, project_git, build_git, folder, created_at, deleted_at, updated_at, title
|
||||
`
|
||||
|
||||
type CreateTicketParams struct {
|
||||
Key pgtype.Text
|
||||
Channelid pgtype.Text
|
||||
Title pgtype.Text
|
||||
}
|
||||
|
||||
func (q *Queries) CreateTicket(ctx context.Context, arg CreateTicketParams) (Ticket, error) {
|
||||
row := q.db.QueryRow(ctx, createTicket, arg.Key, arg.Channelid)
|
||||
row := q.db.QueryRow(ctx, createTicket, arg.Key, arg.Channelid, arg.Title)
|
||||
var i Ticket
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
|
|
@ -68,6 +69,7 @@ func (q *Queries) CreateTicket(ctx context.Context, arg CreateTicketParams) (Tic
|
|||
&i.CreatedAt,
|
||||
&i.DeletedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.Title,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
|
@ -145,7 +147,7 @@ func (q *Queries) GetTaskByMessage(ctx context.Context, messageid pgtype.Text) (
|
|||
}
|
||||
|
||||
const getTicketByChannelID = `-- name: GetTicketByChannelID :one
|
||||
SELECT id, key, channelid, project_git, build_git, folder, created_at, deleted_at, updated_at FROM tickets WHERE channelID = $1
|
||||
SELECT id, key, channelid, project_git, build_git, folder, created_at, deleted_at, updated_at, title FROM tickets WHERE channelID = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetTicketByChannelID(ctx context.Context, channelid pgtype.Text) (Ticket, error) {
|
||||
|
|
@ -161,12 +163,13 @@ func (q *Queries) GetTicketByChannelID(ctx context.Context, channelid pgtype.Tex
|
|||
&i.CreatedAt,
|
||||
&i.DeletedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.Title,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getTicketByID = `-- name: GetTicketByID :one
|
||||
SELECT id, key, channelid, project_git, build_git, folder, created_at, deleted_at, updated_at FROM tickets WHERE id = $1
|
||||
SELECT id, key, channelid, project_git, build_git, folder, created_at, deleted_at, updated_at, title FROM tickets WHERE id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetTicketByID(ctx context.Context, id int32) (Ticket, error) {
|
||||
|
|
@ -182,6 +185,7 @@ func (q *Queries) GetTicketByID(ctx context.Context, id int32) (Ticket, error) {
|
|||
&i.CreatedAt,
|
||||
&i.DeletedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.Title,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
|
@ -253,7 +257,7 @@ func (q *Queries) ListTasksByCreator(ctx context.Context, creatorLink pgtype.Tex
|
|||
}
|
||||
|
||||
const listTickets = `-- name: ListTickets :many
|
||||
SELECT id, key, channelid, project_git, build_git, folder, created_at, deleted_at, updated_at FROM tickets WHERE deleted_at IS NULL
|
||||
SELECT id, key, channelid, project_git, build_git, folder, created_at, deleted_at, updated_at, title FROM tickets WHERE deleted_at IS NULL
|
||||
`
|
||||
|
||||
func (q *Queries) ListTickets(ctx context.Context) ([]Ticket, error) {
|
||||
|
|
@ -275,6 +279,7 @@ func (q *Queries) ListTickets(ctx context.Context) ([]Ticket, error) {
|
|||
&i.CreatedAt,
|
||||
&i.DeletedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.Title,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -287,7 +292,7 @@ func (q *Queries) ListTickets(ctx context.Context) ([]Ticket, error) {
|
|||
}
|
||||
|
||||
const listTicketsWithDeleted = `-- name: ListTicketsWithDeleted :many
|
||||
SELECT id, key, channelid, project_git, build_git, folder, created_at, deleted_at, updated_at FROM tickets
|
||||
SELECT id, key, channelid, project_git, build_git, folder, created_at, deleted_at, updated_at, title FROM tickets
|
||||
`
|
||||
|
||||
func (q *Queries) ListTicketsWithDeleted(ctx context.Context) ([]Ticket, error) {
|
||||
|
|
@ -309,6 +314,7 @@ func (q *Queries) ListTicketsWithDeleted(ctx context.Context) ([]Ticket, error)
|
|||
&i.CreatedAt,
|
||||
&i.DeletedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.Title,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -383,7 +389,7 @@ const updateTicketBuildGit = `-- name: UpdateTicketBuildGit :one
|
|||
UPDATE tickets
|
||||
SET build_git = $1, updated_at = $2
|
||||
WHERE channelID = $3
|
||||
RETURNING id, key, channelid, project_git, build_git, folder, created_at, deleted_at, updated_at
|
||||
RETURNING id, key, channelid, project_git, build_git, folder, created_at, deleted_at, updated_at, title
|
||||
`
|
||||
|
||||
type UpdateTicketBuildGitParams struct {
|
||||
|
|
@ -405,6 +411,7 @@ func (q *Queries) UpdateTicketBuildGit(ctx context.Context, arg UpdateTicketBuil
|
|||
&i.CreatedAt,
|
||||
&i.DeletedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.Title,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
|
@ -434,7 +441,7 @@ const updateTicketFolder = `-- name: UpdateTicketFolder :one
|
|||
UPDATE tickets
|
||||
SET folder = $1, updated_at = $2
|
||||
WHERE channelID = $3
|
||||
RETURNING id, key, channelid, project_git, build_git, folder, created_at, deleted_at, updated_at
|
||||
RETURNING id, key, channelid, project_git, build_git, folder, created_at, deleted_at, updated_at, title
|
||||
`
|
||||
|
||||
type UpdateTicketFolderParams struct {
|
||||
|
|
@ -456,6 +463,7 @@ func (q *Queries) UpdateTicketFolder(ctx context.Context, arg UpdateTicketFolder
|
|||
&i.CreatedAt,
|
||||
&i.DeletedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.Title,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
|
@ -464,7 +472,7 @@ const updateTicketProjectGit = `-- name: UpdateTicketProjectGit :one
|
|||
UPDATE tickets
|
||||
SET project_git = $1, updated_at = $2
|
||||
WHERE channelID = $3
|
||||
RETURNING id, key, channelid, project_git, build_git, folder, created_at, deleted_at, updated_at
|
||||
RETURNING id, key, channelid, project_git, build_git, folder, created_at, deleted_at, updated_at, title
|
||||
`
|
||||
|
||||
type UpdateTicketProjectGitParams struct {
|
||||
|
|
@ -486,6 +494,7 @@ func (q *Queries) UpdateTicketProjectGit(ctx context.Context, arg UpdateTicketPr
|
|||
&i.CreatedAt,
|
||||
&i.DeletedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.Title,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue