Skip to content

Commit

Permalink
fix Exported function returning value of unexported type
Browse files Browse the repository at this point in the history
  • Loading branch information
zachmann committed Apr 5, 2024
1 parent b1aa94b commit 293f5f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions internal/db/dbrepo/userrepo/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import (
"github.com/oidc-mytoken/server/internal/mytoken/pkg/mtid"
)

type mailInfo struct {
// MailInfo holds information about a user's mail settings
type MailInfo struct {
Mail db.NullString `db:"email"`
MailVerified bool `db:"email_verified"`
PreferHTMLMail bool `db:"prefer_html_mail"`
}

// GetMail returns the mail address and verification status for a user linked to a mytoken
func GetMail(rlog log.Ext1FieldLogger, tx *sqlx.Tx, mtID mtid.MTID) (data mailInfo, err error) {
func GetMail(rlog log.Ext1FieldLogger, tx *sqlx.Tx, mtID mtid.MTID) (data MailInfo, err error) {
err = db.RunWithinTransaction(
rlog, tx, func(tx *sqlx.Tx) error {
return errors.WithStack(tx.Get(&data, `CALL Users_GetMail(?)`, mtID))
Expand Down
12 changes: 6 additions & 6 deletions internal/db/notificationsrepo/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ func ExpandNotificationsToChildrenIfApplicable(rlog log.Ext1FieldLogger, tx *sql
)
}

// notificationInfoBaseWithClass is a type for holding information about a notification including class
type notificationInfoBaseWithClass struct {
// NotificationInfoBaseWithClass is a type for holding information about a notification including class
type NotificationInfoBaseWithClass struct {
notificationInfoBase
Class string `db:"class"`
}
Expand Down Expand Up @@ -64,7 +64,7 @@ func GetNotificationsForMTAndClass(
// GetNotificationsForMT checks for and returns the found notifications for a certain mytoken
func GetNotificationsForMT(
rlog log.Ext1FieldLogger, tx *sqlx.Tx, mtID any,
) (notifications []notificationInfoBaseWithClass, err error) {
) (notifications []NotificationInfoBaseWithClass, err error) {
err = db.RunWithinTransaction(
rlog, tx, func(tx *sqlx.Tx) error {
_, err = db.ParseError(tx.Select(&notifications, `CALL Notifications_GetForMT(?)`, mtID))
Expand Down Expand Up @@ -96,7 +96,7 @@ func GetNotificationsAndCalendarsForMT(

func notificationInfoBaseWithClassToNotificationInfo(
rlog log.Ext1FieldLogger, tx *sqlx.Tx,
in []notificationInfoBaseWithClass,
in []NotificationInfoBaseWithClass,
) (
out []api.
NotificationInfo,
Expand Down Expand Up @@ -146,7 +146,7 @@ func GetNotificationsForUser(
) (notifications []api.NotificationInfo, err error) {
err = db.RunWithinTransaction(
rlog, tx, func(tx *sqlx.Tx) error {
var withClass []notificationInfoBaseWithClass
var withClass []NotificationInfoBaseWithClass
_, err = db.ParseError(tx.Select(&withClass, `CALL Notifications_GetForUser(?)`, mtID))
if err != nil {
return errors.WithStack(err)
Expand All @@ -164,7 +164,7 @@ func GetNotificationForManagementCode(
) (info *api.ManagementCodeNotificationInfoResponse, err error) {
err = db.RunWithinTransaction(
rlog, tx, func(tx *sqlx.Tx) error {
var withClass []notificationInfoBaseWithClass
var withClass []NotificationInfoBaseWithClass
found, err := db.ParseError(
tx.Select(
&withClass, `CALL Notifications_GetForManagementCode(?)`,
Expand Down

0 comments on commit 293f5f4

Please sign in to comment.