Skip to content

Commit

Permalink
finish?
Browse files Browse the repository at this point in the history
  • Loading branch information
Satont committed Dec 19, 2024
1 parent 3533c28 commit 559f905
Show file tree
Hide file tree
Showing 8 changed files with 214 additions and 224 deletions.
26 changes: 26 additions & 0 deletions apps/api-gql/internal/delivery/gql/mappers/roles.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package mappers

import (
"github.com/twirapp/twir/apps/api-gql/internal/delivery/gql/gqlmodel"
"github.com/twirapp/twir/apps/api-gql/internal/entity"
)

func RolesToGql(m entity.ChannelRole) gqlmodel.Role {
permissions := make([]gqlmodel.ChannelRolePermissionEnum, len(m.Permissions))
for i, permission := range m.Permissions {
permissions[i] = gqlmodel.ChannelRolePermissionEnum(permission)
}

return gqlmodel.Role{
ID: m.ID.String(),
ChannelID: m.ChannelID,
Name: m.Name,
Type: gqlmodel.RoleTypeEnum(m.Type.String()),
Permissions: permissions,
Settings: &gqlmodel.RoleSettings{
RequiredWatchTime: int(m.RequiredWatchTime),
RequiredMessages: int(m.RequiredMessages),
RequiredUserChannelPoints: int(m.RequiredUsedChannelPoints),
},
}
}
250 changes: 58 additions & 192 deletions apps/api-gql/internal/delivery/gql/resolvers/roles.resolver.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 559f905

Please sign in to comment.