(ctx context.Context, opts *database.InsertProjectInviteOptions)
| 2728 | } |
| 2729 | |
| 2730 | func (c *connection) InsertProjectInvite(ctx context.Context, opts *database.InsertProjectInviteOptions) error { |
| 2731 | if err := database.Validate(opts); err != nil { |
| 2732 | return err |
| 2733 | } |
| 2734 | var inviterID any |
| 2735 | if opts.InviterID != "" { |
| 2736 | inviterID = opts.InviterID |
| 2737 | } |
| 2738 | |
| 2739 | resJSON, err := marshalResourceNames(opts.Resources) |
| 2740 | if err != nil { |
| 2741 | return err |
| 2742 | } |
| 2743 | |
| 2744 | _, err = c.getDB(ctx).ExecContext(ctx, |
| 2745 | `INSERT INTO project_invites (email, org_invite_id, project_id, project_role_id, invited_by_user_id, restrict_resources, resources) VALUES ($1, $2, $3, $4, $5, $6, $7)`, |
| 2746 | opts.Email, opts.OrgInviteID, opts.ProjectID, opts.RoleID, inviterID, opts.RestrictResources, resJSON) |
| 2747 | if err != nil { |
| 2748 | return parseErr("project invite", err) |
| 2749 | } |
| 2750 | return nil |
| 2751 | } |
| 2752 | |
| 2753 | func (c *connection) DeleteProjectInvite(ctx context.Context, id string) error { |
| 2754 | res, err := c.getDB(ctx).ExecContext(ctx, "DELETE FROM project_invites WHERE id = $1", id) |
nothing calls this directly
no test coverage detected