665 lines
16 KiB
Go
665 lines
16 KiB
Go
package db
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
"fmt"
|
|
"time"
|
|
"uuid"
|
|
)
|
|
|
|
// DBTX is the interface satisfied by both *sql.DB and *sql.Tx.
|
|
type DBTX interface {
|
|
ExecContext(context.Context, string, ...any) (sql.Result, error)
|
|
QueryContext(context.Context, string, ...any) (*sql.Rows, error)
|
|
QueryRowContext(context.Context, string, ...any) *sql.Row
|
|
}
|
|
|
|
// Queries provides database query methods.
|
|
type Queries struct{ db DBTX }
|
|
|
|
// New creates a Queries backed by the given DBTX.
|
|
func New(db DBTX) *Queries { return &Queries{db: db} }
|
|
|
|
// WithTx returns a Queries that runs within the given transaction.
|
|
func (q *Queries) WithTx(tx *sql.Tx) *Queries { return &Queries{db: tx} }
|
|
|
|
const insertUser = `
|
|
INSERT INTO users (id, name, password, role)
|
|
VALUES (?, ?, ?, ?)
|
|
RETURNING created_at, deactivated_at, id, name, password, role, updated_at
|
|
`
|
|
|
|
// InsertUserParams holds arguments for InsertUser.
|
|
type InsertUserParams struct {
|
|
Name string
|
|
Password string
|
|
Role UserRole
|
|
}
|
|
|
|
// InsertUser creates a new user.
|
|
func (q *Queries) InsertUser(ctx context.Context, arg InsertUserParams) (*User, error) {
|
|
row := q.db.QueryRowContext(
|
|
ctx,
|
|
insertUser,
|
|
uuid.New().String(),
|
|
arg.Name,
|
|
arg.Password,
|
|
arg.Role,
|
|
)
|
|
|
|
var (
|
|
u User
|
|
createdAt string
|
|
updatedAt string
|
|
err error
|
|
)
|
|
if err := row.Scan(
|
|
&createdAt,
|
|
&u.DeactivatedAt,
|
|
&u.Id,
|
|
&u.Name,
|
|
&u.Password,
|
|
&u.Role,
|
|
&updatedAt,
|
|
); err != nil {
|
|
return nil, fmt.Errorf(
|
|
"InsertUser: %w", err,
|
|
)
|
|
}
|
|
if u.CreatedAt, err = time.Parse(time.RFC3339, createdAt); err != nil {
|
|
return nil, fmt.Errorf("InsertUser: parse created_at: %w", err)
|
|
}
|
|
if u.UpdatedAt, err = time.Parse(time.RFC3339, updatedAt); err != nil {
|
|
return nil, fmt.Errorf("InsertUser: parse updated_at: %w", err)
|
|
}
|
|
return &u, nil
|
|
}
|
|
|
|
const selectUserId = `
|
|
SELECT created_at, deactivated_at, id, name, password, role, updated_at
|
|
FROM users
|
|
WHERE id = ?
|
|
`
|
|
|
|
// SelectUserId returns a single user by ID.
|
|
func (q *Queries) SelectUserId(ctx context.Context, id string) (*User, error) {
|
|
row := q.db.QueryRowContext(ctx, selectUserId, id)
|
|
|
|
var (
|
|
u User
|
|
createdAt string
|
|
updatedAt string
|
|
)
|
|
err := row.Scan(
|
|
&createdAt,
|
|
&u.DeactivatedAt,
|
|
&u.Id,
|
|
&u.Name,
|
|
&u.Password,
|
|
&u.Role,
|
|
&updatedAt,
|
|
)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("SelectUserId: %w", err)
|
|
}
|
|
|
|
if u.CreatedAt, err = time.Parse(time.RFC3339, createdAt); err != nil {
|
|
return nil, fmt.Errorf("SelectUserId: parse created_at: %w", err)
|
|
}
|
|
if u.UpdatedAt, err = time.Parse(time.RFC3339, updatedAt); err != nil {
|
|
return nil, fmt.Errorf("SelectUserId: parse updated_at: %w", err)
|
|
}
|
|
|
|
return &u, nil
|
|
}
|
|
|
|
const insertConversation = `
|
|
INSERT INTO conversations (id, title, user_id)
|
|
VALUES (?, ?, ?)
|
|
RETURNING created_at, id, title, updated_at, user_id
|
|
`
|
|
|
|
// InsertConversationParams holds arguments for InsertConversation.
|
|
type InsertConversationParams struct {
|
|
Title *string
|
|
UserId string
|
|
}
|
|
|
|
// InsertConversation creates a new conversation.
|
|
func (q *Queries) InsertConversation(ctx context.Context, arg InsertConversationParams) (*Conversation, error) {
|
|
row := q.db.QueryRowContext(
|
|
ctx,
|
|
insertConversation,
|
|
uuid.New().String(),
|
|
arg.Title,
|
|
arg.UserId,
|
|
)
|
|
|
|
var (
|
|
c Conversation
|
|
createdAt string
|
|
updatedAt string
|
|
err error
|
|
)
|
|
if err := row.Scan(
|
|
&createdAt,
|
|
&c.Id,
|
|
&c.Title,
|
|
&updatedAt,
|
|
&c.UserId,
|
|
); err != nil {
|
|
return nil, fmt.Errorf("InsertConversation: %w", err)
|
|
}
|
|
if c.CreatedAt, err = time.Parse(time.RFC3339, createdAt); err != nil {
|
|
return nil, fmt.Errorf("InsertConversation: parse created_at: %w", err)
|
|
}
|
|
if c.UpdatedAt, err = time.Parse(time.RFC3339, updatedAt); err != nil {
|
|
return nil, fmt.Errorf("InsertConversation: parse updated_at: %w", err)
|
|
}
|
|
return &c, nil
|
|
}
|
|
|
|
const selectConversationId = `
|
|
SELECT created_at, id, title, updated_at, user_id
|
|
FROM conversations
|
|
WHERE id = ?
|
|
`
|
|
|
|
// SelectConversationId returns a single conversation by ID.
|
|
func (q *Queries) SelectConversationId(ctx context.Context, id string) (*Conversation, error) {
|
|
row := q.db.QueryRowContext(ctx, selectConversationId, id)
|
|
|
|
var (
|
|
c Conversation
|
|
createdAt string
|
|
updatedAt string
|
|
)
|
|
err := row.Scan(
|
|
&createdAt,
|
|
&c.Id,
|
|
&c.Title,
|
|
&updatedAt,
|
|
&c.UserId,
|
|
)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("SelectConversationId: %w", err)
|
|
}
|
|
if c.CreatedAt, err = time.Parse(time.RFC3339, createdAt); err != nil {
|
|
return nil, fmt.Errorf("SelectConversationId: parse created_at: %w", err)
|
|
}
|
|
if c.UpdatedAt, err = time.Parse(time.RFC3339, updatedAt); err != nil {
|
|
return nil, fmt.Errorf("SelectConversationId: parse updated_at: %w", err)
|
|
}
|
|
|
|
return &c, nil
|
|
}
|
|
|
|
const selectConversationIdUserId = `
|
|
SELECT created_at, id, title, updated_at, user_id
|
|
FROM conversations
|
|
WHERE id = ? AND user_id = ?
|
|
`
|
|
|
|
// SelectConversationIdUserId returns a conversation by ID when it belongs to
|
|
// the specified user.
|
|
func (q *Queries) SelectConversationIdUserId(
|
|
ctx context.Context,
|
|
id string,
|
|
userId string,
|
|
) (*Conversation, error) {
|
|
row := q.db.QueryRowContext(ctx, selectConversationIdUserId, id, userId)
|
|
|
|
var (
|
|
c Conversation
|
|
createdAt string
|
|
updatedAt string
|
|
)
|
|
err := row.Scan(
|
|
&createdAt,
|
|
&c.Id,
|
|
&c.Title,
|
|
&updatedAt,
|
|
&c.UserId,
|
|
)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("SelectConversationIdUserId: %w", err)
|
|
}
|
|
if c.CreatedAt, err = time.Parse(time.RFC3339, createdAt); err != nil {
|
|
return nil, fmt.Errorf(
|
|
"SelectConversationIdUserId: parse created_at: %w", err,
|
|
)
|
|
}
|
|
if c.UpdatedAt, err = time.Parse(time.RFC3339, updatedAt); err != nil {
|
|
return nil, fmt.Errorf(
|
|
"SelectConversationIdUserId: parse updated_at: %w", err,
|
|
)
|
|
}
|
|
|
|
return &c, nil
|
|
}
|
|
|
|
const selectConversationsUserId = `
|
|
SELECT created_at, id, title, updated_at, user_id
|
|
FROM conversations
|
|
WHERE user_id = ?
|
|
ORDER BY updated_at DESC
|
|
`
|
|
|
|
// SelectConversationsUserId returns all conversations for a user,
|
|
// ordered by most recently updated.
|
|
func (q *Queries) SelectConversationsUserId(ctx context.Context, userId string) ([]Conversation, error) {
|
|
rows, err := q.db.QueryContext(ctx, selectConversationsUserId, userId)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("SelectConversationsUserId: %w", err)
|
|
}
|
|
defer rows.Close()
|
|
|
|
var conversations []Conversation
|
|
for rows.Next() {
|
|
var (
|
|
c Conversation
|
|
createdAt string
|
|
updatedAt string
|
|
)
|
|
if err := rows.Scan(
|
|
&createdAt,
|
|
&c.Id,
|
|
&c.Title,
|
|
&updatedAt,
|
|
&c.UserId,
|
|
); err != nil {
|
|
return nil, fmt.Errorf("SelectConversationsUserId: %w", err)
|
|
}
|
|
if c.CreatedAt, err = time.Parse(time.RFC3339, createdAt); err != nil {
|
|
return nil, fmt.Errorf("SelectConversationsUserId: parse created_at: %w", err)
|
|
}
|
|
if c.UpdatedAt, err = time.Parse(time.RFC3339, updatedAt); err != nil {
|
|
return nil, fmt.Errorf("SelectConversationsUserId: parse updated_at: %w", err)
|
|
}
|
|
conversations = append(conversations, c)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, fmt.Errorf("SelectConversationsUserId: %w", err)
|
|
}
|
|
return conversations, nil
|
|
}
|
|
|
|
const deleteConversationId = `
|
|
DELETE FROM conversations
|
|
WHERE id = ?
|
|
`
|
|
|
|
// DeleteConversation deletes a conversation by ID. Cascades to
|
|
// all messages in the conversation.
|
|
func (q *Queries) DeleteConversationId(ctx context.Context, id string) error {
|
|
_, err := q.db.ExecContext(ctx, deleteConversationId, id)
|
|
if err != nil {
|
|
return fmt.Errorf("DeleteConversationId: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
const insertMessage = `
|
|
INSERT INTO messages (id, content, conversation_id, role, sequence)
|
|
VALUES (?, ?, ?, ?, ?)
|
|
RETURNING content, conversation_id, created_at, id, role, sequence, updated_at
|
|
`
|
|
|
|
// InsertMessageParams holds arguments for InsertMessage.
|
|
type InsertMessageParams struct {
|
|
Content string
|
|
ConversationId string
|
|
Role MessageRole
|
|
Sequence int
|
|
}
|
|
|
|
// InsertMessage creates a new message.
|
|
func (q *Queries) InsertMessage(ctx context.Context, arg InsertMessageParams) (*Message, error) {
|
|
row := q.db.QueryRowContext(
|
|
ctx,
|
|
insertMessage,
|
|
uuid.New().String(),
|
|
arg.Content,
|
|
arg.ConversationId,
|
|
arg.Role,
|
|
arg.Sequence,
|
|
)
|
|
|
|
var (
|
|
m Message
|
|
createdAt string
|
|
updatedAt string
|
|
err error
|
|
)
|
|
if err := row.Scan(
|
|
&m.Content,
|
|
&m.ConversationId,
|
|
&createdAt,
|
|
&m.Id,
|
|
&m.Role,
|
|
&m.Sequence,
|
|
&updatedAt,
|
|
); err != nil {
|
|
return nil, fmt.Errorf("InsertMessage: %w", err)
|
|
}
|
|
if m.CreatedAt, err = time.Parse(time.RFC3339, createdAt); err != nil {
|
|
return nil, fmt.Errorf("InsertMessage: parse created_at: %w", err)
|
|
}
|
|
if m.UpdatedAt, err = time.Parse(time.RFC3339, updatedAt); err != nil {
|
|
return nil, fmt.Errorf("InsertMessage: parse updated_at: %w", err)
|
|
}
|
|
return &m, nil
|
|
}
|
|
|
|
const selectMessagesConversationId = `
|
|
SELECT content, conversation_id, created_at, id, role, sequence, updated_at
|
|
FROM messages
|
|
WHERE conversation_id = ?
|
|
ORDER BY sequence
|
|
`
|
|
|
|
// SelectMessagesConversationId returns all messages for a
|
|
// conversation, ordered by sequence.
|
|
func (q *Queries) SelectMessagesConversationId(ctx context.Context, conversationId string) ([]Message, error) {
|
|
rows, err := q.db.QueryContext(ctx, selectMessagesConversationId, conversationId)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("SelectMessagesConversationId: %w", err)
|
|
}
|
|
defer rows.Close()
|
|
|
|
var messages []Message
|
|
for rows.Next() {
|
|
var (
|
|
m Message
|
|
createdAt string
|
|
updatedAt string
|
|
)
|
|
if err := rows.Scan(
|
|
&m.Content,
|
|
&m.ConversationId,
|
|
&createdAt,
|
|
&m.Id,
|
|
&m.Role,
|
|
&m.Sequence,
|
|
&updatedAt,
|
|
); err != nil {
|
|
return nil, fmt.Errorf("SelectMessagesConversationId: %w", err)
|
|
}
|
|
if m.CreatedAt, err = time.Parse(time.RFC3339, createdAt); err != nil {
|
|
return nil, fmt.Errorf("SelectMessagesConversationId: parse created_at: %w", err)
|
|
}
|
|
if m.UpdatedAt, err = time.Parse(time.RFC3339, updatedAt); err != nil {
|
|
return nil, fmt.Errorf("SelectMessagesConversationId: parse updated_at: %w", err)
|
|
}
|
|
messages = append(messages, m)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, fmt.Errorf("SelectMessagesConversationId: %w", err)
|
|
}
|
|
return messages, nil
|
|
}
|
|
|
|
const updateMessageContent = `
|
|
UPDATE messages
|
|
SET content = ?, updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
|
|
WHERE id = ?
|
|
`
|
|
|
|
// UpdateMessageContentParams holds arguments for UpdateMessageContent.
|
|
type UpdateMessageContentParams struct {
|
|
Content string
|
|
Id string
|
|
}
|
|
|
|
// UpdateMessageContent sets the content JSON for a message.
|
|
func (q *Queries) UpdateMessageContent(ctx context.Context, arg UpdateMessageContentParams) error {
|
|
_, err := q.db.ExecContext(
|
|
ctx,
|
|
updateMessageContent,
|
|
arg.Content,
|
|
arg.Id,
|
|
)
|
|
if err != nil {
|
|
return fmt.Errorf("UpdateMessageContent: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
const deleteMessageId = `
|
|
DELETE FROM messages
|
|
WHERE id = ?
|
|
`
|
|
|
|
// DeleteMessage deletes a message by ID.
|
|
func (q *Queries) DeleteMessageId(ctx context.Context, id string) error {
|
|
_, err := q.db.ExecContext(ctx, deleteMessageId, id)
|
|
if err != nil {
|
|
return fmt.Errorf("DeleteMessageId: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
const selectMaxSequence = `
|
|
SELECT COALESCE(MAX(sequence), 0)
|
|
FROM messages
|
|
WHERE conversation_id = ?
|
|
`
|
|
|
|
// NextSequence returns the next available sequence number for
|
|
// a conversation.
|
|
func (q *Queries) NextSequence(ctx context.Context, conversationId string) (int, error) {
|
|
var seq int
|
|
err := q.db.QueryRowContext(ctx, selectMaxSequence, conversationId).Scan(&seq)
|
|
if err != nil {
|
|
return 0, fmt.Errorf("NextSequence: %w", err)
|
|
}
|
|
return seq + 1, nil
|
|
}
|
|
|
|
const insertApproval = `
|
|
INSERT INTO approvals (id, message_id, tool_call_id)
|
|
VALUES (?, ?, ?)
|
|
RETURNING created_at, id, message_id, status, tool_call_id, updated_at
|
|
`
|
|
|
|
// InsertApprovalParams holds arguments for InsertApproval.
|
|
type InsertApprovalParams struct {
|
|
MessageId string
|
|
ToolCallId string
|
|
}
|
|
|
|
// InsertApproval creates a new pending approval.
|
|
func (q *Queries) InsertApproval(ctx context.Context, arg InsertApprovalParams) (*Approval, error) {
|
|
row := q.db.QueryRowContext(
|
|
ctx,
|
|
insertApproval,
|
|
uuid.New().String(),
|
|
arg.MessageId,
|
|
arg.ToolCallId,
|
|
)
|
|
|
|
var (
|
|
a Approval
|
|
createdAt string
|
|
updatedAt string
|
|
err error
|
|
)
|
|
if err = row.Scan(
|
|
&createdAt,
|
|
&a.Id,
|
|
&a.MessageId,
|
|
&a.Status,
|
|
&a.ToolCallId,
|
|
&updatedAt,
|
|
); err != nil {
|
|
return nil, fmt.Errorf(
|
|
"InsertApproval: %w", err,
|
|
)
|
|
}
|
|
if a.CreatedAt, err = time.Parse(time.RFC3339, createdAt); err != nil {
|
|
return nil, fmt.Errorf("InsertApproval: parse created_at: %w", err)
|
|
}
|
|
if a.UpdatedAt, err = time.Parse(time.RFC3339, updatedAt); err != nil {
|
|
return nil, fmt.Errorf("InsertApproval: parse updated_at: %w", err)
|
|
}
|
|
return &a, nil
|
|
}
|
|
|
|
const selectApprovalId = `
|
|
SELECT created_at, id, message_id, status, tool_call_id, updated_at
|
|
FROM approvals
|
|
WHERE id = ?
|
|
`
|
|
|
|
// SelectApprovalId returns a single approval by ID.
|
|
func (q *Queries) SelectApprovalId(ctx context.Context, id string) (*Approval, error) {
|
|
row := q.db.QueryRowContext(ctx, selectApprovalId, id)
|
|
|
|
var (
|
|
a Approval
|
|
createdAt string
|
|
updatedAt string
|
|
)
|
|
err := row.Scan(
|
|
&createdAt,
|
|
&a.Id,
|
|
&a.MessageId,
|
|
&a.Status,
|
|
&a.ToolCallId,
|
|
&updatedAt,
|
|
)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("SelectApprovalId: %w", err)
|
|
}
|
|
if a.CreatedAt, err = time.Parse(time.RFC3339, createdAt); err != nil {
|
|
return nil, fmt.Errorf("SelectApprovalId: parse created_at: %w", err)
|
|
}
|
|
if a.UpdatedAt, err = time.Parse(time.RFC3339, updatedAt); err != nil {
|
|
return nil, fmt.Errorf("SelectApprovalId: parse updated_at: %w", err)
|
|
}
|
|
return &a, nil
|
|
}
|
|
|
|
const selectApprovalsMessageId = `
|
|
SELECT created_at, id, message_id, status, tool_call_id, updated_at
|
|
FROM approvals
|
|
WHERE message_id = ?
|
|
ORDER BY created_at
|
|
`
|
|
|
|
// SelectApprovalsMessageId returns all approvals for a message,
|
|
// ordered by creation time.
|
|
func (q *Queries) SelectApprovalsMessageId(ctx context.Context, messageId string) ([]Approval, error) {
|
|
rows, err := q.db.QueryContext(ctx, selectApprovalsMessageId, messageId)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("SelectApprovalsMessageId: %w", err)
|
|
}
|
|
defer rows.Close()
|
|
|
|
var approvals []Approval
|
|
for rows.Next() {
|
|
var (
|
|
a Approval
|
|
createdAt string
|
|
updatedAt string
|
|
)
|
|
if err := rows.Scan(
|
|
&createdAt,
|
|
&a.Id,
|
|
&a.MessageId,
|
|
&a.Status,
|
|
&a.ToolCallId,
|
|
&updatedAt,
|
|
); err != nil {
|
|
return nil, fmt.Errorf("SelectApprovalsMessageId: %w", err)
|
|
}
|
|
if a.CreatedAt, err = time.Parse(time.RFC3339, createdAt); err != nil {
|
|
return nil, fmt.Errorf("SelectApprovalsMessageId: parse created_at: %w", err)
|
|
}
|
|
if a.UpdatedAt, err = time.Parse(time.RFC3339, updatedAt); err != nil {
|
|
return nil, fmt.Errorf("SelectApprovalsMessageId: parse updated_at: %w", err)
|
|
}
|
|
approvals = append(approvals, a)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, fmt.Errorf("SelectApprovalsMessageId: %w", err)
|
|
}
|
|
return approvals, nil
|
|
}
|
|
|
|
const selectPendingApprovals = `
|
|
SELECT created_at, id, message_id, status, tool_call_id, updated_at
|
|
FROM approvals
|
|
WHERE status = 'pending'
|
|
ORDER BY created_at
|
|
`
|
|
|
|
// SelectPendingApprovals returns all pending approvals across all
|
|
// conversations, ordered by creation time. This serves as the global
|
|
// inbox for the UI.
|
|
func (q *Queries) SelectPendingApprovals(ctx context.Context) ([]Approval, error) {
|
|
rows, err := q.db.QueryContext(ctx, selectPendingApprovals)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("SelectPendingApprovals: %w", err)
|
|
}
|
|
defer rows.Close()
|
|
|
|
var approvals []Approval
|
|
for rows.Next() {
|
|
var (
|
|
a Approval
|
|
createdAt string
|
|
updatedAt string
|
|
)
|
|
if err := rows.Scan(
|
|
&createdAt,
|
|
&a.Id,
|
|
&a.MessageId,
|
|
&a.Status,
|
|
&a.ToolCallId,
|
|
&updatedAt,
|
|
); err != nil {
|
|
return nil, fmt.Errorf("SelectPendingApprovals: %w", err)
|
|
}
|
|
if a.CreatedAt, err = time.Parse(time.RFC3339, createdAt); err != nil {
|
|
return nil, fmt.Errorf("SelectPendingApprovals: parse created_at: %w", err)
|
|
}
|
|
if a.UpdatedAt, err = time.Parse(time.RFC3339, updatedAt); err != nil {
|
|
return nil, fmt.Errorf("SelectPendingApprovals: parse updated_at: %w", err)
|
|
}
|
|
approvals = append(approvals, a)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, fmt.Errorf("SelectPendingApprovals: %w", err)
|
|
}
|
|
return approvals, nil
|
|
}
|
|
|
|
const updateApprovalStatus = `
|
|
UPDATE approvals
|
|
SET status = ?, updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
|
|
WHERE id = ?
|
|
`
|
|
|
|
// UpdateApprovalStatusParams holds arguments for UpdateApprovalStatus.
|
|
type UpdateApprovalStatusParams struct {
|
|
Id string
|
|
Status ApprovalStatus
|
|
}
|
|
|
|
// UpdateApprovalStatus transitions an approval's status and bumps
|
|
// updated_at. The caller is responsible for valid transitions.
|
|
func (q *Queries) UpdateApprovalStatus(ctx context.Context, arg UpdateApprovalStatusParams) error {
|
|
_, err := q.db.ExecContext(
|
|
ctx,
|
|
updateApprovalStatus,
|
|
arg.Status,
|
|
arg.Id,
|
|
)
|
|
if err != nil {
|
|
return fmt.Errorf("UpdateApprovalStatus: %w", err)
|
|
}
|
|
return nil
|
|
}
|