UPDATE: Project Module
All checks were successful
Build and Release / release (push) Successful in 1m15s
All checks were successful
Build and Release / release (push) Successful in 1m15s
This commit is contained in:
556
internal/gen/sqlc/project.sql.go
Normal file
556
internal/gen/sqlc/project.sql.go
Normal file
@@ -0,0 +1,556 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.30.0
|
||||
// source: project.sql
|
||||
|
||||
package sqlc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
const countProjects = `-- name: CountProjects :one
|
||||
SELECT count(*)
|
||||
FROM projects p
|
||||
WHERE p.is_deleted = false
|
||||
AND (
|
||||
$1::text[] IS NULL
|
||||
OR p.project_status = ANY($1::text[])
|
||||
)
|
||||
AND ($2::uuid[] IS NULL OR p.user_id = ANY($2::uuid[]))
|
||||
AND (
|
||||
$3::text IS NULL OR
|
||||
p.title ILIKE '%' || $3::text || '%' OR
|
||||
p.description ILIKE '%' || $3::text || '%'
|
||||
)
|
||||
AND ($4::timestamptz IS NULL OR p.created_at >= $4::timestamptz)
|
||||
AND ($5::timestamptz IS NULL OR p.created_at <= $5::timestamptz)
|
||||
`
|
||||
|
||||
type CountProjectsParams struct {
|
||||
Statuses []string `json:"statuses"`
|
||||
UserIds []pgtype.UUID `json:"user_ids"`
|
||||
SearchText pgtype.Text `json:"search_text"`
|
||||
CreatedFrom pgtype.Timestamptz `json:"created_from"`
|
||||
CreatedTo pgtype.Timestamptz `json:"created_to"`
|
||||
}
|
||||
|
||||
func (q *Queries) CountProjects(ctx context.Context, arg CountProjectsParams) (int64, error) {
|
||||
row := q.db.QueryRow(ctx, countProjects,
|
||||
arg.Statuses,
|
||||
arg.UserIds,
|
||||
arg.SearchText,
|
||||
arg.CreatedFrom,
|
||||
arg.CreatedTo,
|
||||
)
|
||||
var count int64
|
||||
err := row.Scan(&count)
|
||||
return count, err
|
||||
}
|
||||
|
||||
const createProject = `-- name: CreateProject :one
|
||||
INSERT INTO projects (
|
||||
title, description, project_status, user_id
|
||||
) VALUES (
|
||||
$1, $2, $3, $4
|
||||
)
|
||||
RETURNING
|
||||
id, title, description, latest_revision_id, version_count, project_status, locked_by, is_deleted, user_id, created_at, updated_at,
|
||||
json_build_object(
|
||||
'id', u.id,
|
||||
'email', u.email,
|
||||
'display_name', up.display_name,
|
||||
'full_name', up.full_name,
|
||||
'avatar_url', up.avatar_url
|
||||
)::json AS user,
|
||||
'{}'::uuid[] AS commit_ids,
|
||||
'{}'::uuid[] AS submission_ids
|
||||
`
|
||||
|
||||
type CreateProjectParams struct {
|
||||
Title string `json:"title"`
|
||||
Description pgtype.Text `json:"description"`
|
||||
ProjectStatus int16 `json:"project_status"`
|
||||
UserID pgtype.UUID `json:"user_id"`
|
||||
}
|
||||
|
||||
type CreateProjectRow struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description pgtype.Text `json:"description"`
|
||||
LatestRevisionID pgtype.UUID `json:"latest_revision_id"`
|
||||
VersionCount int32 `json:"version_count"`
|
||||
ProjectStatus int16 `json:"project_status"`
|
||||
LockedBy pgtype.UUID `json:"locked_by"`
|
||||
IsDeleted bool `json:"is_deleted"`
|
||||
UserID pgtype.UUID `json:"user_id"`
|
||||
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
||||
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
||||
User []byte `json:"user"`
|
||||
CommitIds []pgtype.UUID `json:"commit_ids"`
|
||||
SubmissionIds []pgtype.UUID `json:"submission_ids"`
|
||||
}
|
||||
|
||||
func (q *Queries) CreateProject(ctx context.Context, arg CreateProjectParams) (CreateProjectRow, error) {
|
||||
row := q.db.QueryRow(ctx, createProject,
|
||||
arg.Title,
|
||||
arg.Description,
|
||||
arg.ProjectStatus,
|
||||
arg.UserID,
|
||||
)
|
||||
var i CreateProjectRow
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Title,
|
||||
&i.Description,
|
||||
&i.LatestRevisionID,
|
||||
&i.VersionCount,
|
||||
&i.ProjectStatus,
|
||||
&i.LockedBy,
|
||||
&i.IsDeleted,
|
||||
&i.UserID,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.User,
|
||||
&i.CommitIds,
|
||||
&i.SubmissionIds,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const deleteProject = `-- name: DeleteProject :exec
|
||||
UPDATE projects
|
||||
SET
|
||||
is_deleted = true
|
||||
WHERE id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) DeleteProject(ctx context.Context, id pgtype.UUID) error {
|
||||
_, err := q.db.Exec(ctx, deleteProject, id)
|
||||
return err
|
||||
}
|
||||
|
||||
const getProjectById = `-- name: GetProjectById :one
|
||||
SELECT
|
||||
p.id, p.title, p.description, p.latest_revision_id, p.version_count, p.project_status, p.locked_by, p.is_deleted, p.user_id, p.created_at, p.updated_at,
|
||||
COALESCE(
|
||||
(SELECT array_agg(id) FROM revisions WHERE project_id = p.id),
|
||||
'{}'
|
||||
)::uuid[] AS commit_ids,
|
||||
COALESCE(
|
||||
(SELECT array_agg(id) FROM submissions WHERE project_id = p.id),
|
||||
'{}'
|
||||
)::uuid[] AS submission_ids,
|
||||
json_build_object(
|
||||
'id', u.id,
|
||||
'email', u.email,
|
||||
'display_name', up.display_name,
|
||||
'full_name', up.full_name,
|
||||
'avatar_url', up.avatar_url
|
||||
)::json AS user
|
||||
FROM projects p
|
||||
JOIN users u ON p.user_id = u.id
|
||||
LEFT JOIN user_profiles up ON u.id = up.user_id
|
||||
WHERE p.id = $1 AND p.is_deleted = false
|
||||
`
|
||||
|
||||
type GetProjectByIdRow struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description pgtype.Text `json:"description"`
|
||||
LatestRevisionID pgtype.UUID `json:"latest_revision_id"`
|
||||
VersionCount int32 `json:"version_count"`
|
||||
ProjectStatus int16 `json:"project_status"`
|
||||
LockedBy pgtype.UUID `json:"locked_by"`
|
||||
IsDeleted bool `json:"is_deleted"`
|
||||
UserID pgtype.UUID `json:"user_id"`
|
||||
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
||||
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
||||
CommitIds []pgtype.UUID `json:"commit_ids"`
|
||||
SubmissionIds []pgtype.UUID `json:"submission_ids"`
|
||||
User []byte `json:"user"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetProjectById(ctx context.Context, id pgtype.UUID) (GetProjectByIdRow, error) {
|
||||
row := q.db.QueryRow(ctx, getProjectById, id)
|
||||
var i GetProjectByIdRow
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Title,
|
||||
&i.Description,
|
||||
&i.LatestRevisionID,
|
||||
&i.VersionCount,
|
||||
&i.ProjectStatus,
|
||||
&i.LockedBy,
|
||||
&i.IsDeleted,
|
||||
&i.UserID,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.CommitIds,
|
||||
&i.SubmissionIds,
|
||||
&i.User,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getProjectsByIDs = `-- name: GetProjectsByIDs :many
|
||||
SELECT
|
||||
p.id, p.title, p.description, p.latest_revision_id, p.version_count, p.project_status, p.locked_by, p.is_deleted, p.user_id, p.created_at, p.updated_at,
|
||||
COALESCE((SELECT array_agg(id) FROM revisions WHERE project_id = p.id), '{}')::uuid[] AS commit_ids,
|
||||
COALESCE((SELECT array_agg(id) FROM submissions WHERE project_id = p.id), '{}')::uuid[] AS submission_ids,
|
||||
json_build_object(
|
||||
'id', u.id,
|
||||
'email', u.email,
|
||||
'display_name', up.display_name,
|
||||
'full_name', up.full_name,
|
||||
'avatar_url', up.avatar_url
|
||||
)::json AS user
|
||||
FROM projects p
|
||||
JOIN users u ON p.user_id = u.id
|
||||
LEFT JOIN user_profiles up ON u.id = up.user_id
|
||||
WHERE p.id = ANY($1::uuid[]) AND p.is_deleted = false
|
||||
`
|
||||
|
||||
type GetProjectsByIDsRow struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description pgtype.Text `json:"description"`
|
||||
LatestRevisionID pgtype.UUID `json:"latest_revision_id"`
|
||||
VersionCount int32 `json:"version_count"`
|
||||
ProjectStatus int16 `json:"project_status"`
|
||||
LockedBy pgtype.UUID `json:"locked_by"`
|
||||
IsDeleted bool `json:"is_deleted"`
|
||||
UserID pgtype.UUID `json:"user_id"`
|
||||
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
||||
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
||||
CommitIds []pgtype.UUID `json:"commit_ids"`
|
||||
SubmissionIds []pgtype.UUID `json:"submission_ids"`
|
||||
User []byte `json:"user"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetProjectsByIDs(ctx context.Context, dollar_1 []pgtype.UUID) ([]GetProjectsByIDsRow, error) {
|
||||
rows, err := q.db.Query(ctx, getProjectsByIDs, dollar_1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
items := []GetProjectsByIDsRow{}
|
||||
for rows.Next() {
|
||||
var i GetProjectsByIDsRow
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.Title,
|
||||
&i.Description,
|
||||
&i.LatestRevisionID,
|
||||
&i.VersionCount,
|
||||
&i.ProjectStatus,
|
||||
&i.LockedBy,
|
||||
&i.IsDeleted,
|
||||
&i.UserID,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.CommitIds,
|
||||
&i.SubmissionIds,
|
||||
&i.User,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getProjectsByUserId = `-- name: GetProjectsByUserId :many
|
||||
SELECT
|
||||
p.id, p.title, p.description, p.latest_revision_id, p.version_count, p.project_status, p.locked_by, p.is_deleted, p.user_id, p.created_at, p.updated_at,
|
||||
COALESCE(
|
||||
(SELECT array_agg(id) FROM revisions WHERE project_id = p.id),
|
||||
'{}'
|
||||
)::uuid[] AS commit_ids,
|
||||
COALESCE(
|
||||
(SELECT array_agg(id) FROM submissions WHERE project_id = p.id),
|
||||
'{}'
|
||||
)::uuid[] AS submission_ids,
|
||||
json_build_object(
|
||||
'id', u.id,
|
||||
'email', u.email,
|
||||
'display_name', up.display_name,
|
||||
'full_name', up.full_name,
|
||||
'avatar_url', up.avatar_url
|
||||
)::json AS user
|
||||
FROM projects p
|
||||
JOIN users u ON p.user_id = u.id
|
||||
LEFT JOIN user_profiles up ON u.id = up.user_id
|
||||
WHERE p.user_id = $1
|
||||
AND p.is_deleted = false
|
||||
AND ($2::uuid IS NULL OR p.id < $2::uuid)
|
||||
ORDER BY p.updated_at DESC
|
||||
LIMIT $3
|
||||
`
|
||||
|
||||
type GetProjectsByUserIdParams struct {
|
||||
UserID pgtype.UUID `json:"user_id"`
|
||||
CursorID pgtype.UUID `json:"cursor_id"`
|
||||
Limit int32 `json:"limit"`
|
||||
}
|
||||
|
||||
type GetProjectsByUserIdRow struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description pgtype.Text `json:"description"`
|
||||
LatestRevisionID pgtype.UUID `json:"latest_revision_id"`
|
||||
VersionCount int32 `json:"version_count"`
|
||||
ProjectStatus int16 `json:"project_status"`
|
||||
LockedBy pgtype.UUID `json:"locked_by"`
|
||||
IsDeleted bool `json:"is_deleted"`
|
||||
UserID pgtype.UUID `json:"user_id"`
|
||||
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
||||
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
||||
CommitIds []pgtype.UUID `json:"commit_ids"`
|
||||
SubmissionIds []pgtype.UUID `json:"submission_ids"`
|
||||
User []byte `json:"user"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetProjectsByUserId(ctx context.Context, arg GetProjectsByUserIdParams) ([]GetProjectsByUserIdRow, error) {
|
||||
rows, err := q.db.Query(ctx, getProjectsByUserId, arg.UserID, arg.CursorID, arg.Limit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
items := []GetProjectsByUserIdRow{}
|
||||
for rows.Next() {
|
||||
var i GetProjectsByUserIdRow
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.Title,
|
||||
&i.Description,
|
||||
&i.LatestRevisionID,
|
||||
&i.VersionCount,
|
||||
&i.ProjectStatus,
|
||||
&i.LockedBy,
|
||||
&i.IsDeleted,
|
||||
&i.UserID,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.CommitIds,
|
||||
&i.SubmissionIds,
|
||||
&i.User,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const searchProjects = `-- name: SearchProjects :many
|
||||
SELECT
|
||||
p.id, p.title, p.description, p.latest_revision_id, p.version_count, p.project_status, p.locked_by, p.is_deleted, p.user_id, p.created_at, p.updated_at,
|
||||
COALESCE(
|
||||
(SELECT array_agg(id) FROM revisions WHERE project_id = p.id),
|
||||
'{}'
|
||||
)::uuid[] AS commit_ids,
|
||||
COALESCE(
|
||||
(SELECT array_agg(id) FROM submissions WHERE project_id = p.id),
|
||||
'{}'
|
||||
)::uuid[] AS submission_ids,
|
||||
json_build_object(
|
||||
'id', u.id,
|
||||
'email', u.email,
|
||||
'display_name', up.display_name,
|
||||
'full_name', up.full_name,
|
||||
'avatar_url', up.avatar_url
|
||||
)::json AS user
|
||||
FROM projects p
|
||||
JOIN users u ON p.user_id = u.id
|
||||
LEFT JOIN user_profiles up ON u.id = up.user_id
|
||||
WHERE p.is_deleted = false
|
||||
AND (
|
||||
$1::text[] IS NULL
|
||||
OR p.project_status = ANY($1::text[])
|
||||
)
|
||||
AND ($2::uuid[] IS NULL OR p.user_id = ANY($2::uuid[]))
|
||||
AND (
|
||||
$3::text IS NULL OR
|
||||
p.title ILIKE '%' || $3::text || '%' OR
|
||||
p.description ILIKE '%' || $3::text || '%'
|
||||
)
|
||||
AND ($4::timestamptz IS NULL OR p.created_at >= $4::timestamptz)
|
||||
AND ($5::timestamptz IS NULL OR p.created_at <= $5::timestamptz)
|
||||
ORDER BY
|
||||
CASE WHEN $6 = 'created_at' AND $7 = 'asc' THEN p.created_at END ASC,
|
||||
CASE WHEN $6 = 'created_at' AND $7 = 'desc' THEN p.created_at END DESC,
|
||||
CASE WHEN $6 = 'updated_at' AND $7 = 'asc' THEN p.updated_at END ASC,
|
||||
CASE WHEN $6 = 'updated_at' AND $7 = 'desc' THEN p.updated_at END DESC,
|
||||
CASE WHEN $6 = 'title' AND $7 = 'asc' THEN p.title END ASC,
|
||||
CASE WHEN $6 = 'title' AND $7 = 'desc' THEN p.title END DESC,
|
||||
CASE WHEN $6 IS NULL THEN p.updated_at END DESC
|
||||
LIMIT $9
|
||||
OFFSET $8
|
||||
`
|
||||
|
||||
type SearchProjectsParams struct {
|
||||
Statuses []string `json:"statuses"`
|
||||
UserIds []pgtype.UUID `json:"user_ids"`
|
||||
SearchText pgtype.Text `json:"search_text"`
|
||||
CreatedFrom pgtype.Timestamptz `json:"created_from"`
|
||||
CreatedTo pgtype.Timestamptz `json:"created_to"`
|
||||
Sort interface{} `json:"sort"`
|
||||
Order interface{} `json:"order"`
|
||||
Offset int32 `json:"offset"`
|
||||
Limit int32 `json:"limit"`
|
||||
}
|
||||
|
||||
type SearchProjectsRow struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description pgtype.Text `json:"description"`
|
||||
LatestRevisionID pgtype.UUID `json:"latest_revision_id"`
|
||||
VersionCount int32 `json:"version_count"`
|
||||
ProjectStatus int16 `json:"project_status"`
|
||||
LockedBy pgtype.UUID `json:"locked_by"`
|
||||
IsDeleted bool `json:"is_deleted"`
|
||||
UserID pgtype.UUID `json:"user_id"`
|
||||
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
||||
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
||||
CommitIds []pgtype.UUID `json:"commit_ids"`
|
||||
SubmissionIds []pgtype.UUID `json:"submission_ids"`
|
||||
User []byte `json:"user"`
|
||||
}
|
||||
|
||||
func (q *Queries) SearchProjects(ctx context.Context, arg SearchProjectsParams) ([]SearchProjectsRow, error) {
|
||||
rows, err := q.db.Query(ctx, searchProjects,
|
||||
arg.Statuses,
|
||||
arg.UserIds,
|
||||
arg.SearchText,
|
||||
arg.CreatedFrom,
|
||||
arg.CreatedTo,
|
||||
arg.Sort,
|
||||
arg.Order,
|
||||
arg.Offset,
|
||||
arg.Limit,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
items := []SearchProjectsRow{}
|
||||
for rows.Next() {
|
||||
var i SearchProjectsRow
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.Title,
|
||||
&i.Description,
|
||||
&i.LatestRevisionID,
|
||||
&i.VersionCount,
|
||||
&i.ProjectStatus,
|
||||
&i.LockedBy,
|
||||
&i.IsDeleted,
|
||||
&i.UserID,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.CommitIds,
|
||||
&i.SubmissionIds,
|
||||
&i.User,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const updateProject = `-- name: UpdateProject :one
|
||||
UPDATE projects
|
||||
SET
|
||||
title = COALESCE($1, title),
|
||||
description = COALESCE($2, description),
|
||||
latest_revision_id = COALESCE($3, latest_revision_id),
|
||||
version_count = COALESCE($4, version_count),
|
||||
project_status = COALESCE($5, status),
|
||||
locked_by = COALESCE($6, locked_by),
|
||||
updated_at = NOW()
|
||||
FROM projects p
|
||||
JOIN users u ON p.user_id = u.id
|
||||
LEFT JOIN user_profiles up ON u.id = up.user_id
|
||||
WHERE p.id = $7 AND p.is_deleted = false
|
||||
RETURNING
|
||||
p.id, p.title, p.description, p.latest_revision_id, p.version_count, p.project_status, p.locked_by, p.is_deleted, p.user_id, p.created_at, p.updated_at,
|
||||
json_build_object(
|
||||
'id', u.id,
|
||||
'email', u.email,
|
||||
'display_name', up.display_name,
|
||||
'full_name', up.full_name,
|
||||
'avatar_url', up.avatar_url
|
||||
)::json AS user,
|
||||
COALESCE((SELECT array_agg(id) FROM revisions WHERE project_id = projects.id), '{}')::uuid[] AS commit_ids,
|
||||
COALESCE((SELECT array_agg(id) FROM submissions WHERE project_id = projects.id), '{}')::uuid[] AS submission_ids
|
||||
`
|
||||
|
||||
type UpdateProjectParams struct {
|
||||
Title pgtype.Text `json:"title"`
|
||||
Description pgtype.Text `json:"description"`
|
||||
LatestRevisionID pgtype.UUID `json:"latest_revision_id"`
|
||||
VersionCount pgtype.Int4 `json:"version_count"`
|
||||
Status pgtype.Int2 `json:"status"`
|
||||
LockedBy pgtype.UUID `json:"locked_by"`
|
||||
ID pgtype.UUID `json:"id"`
|
||||
}
|
||||
|
||||
type UpdateProjectRow struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description pgtype.Text `json:"description"`
|
||||
LatestRevisionID pgtype.UUID `json:"latest_revision_id"`
|
||||
VersionCount int32 `json:"version_count"`
|
||||
ProjectStatus int16 `json:"project_status"`
|
||||
LockedBy pgtype.UUID `json:"locked_by"`
|
||||
IsDeleted bool `json:"is_deleted"`
|
||||
UserID pgtype.UUID `json:"user_id"`
|
||||
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
||||
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
||||
User []byte `json:"user"`
|
||||
CommitIds []pgtype.UUID `json:"commit_ids"`
|
||||
SubmissionIds []pgtype.UUID `json:"submission_ids"`
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateProject(ctx context.Context, arg UpdateProjectParams) (UpdateProjectRow, error) {
|
||||
row := q.db.QueryRow(ctx, updateProject,
|
||||
arg.Title,
|
||||
arg.Description,
|
||||
arg.LatestRevisionID,
|
||||
arg.VersionCount,
|
||||
arg.Status,
|
||||
arg.LockedBy,
|
||||
arg.ID,
|
||||
)
|
||||
var i UpdateProjectRow
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Title,
|
||||
&i.Description,
|
||||
&i.LatestRevisionID,
|
||||
&i.VersionCount,
|
||||
&i.ProjectStatus,
|
||||
&i.LockedBy,
|
||||
&i.IsDeleted,
|
||||
&i.UserID,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.User,
|
||||
&i.CommitIds,
|
||||
&i.SubmissionIds,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
Reference in New Issue
Block a user