feature: add first time install process
This commit is contained in:
@ -58,6 +58,12 @@ type Role struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type SystemOption struct {
|
||||
OptionID uuid.UUID `json:"option_id"`
|
||||
Key string `json:"key"`
|
||||
Value sql.NullString `json:"value"`
|
||||
}
|
||||
|
||||
type Task struct {
|
||||
TaskID uuid.UUID `json:"task_id"`
|
||||
TaskGroupID uuid.UUID `json:"task_group_id"`
|
||||
|
@ -15,6 +15,7 @@ type Querier interface {
|
||||
CreateProjectLabel(ctx context.Context, arg CreateProjectLabelParams) (ProjectLabel, error)
|
||||
CreateProjectMember(ctx context.Context, arg CreateProjectMemberParams) (ProjectMember, error)
|
||||
CreateRefreshToken(ctx context.Context, arg CreateRefreshTokenParams) (RefreshToken, error)
|
||||
CreateSystemOption(ctx context.Context, arg CreateSystemOptionParams) (SystemOption, error)
|
||||
CreateTask(ctx context.Context, arg CreateTaskParams) (Task, error)
|
||||
CreateTaskAssigned(ctx context.Context, arg CreateTaskAssignedParams) (TaskAssigned, error)
|
||||
CreateTaskChecklist(ctx context.Context, arg CreateTaskChecklistParams) (TaskChecklist, error)
|
||||
@ -61,6 +62,7 @@ type Querier interface {
|
||||
GetRoleForProjectMemberByUserID(ctx context.Context, arg GetRoleForProjectMemberByUserIDParams) (Role, error)
|
||||
GetRoleForTeamMember(ctx context.Context, arg GetRoleForTeamMemberParams) (Role, error)
|
||||
GetRoleForUserID(ctx context.Context, userID uuid.UUID) (GetRoleForUserIDRow, error)
|
||||
GetSystemOptionByKey(ctx context.Context, key string) (GetSystemOptionByKeyRow, error)
|
||||
GetTaskByID(ctx context.Context, taskID uuid.UUID) (Task, error)
|
||||
GetTaskChecklistByID(ctx context.Context, taskChecklistID uuid.UUID) (TaskChecklist, error)
|
||||
GetTaskChecklistItemByID(ctx context.Context, taskChecklistItemID uuid.UUID) (TaskChecklistItem, error)
|
||||
|
5
internal/db/query/system_options.sql
Normal file
5
internal/db/query/system_options.sql
Normal file
@ -0,0 +1,5 @@
|
||||
-- name: GetSystemOptionByKey :one
|
||||
SELECT key, value FROM system_options WHERE key = $1;
|
||||
|
||||
-- name: CreateSystemOption :one
|
||||
INSERT INTO system_options (key, value) VALUES ($1, $2) RETURNING *;
|
41
internal/db/system_options.sql.go
Normal file
41
internal/db/system_options.sql.go
Normal file
@ -0,0 +1,41 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// source: system_options.sql
|
||||
|
||||
package db
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
const createSystemOption = `-- name: CreateSystemOption :one
|
||||
INSERT INTO system_options (key, value) VALUES ($1, $2) RETURNING option_id, key, value
|
||||
`
|
||||
|
||||
type CreateSystemOptionParams struct {
|
||||
Key string `json:"key"`
|
||||
Value sql.NullString `json:"value"`
|
||||
}
|
||||
|
||||
func (q *Queries) CreateSystemOption(ctx context.Context, arg CreateSystemOptionParams) (SystemOption, error) {
|
||||
row := q.db.QueryRowContext(ctx, createSystemOption, arg.Key, arg.Value)
|
||||
var i SystemOption
|
||||
err := row.Scan(&i.OptionID, &i.Key, &i.Value)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getSystemOptionByKey = `-- name: GetSystemOptionByKey :one
|
||||
SELECT key, value FROM system_options WHERE key = $1
|
||||
`
|
||||
|
||||
type GetSystemOptionByKeyRow struct {
|
||||
Key string `json:"key"`
|
||||
Value sql.NullString `json:"value"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetSystemOptionByKey(ctx context.Context, key string) (GetSystemOptionByKeyRow, error) {
|
||||
row := q.db.QueryRowContext(ctx, getSystemOptionByKey, key)
|
||||
var i GetSystemOptionByKeyRow
|
||||
err := row.Scan(&i.Key, &i.Value)
|
||||
return i, err
|
||||
}
|
Reference in New Issue
Block a user