mirror of
https://github.com/Dvorinka/Primora.git
synced 2026-06-03 20:13:01 +00:00
initiall commit
This commit is contained in:
@@ -0,0 +1,594 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.29.0
|
||||
// source: organizations.sql
|
||||
|
||||
package db
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
const addOrganizationMember = `-- name: AddOrganizationMember :one
|
||||
INSERT INTO core.organization_members (organization_id, user_id, role)
|
||||
VALUES ($1, $2, $3)
|
||||
ON CONFLICT (organization_id, user_id) DO UPDATE
|
||||
SET role = EXCLUDED.role
|
||||
RETURNING id, organization_id, user_id, role, created_at
|
||||
`
|
||||
|
||||
type AddOrganizationMemberParams struct {
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
Role string `json:"role"`
|
||||
}
|
||||
|
||||
func (q *Queries) AddOrganizationMember(ctx context.Context, arg AddOrganizationMemberParams) (CoreOrganizationMember, error) {
|
||||
row := q.db.QueryRow(ctx, addOrganizationMember, arg.OrganizationID, arg.UserID, arg.Role)
|
||||
var i CoreOrganizationMember
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.OrganizationID,
|
||||
&i.UserID,
|
||||
&i.Role,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const countOrganizationOwners = `-- name: CountOrganizationOwners :one
|
||||
SELECT COUNT(*)::BIGINT FROM core.organization_members
|
||||
WHERE organization_id = $1
|
||||
AND role = 'owner'
|
||||
`
|
||||
|
||||
func (q *Queries) CountOrganizationOwners(ctx context.Context, organizationID uuid.UUID) (int64, error) {
|
||||
row := q.db.QueryRow(ctx, countOrganizationOwners, organizationID)
|
||||
var column_1 int64
|
||||
err := row.Scan(&column_1)
|
||||
return column_1, err
|
||||
}
|
||||
|
||||
const createInvitation = `-- name: CreateInvitation :one
|
||||
INSERT INTO core.project_invitations (
|
||||
organization_id,
|
||||
project_id,
|
||||
email,
|
||||
org_role,
|
||||
project_role,
|
||||
token_hash,
|
||||
expires_at,
|
||||
invited_by_user_id
|
||||
) VALUES (
|
||||
$1,
|
||||
$2,
|
||||
LOWER($3),
|
||||
$4,
|
||||
$5,
|
||||
$6,
|
||||
$7,
|
||||
$8
|
||||
)
|
||||
RETURNING id, organization_id, project_id, email, org_role, project_role, token_hash, expires_at, accepted_at, invited_by_user_id, created_at
|
||||
`
|
||||
|
||||
type CreateInvitationParams struct {
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
ProjectID pgtype.UUID `json:"project_id"`
|
||||
Lower string `json:"lower"`
|
||||
OrgRole string `json:"org_role"`
|
||||
ProjectRole NullCoreProjectRole `json:"project_role"`
|
||||
TokenHash string `json:"token_hash"`
|
||||
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
|
||||
InvitedByUserID pgtype.UUID `json:"invited_by_user_id"`
|
||||
}
|
||||
|
||||
func (q *Queries) CreateInvitation(ctx context.Context, arg CreateInvitationParams) (CoreProjectInvitation, error) {
|
||||
row := q.db.QueryRow(ctx, createInvitation,
|
||||
arg.OrganizationID,
|
||||
arg.ProjectID,
|
||||
arg.Lower,
|
||||
arg.OrgRole,
|
||||
arg.ProjectRole,
|
||||
arg.TokenHash,
|
||||
arg.ExpiresAt,
|
||||
arg.InvitedByUserID,
|
||||
)
|
||||
var i CoreProjectInvitation
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.OrganizationID,
|
||||
&i.ProjectID,
|
||||
&i.Email,
|
||||
&i.OrgRole,
|
||||
&i.ProjectRole,
|
||||
&i.TokenHash,
|
||||
&i.ExpiresAt,
|
||||
&i.AcceptedAt,
|
||||
&i.InvitedByUserID,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const createOrganization = `-- name: CreateOrganization :one
|
||||
INSERT INTO core.organizations (slug, name)
|
||||
VALUES ($1, $2)
|
||||
RETURNING id, slug, name, created_at
|
||||
`
|
||||
|
||||
type CreateOrganizationParams struct {
|
||||
Slug string `json:"slug"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
func (q *Queries) CreateOrganization(ctx context.Context, arg CreateOrganizationParams) (CoreOrganization, error) {
|
||||
row := q.db.QueryRow(ctx, createOrganization, arg.Slug, arg.Name)
|
||||
var i CoreOrganization
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Slug,
|
||||
&i.Name,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const deleteOrganizationByID = `-- name: DeleteOrganizationByID :one
|
||||
DELETE FROM core.organizations
|
||||
WHERE id = $1
|
||||
RETURNING id, slug, name, created_at
|
||||
`
|
||||
|
||||
func (q *Queries) DeleteOrganizationByID(ctx context.Context, id uuid.UUID) (CoreOrganization, error) {
|
||||
row := q.db.QueryRow(ctx, deleteOrganizationByID, id)
|
||||
var i CoreOrganization
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Slug,
|
||||
&i.Name,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const deletePendingInvitationByIDForOrganization = `-- name: DeletePendingInvitationByIDForOrganization :one
|
||||
DELETE FROM core.project_invitations
|
||||
WHERE organization_id = $1
|
||||
AND id = $2
|
||||
AND accepted_at IS NULL
|
||||
RETURNING id, organization_id, project_id, email, org_role, project_role, token_hash, expires_at, accepted_at, invited_by_user_id, created_at
|
||||
`
|
||||
|
||||
type DeletePendingInvitationByIDForOrganizationParams struct {
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
ID uuid.UUID `json:"id"`
|
||||
}
|
||||
|
||||
func (q *Queries) DeletePendingInvitationByIDForOrganization(ctx context.Context, arg DeletePendingInvitationByIDForOrganizationParams) (CoreProjectInvitation, error) {
|
||||
row := q.db.QueryRow(ctx, deletePendingInvitationByIDForOrganization, arg.OrganizationID, arg.ID)
|
||||
var i CoreProjectInvitation
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.OrganizationID,
|
||||
&i.ProjectID,
|
||||
&i.Email,
|
||||
&i.OrgRole,
|
||||
&i.ProjectRole,
|
||||
&i.TokenHash,
|
||||
&i.ExpiresAt,
|
||||
&i.AcceptedAt,
|
||||
&i.InvitedByUserID,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getInvitationByIDForOrganization = `-- name: GetInvitationByIDForOrganization :one
|
||||
SELECT id, organization_id, project_id, email, org_role, project_role, token_hash, expires_at, accepted_at, invited_by_user_id, created_at FROM core.project_invitations
|
||||
WHERE organization_id = $1
|
||||
AND id = $2
|
||||
`
|
||||
|
||||
type GetInvitationByIDForOrganizationParams struct {
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
ID uuid.UUID `json:"id"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetInvitationByIDForOrganization(ctx context.Context, arg GetInvitationByIDForOrganizationParams) (CoreProjectInvitation, error) {
|
||||
row := q.db.QueryRow(ctx, getInvitationByIDForOrganization, arg.OrganizationID, arg.ID)
|
||||
var i CoreProjectInvitation
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.OrganizationID,
|
||||
&i.ProjectID,
|
||||
&i.Email,
|
||||
&i.OrgRole,
|
||||
&i.ProjectRole,
|
||||
&i.TokenHash,
|
||||
&i.ExpiresAt,
|
||||
&i.AcceptedAt,
|
||||
&i.InvitedByUserID,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getInvitationByTokenHash = `-- name: GetInvitationByTokenHash :one
|
||||
SELECT id, organization_id, project_id, email, org_role, project_role, token_hash, expires_at, accepted_at, invited_by_user_id, created_at FROM core.project_invitations
|
||||
WHERE token_hash = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetInvitationByTokenHash(ctx context.Context, tokenHash string) (CoreProjectInvitation, error) {
|
||||
row := q.db.QueryRow(ctx, getInvitationByTokenHash, tokenHash)
|
||||
var i CoreProjectInvitation
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.OrganizationID,
|
||||
&i.ProjectID,
|
||||
&i.Email,
|
||||
&i.OrgRole,
|
||||
&i.ProjectRole,
|
||||
&i.TokenHash,
|
||||
&i.ExpiresAt,
|
||||
&i.AcceptedAt,
|
||||
&i.InvitedByUserID,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getOrganizationMembership = `-- name: GetOrganizationMembership :one
|
||||
SELECT
|
||||
om.id, om.organization_id, om.user_id, om.role, om.created_at,
|
||||
o.name AS organization_name,
|
||||
o.slug AS organization_slug
|
||||
FROM core.organization_members om
|
||||
JOIN core.organizations o ON o.id = om.organization_id
|
||||
WHERE om.organization_id = $1
|
||||
AND om.user_id = $2
|
||||
`
|
||||
|
||||
type GetOrganizationMembershipParams struct {
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
}
|
||||
|
||||
type GetOrganizationMembershipRow struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
Role string `json:"role"`
|
||||
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
||||
OrganizationName string `json:"organization_name"`
|
||||
OrganizationSlug string `json:"organization_slug"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetOrganizationMembership(ctx context.Context, arg GetOrganizationMembershipParams) (GetOrganizationMembershipRow, error) {
|
||||
row := q.db.QueryRow(ctx, getOrganizationMembership, arg.OrganizationID, arg.UserID)
|
||||
var i GetOrganizationMembershipRow
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.OrganizationID,
|
||||
&i.UserID,
|
||||
&i.Role,
|
||||
&i.CreatedAt,
|
||||
&i.OrganizationName,
|
||||
&i.OrganizationSlug,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const listBucketsForOrganization = `-- name: ListBucketsForOrganization :many
|
||||
SELECT b.id
|
||||
FROM core.buckets b
|
||||
JOIN core.projects p ON p.id = b.project_id
|
||||
WHERE p.organization_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) ListBucketsForOrganization(ctx context.Context, organizationID uuid.UUID) ([]uuid.UUID, error) {
|
||||
rows, err := q.db.Query(ctx, listBucketsForOrganization, organizationID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []uuid.UUID
|
||||
for rows.Next() {
|
||||
var id uuid.UUID
|
||||
if err := rows.Scan(&id); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, id)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const listInvitationsForOrganization = `-- name: ListInvitationsForOrganization :many
|
||||
SELECT
|
||||
i.id,
|
||||
i.organization_id,
|
||||
i.project_id,
|
||||
p.name AS project_name,
|
||||
i.email,
|
||||
i.org_role,
|
||||
i.project_role,
|
||||
i.expires_at,
|
||||
i.accepted_at,
|
||||
i.invited_by_user_id,
|
||||
i.created_at
|
||||
FROM core.project_invitations i
|
||||
LEFT JOIN core.projects p ON p.id = i.project_id
|
||||
WHERE i.organization_id = $1
|
||||
ORDER BY i.created_at DESC
|
||||
`
|
||||
|
||||
type ListInvitationsForOrganizationRow struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
ProjectID pgtype.UUID `json:"project_id"`
|
||||
ProjectName *string `json:"project_name"`
|
||||
Email string `json:"email"`
|
||||
OrgRole string `json:"org_role"`
|
||||
ProjectRole NullCoreProjectRole `json:"project_role"`
|
||||
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
|
||||
AcceptedAt pgtype.Timestamptz `json:"accepted_at"`
|
||||
InvitedByUserID pgtype.UUID `json:"invited_by_user_id"`
|
||||
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
||||
}
|
||||
|
||||
func (q *Queries) ListInvitationsForOrganization(ctx context.Context, organizationID uuid.UUID) ([]ListInvitationsForOrganizationRow, error) {
|
||||
rows, err := q.db.Query(ctx, listInvitationsForOrganization, organizationID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []ListInvitationsForOrganizationRow
|
||||
for rows.Next() {
|
||||
var i ListInvitationsForOrganizationRow
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.OrganizationID,
|
||||
&i.ProjectID,
|
||||
&i.ProjectName,
|
||||
&i.Email,
|
||||
&i.OrgRole,
|
||||
&i.ProjectRole,
|
||||
&i.ExpiresAt,
|
||||
&i.AcceptedAt,
|
||||
&i.InvitedByUserID,
|
||||
&i.CreatedAt,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const listOrganizationMembers = `-- name: ListOrganizationMembers :many
|
||||
SELECT
|
||||
om.organization_id,
|
||||
om.user_id,
|
||||
om.role,
|
||||
om.created_at,
|
||||
u.email,
|
||||
u.name,
|
||||
u.email_verified
|
||||
FROM core.organization_members om
|
||||
JOIN core.users u ON u.id = om.user_id
|
||||
WHERE om.organization_id = $1
|
||||
ORDER BY om.created_at ASC
|
||||
`
|
||||
|
||||
type ListOrganizationMembersRow struct {
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
Role string `json:"role"`
|
||||
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
||||
Email string `json:"email"`
|
||||
Name string `json:"name"`
|
||||
EmailVerified bool `json:"email_verified"`
|
||||
}
|
||||
|
||||
func (q *Queries) ListOrganizationMembers(ctx context.Context, organizationID uuid.UUID) ([]ListOrganizationMembersRow, error) {
|
||||
rows, err := q.db.Query(ctx, listOrganizationMembers, organizationID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []ListOrganizationMembersRow
|
||||
for rows.Next() {
|
||||
var i ListOrganizationMembersRow
|
||||
if err := rows.Scan(
|
||||
&i.OrganizationID,
|
||||
&i.UserID,
|
||||
&i.Role,
|
||||
&i.CreatedAt,
|
||||
&i.Email,
|
||||
&i.Name,
|
||||
&i.EmailVerified,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const listOrganizationsForUser = `-- name: ListOrganizationsForUser :many
|
||||
SELECT
|
||||
o.id, o.slug, o.name, o.created_at,
|
||||
om.role AS membership_role
|
||||
FROM core.organizations o
|
||||
JOIN core.organization_members om ON om.organization_id = o.id
|
||||
WHERE om.user_id = $1
|
||||
ORDER BY o.created_at ASC
|
||||
`
|
||||
|
||||
type ListOrganizationsForUserRow struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Slug string `json:"slug"`
|
||||
Name string `json:"name"`
|
||||
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
||||
MembershipRole string `json:"membership_role"`
|
||||
}
|
||||
|
||||
func (q *Queries) ListOrganizationsForUser(ctx context.Context, userID uuid.UUID) ([]ListOrganizationsForUserRow, error) {
|
||||
rows, err := q.db.Query(ctx, listOrganizationsForUser, userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []ListOrganizationsForUserRow
|
||||
for rows.Next() {
|
||||
var i ListOrganizationsForUserRow
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.Slug,
|
||||
&i.Name,
|
||||
&i.CreatedAt,
|
||||
&i.MembershipRole,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const markInvitationAccepted = `-- name: MarkInvitationAccepted :one
|
||||
UPDATE core.project_invitations
|
||||
SET accepted_at = NOW()
|
||||
WHERE id = $1
|
||||
RETURNING id, organization_id, project_id, email, org_role, project_role, token_hash, expires_at, accepted_at, invited_by_user_id, created_at
|
||||
`
|
||||
|
||||
func (q *Queries) MarkInvitationAccepted(ctx context.Context, id uuid.UUID) (CoreProjectInvitation, error) {
|
||||
row := q.db.QueryRow(ctx, markInvitationAccepted, id)
|
||||
var i CoreProjectInvitation
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.OrganizationID,
|
||||
&i.ProjectID,
|
||||
&i.Email,
|
||||
&i.OrgRole,
|
||||
&i.ProjectRole,
|
||||
&i.TokenHash,
|
||||
&i.ExpiresAt,
|
||||
&i.AcceptedAt,
|
||||
&i.InvitedByUserID,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const removeOrganizationMember = `-- name: RemoveOrganizationMember :one
|
||||
DELETE FROM core.organization_members
|
||||
WHERE organization_id = $1
|
||||
AND user_id = $2
|
||||
RETURNING id, organization_id, user_id, role, created_at
|
||||
`
|
||||
|
||||
type RemoveOrganizationMemberParams struct {
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
}
|
||||
|
||||
func (q *Queries) RemoveOrganizationMember(ctx context.Context, arg RemoveOrganizationMemberParams) (CoreOrganizationMember, error) {
|
||||
row := q.db.QueryRow(ctx, removeOrganizationMember, arg.OrganizationID, arg.UserID)
|
||||
var i CoreOrganizationMember
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.OrganizationID,
|
||||
&i.UserID,
|
||||
&i.Role,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const removeProjectMembershipsForOrganizationUser = `-- name: RemoveProjectMembershipsForOrganizationUser :exec
|
||||
DELETE FROM core.project_members pm
|
||||
USING core.projects p
|
||||
WHERE pm.project_id = p.id
|
||||
AND p.organization_id = $1
|
||||
AND pm.user_id = $2
|
||||
`
|
||||
|
||||
type RemoveProjectMembershipsForOrganizationUserParams struct {
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
}
|
||||
|
||||
func (q *Queries) RemoveProjectMembershipsForOrganizationUser(ctx context.Context, arg RemoveProjectMembershipsForOrganizationUserParams) error {
|
||||
_, err := q.db.Exec(ctx, removeProjectMembershipsForOrganizationUser, arg.OrganizationID, arg.UserID)
|
||||
return err
|
||||
}
|
||||
|
||||
const updateOrganizationByID = `-- name: UpdateOrganizationByID :one
|
||||
UPDATE core.organizations
|
||||
SET slug = $2,
|
||||
name = $3
|
||||
WHERE id = $1
|
||||
RETURNING id, slug, name, created_at
|
||||
`
|
||||
|
||||
type UpdateOrganizationByIDParams struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Slug string `json:"slug"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateOrganizationByID(ctx context.Context, arg UpdateOrganizationByIDParams) (CoreOrganization, error) {
|
||||
row := q.db.QueryRow(ctx, updateOrganizationByID, arg.ID, arg.Slug, arg.Name)
|
||||
var i CoreOrganization
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Slug,
|
||||
&i.Name,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const updateOrganizationMemberRole = `-- name: UpdateOrganizationMemberRole :one
|
||||
UPDATE core.organization_members
|
||||
SET role = $3
|
||||
WHERE organization_id = $1
|
||||
AND user_id = $2
|
||||
RETURNING id, organization_id, user_id, role, created_at
|
||||
`
|
||||
|
||||
type UpdateOrganizationMemberRoleParams struct {
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
Role string `json:"role"`
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateOrganizationMemberRole(ctx context.Context, arg UpdateOrganizationMemberRoleParams) (CoreOrganizationMember, error) {
|
||||
row := q.db.QueryRow(ctx, updateOrganizationMemberRole, arg.OrganizationID, arg.UserID, arg.Role)
|
||||
var i CoreOrganizationMember
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.OrganizationID,
|
||||
&i.UserID,
|
||||
&i.Role,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
Reference in New Issue
Block a user