Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
perxis-go
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package Registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
perxis
perxis-go
Commits
8ed81545
Commit
8ed81545
authored
5 months ago
by
Anton Sattarov
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
3b0d7c32
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/invitations/conv.go
+0
-138
0 additions, 138 deletions
pkg/invitations/conv.go
with
0 additions
and
138 deletions
pkg/invitations/conv.go
deleted
100644 → 0
+
0
−
138
View file @
3b0d7c32
package
invitations
import
(
"git.perx.ru/perxis/perxis-go/pkg/options"
pb
"git.perx.ru/perxis/perxis-go/proto/invitations"
timestamp
"google.golang.org/protobuf/types/known/timestamppb"
)
type
AcceptRequest
struct
{
invitationId
string
userId
string
}
func
AcceptRequestFromPB
(
request
*
pb
.
AcceptRequest
)
*
AcceptRequest
{
return
&
AcceptRequest
{
invitationId
:
request
.
InvitationId
,
userId
:
request
.
UserId
}
}
type
CreateRequest
struct
{
invitation
*
Invitation
}
func
CreateRequestFromPB
(
request
*
pb
.
CreateRequest
)
*
CreateRequest
{
return
&
CreateRequest
{
invitation
:
InvitationFromProto
(
request
.
Invitation
)}
}
func
CreateResponseToPB
(
invitation
*
Invitation
)
*
pb
.
CreateResponse
{
return
nil
}
type
DeleteRequest
struct
{
invitationId
string
}
func
DeleteRequestFromPB
(
request
*
pb
.
DeleteRequest
)
*
DeleteRequest
{
return
&
DeleteRequest
{
invitationId
:
request
.
InvitationId
}
}
type
FindRequest
struct
{
filter
*
Filter
opts
*
options
.
FindOptions
}
func
FindRequestFromPB
(
request
*
pb
.
FindRequest
)
*
FindRequest
{
if
request
==
nil
{
return
nil
}
req
:=
&
FindRequest
{}
if
request
.
Filter
!=
nil
{
req
.
filter
=
&
Filter
{
ID
:
request
.
Filter
.
Id
,
Email
:
request
.
Filter
.
Email
,
OrgID
:
request
.
Filter
.
OrgId
,
SpaceID
:
request
.
Filter
.
SpaceId
,
OwnerID
:
request
.
Filter
.
OwnerId
,
Role
:
request
.
Filter
.
Role
,
}
}
if
request
.
Options
!=
nil
{
req
.
opts
=
options
.
FindOptionsFromPB
(
request
.
Options
)
}
return
req
}
func
FindResponseToPB
(
invitations
[]
*
Invitation
,
total
int
)
*
pb
.
FindResponse
{
protoInvitations
:=
make
([]
*
pb
.
Invitation
,
0
,
len
(
invitations
))
for
_
,
i
:=
range
invitations
{
protoInvitations
=
append
(
protoInvitations
,
InvitationToProto
(
i
))
}
return
&
pb
.
FindResponse
{
Invitations
:
protoInvitations
,
Total
:
int64
(
total
),
}
}
type
GetRequest
struct
{
invitationId
string
}
func
GetRequestFromPB
(
request
*
pb
.
GetRequest
)
*
GetRequest
{
if
request
==
nil
{
return
nil
}
return
&
GetRequest
{
invitationId
:
request
.
InvitationId
}
}
func
GetResponseToPB
(
invitation
*
Invitation
)
*
pb
.
GetResponse
{
return
&
pb
.
GetResponse
{
Invitation
:
InvitationToProto
(
invitation
)}
}
func
InvitationToProto
(
invitation
*
Invitation
)
*
pb
.
Invitation
{
if
invitation
==
nil
{
return
nil
}
pi
:=
&
pb
.
Invitation
{
Id
:
invitation
.
ID
,
Email
:
invitation
.
Email
,
OrgId
:
invitation
.
OrgID
,
SpaceId
:
invitation
.
SpaceID
,
OwnerId
:
invitation
.
OwnerID
,
Role
:
invitation
.
Role
,
}
if
invitation
.
CreatedAt
!=
nil
&&
!
invitation
.
CreatedAt
.
IsZero
()
{
pi
.
CreatedAt
=
timestamp
.
New
(
*
invitation
.
CreatedAt
)
}
if
invitation
.
ValidUntil
!=
nil
&&
!
invitation
.
ValidUntil
.
IsZero
()
{
pi
.
ValidUntil
=
timestamp
.
New
(
*
invitation
.
ValidUntil
)
}
return
pi
}
func
InvitationFromProto
(
protoInvitation
*
pb
.
Invitation
)
*
Invitation
{
if
protoInvitation
==
nil
{
return
nil
}
i
:=
&
Invitation
{
ID
:
protoInvitation
.
Id
,
Email
:
protoInvitation
.
Email
,
OrgID
:
protoInvitation
.
OrgId
,
SpaceID
:
protoInvitation
.
SpaceId
,
OwnerID
:
protoInvitation
.
OwnerId
,
Role
:
protoInvitation
.
Role
,
}
if
protoInvitation
.
CreatedAt
!=
nil
{
t
:=
protoInvitation
.
CreatedAt
.
AsTime
()
i
.
CreatedAt
=
&
t
}
if
protoInvitation
.
ValidUntil
!=
nil
{
t
:=
protoInvitation
.
ValidUntil
.
AsTime
()
i
.
ValidUntil
=
&
t
}
return
i
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment