Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Clutch
Commits
41c8584e
Unverified
Commit
41c8584e
authored
3 years ago
by
Mike Cutalo
Committed by
GitHub
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
shortlink: refactor protos & add db table (#2071)
parent
9eab7ca6
No related merge requests found
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
api/shortlink/v1/shortlink.proto
+3
-3
api/shortlink/v1/shortlink.proto
backend/api/shortlink/v1/shortlink.pb.go
+54
-55
backend/api/shortlink/v1/shortlink.pb.go
backend/api/shortlink/v1/shortlink.pb.validate.go
+2
-2
backend/api/shortlink/v1/shortlink.pb.validate.go
backend/cmd/migrate/migrations/000014_create_shortlink_table.down.sql
+1
-0
...migrate/migrations/000014_create_shortlink_table.down.sql
backend/cmd/migrate/migrations/000014_create_shortlink_table.up.sql
+10
-0
...d/migrate/migrations/000014_create_shortlink_table.up.sql
frontend/api/src/index.d.ts
+6
-6
frontend/api/src/index.d.ts
frontend/api/src/index.js
+17
-17
frontend/api/src/index.js
with
93 additions
and
83 deletions
+93
-83
api/shortlink/v1/shortlink.proto
+
3
-
3
View file @
41c8584e
...
...
@@ -4,9 +4,9 @@ package clutch.shortlink.v1;
option
go_package
=
"github.com/lyft/clutch/backend/api/shortlink/v1;shortlinkv1"
;
import
"google/protobuf/any.proto"
;
import
"google/api/annotations.proto"
;
import
"validate/validate.proto"
;
import
"google/protobuf/struct.proto"
;
import
"api/v1/annotations.proto"
;
...
...
@@ -38,7 +38,7 @@ message CreateResponse {
}
message
GetRequest
{
string
shortlink_
hash
=
1
[
(
validate.rules
)
.
string
=
{
min_bytes
:
1
}
];
string
hash
=
1
[
(
validate.rules
)
.
string
=
{
min_bytes
:
1
}
];
}
message
GetResponse
{
...
...
@@ -52,5 +52,5 @@ message GetResponse {
// For example adding a "revision" identifier in the future.
message
ShareableState
{
string
key
=
1
[
(
validate.rules
)
.
string
=
{
min_bytes
:
1
}
];
google.protobuf.
Any
state
=
2
[
(
validate.rules
)
.
any.required
=
true
];
google.protobuf.
Value
state
=
2
[
(
validate.rules
)
.
any.required
=
true
];
}
This diff is collapsed.
Click to expand it.
backend/api/shortlink/v1/shortlink.pb.go
+
54
-
55
View file @
41c8584e
...
...
@@ -12,7 +12,7 @@ import (
_
"google.golang.org/genproto/googleapis/api/annotations"
protoreflect
"google.golang.org/protobuf/reflect/protoreflect"
protoimpl
"google.golang.org/protobuf/runtime/protoimpl"
any
pb
"google.golang.org/protobuf/types/known/
any
pb"
struct
pb
"google.golang.org/protobuf/types/known/
struct
pb"
reflect
"reflect"
sync
"sync"
)
...
...
@@ -131,7 +131,7 @@ type GetRequest struct {
sizeCache
protoimpl
.
SizeCache
unknownFields
protoimpl
.
UnknownFields
Shortlink
Hash
string
`protobuf:"bytes,1,opt,name=
shortlink_hash,json=shortlinkH
ash,proto3" json:"
shortlink_
hash,omitempty"`
Hash
string
`protobuf:"bytes,1,opt,name=
h
ash,proto3" json:"hash,omitempty"`
}
func
(
x
*
GetRequest
)
Reset
()
{
...
...
@@ -166,9 +166,9 @@ func (*GetRequest) Descriptor() ([]byte, []int) {
return
file_shortlink_v1_shortlink_proto_rawDescGZIP
(),
[]
int
{
2
}
}
func
(
x
*
GetRequest
)
Get
Shortlink
Hash
()
string
{
func
(
x
*
GetRequest
)
GetHash
()
string
{
if
x
!=
nil
{
return
x
.
Shortlink
Hash
return
x
.
Hash
}
return
""
}
...
...
@@ -237,8 +237,8 @@ type ShareableState struct {
sizeCache
protoimpl
.
SizeCache
unknownFields
protoimpl
.
UnknownFields
Key
string
`protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
State
*
anypb
.
Any
`protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"`
Key
string
`protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
State
*
structpb
.
Value
`protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"`
}
func
(
x
*
ShareableState
)
Reset
()
{
...
...
@@ -280,7 +280,7 @@ func (x *ShareableState) GetKey() string {
return
""
}
func
(
x
*
ShareableState
)
GetState
()
*
anypb
.
Any
{
func
(
x
*
ShareableState
)
GetState
()
*
structpb
.
Value
{
if
x
!=
nil
{
return
x
.
State
}
...
...
@@ -293,59 +293,58 @@ var file_shortlink_v1_shortlink_proto_rawDesc = []byte{
0x0a
,
0x1c
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2f
,
0x76
,
0x31
,
0x2f
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x12
,
0x13
,
0x63
,
0x6c
,
0x75
,
0x74
,
0x63
,
0x68
,
0x2e
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2e
,
0x76
,
0x31
,
0x1a
,
0x19
,
0x67
,
0x6f
,
0x6f
,
0x67
,
0x6c
,
0x65
,
0x2f
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x62
,
0x75
,
0x66
,
0x2f
,
0x61
,
0x6e
,
0x79
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x1a
,
0x1c
,
0x67
,
0x6f
,
0x6f
,
0x67
,
0x6c
,
0x65
,
0x2f
,
0x61
,
0x70
,
0x69
,
0x2f
,
0x61
,
0x6e
,
0x6e
,
0x6f
,
0x74
,
0x61
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x73
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x1a
,
0x17
,
0x76
,
0x61
,
0x6c
,
0x69
,
0x64
,
0x61
,
0x74
,
0x65
,
0x2f
,
0x76
,
0x61
,
0x6c
,
0x69
,
0x64
,
0x61
,
0x74
,
0x65
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x1a
,
0x18
,
0x61
,
0x70
,
0x69
,
0x2f
,
0x76
,
0x31
,
0x2f
,
0x61
,
0x6e
,
0x6e
,
0x6f
,
0x74
,
0x61
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x73
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x22
,
0x71
,
0x0a
,
0x0d
,
0x43
,
0x72
,
0x65
,
0x61
,
0x74
,
0x65
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x12
,
0x1b
,
0x0a
,
0x04
,
0x70
,
0x61
,
0x74
,
0x68
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x42
,
0x07
,
0xfa
,
0x42
,
0x04
,
0x72
,
0x02
,
0x20
,
0x01
,
0x52
,
0x04
,
0x70
,
0x61
,
0x74
,
0x68
,
0x12
,
0x43
,
0x0a
,
0x05
,
0x73
,
0x74
,
0x61
,
0x74
,
0x65
,
0x18
,
0x02
,
0x20
,
0x03
,
0x28
,
0x0b
,
0x32
,
0x23
,
0x2e
,
0x63
,
0x6c
,
0x75
,
0x74
,
0x63
,
0x68
,
0x2e
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2e
,
0x76
,
0x31
,
0x2e
,
0x53
,
0x68
,
0x61
,
0x72
,
0x65
,
0x61
,
0x62
,
0x6c
,
0x65
,
0x53
,
0x74
,
0x61
,
0x74
,
0x65
,
0x42
,
0x08
,
0xfa
,
0x42
,
0x05
,
0x92
,
0x01
,
0x02
,
0x08
,
0x01
,
0x52
,
0x05
,
0x73
,
0x74
,
0x61
,
0x74
,
0x65
,
0x22
,
0x24
,
0x0a
,
0x0e
,
0x43
,
0x72
,
0x65
,
0x61
,
0x74
,
0x65
,
0x52
,
0x65
,
0x73
,
0x70
,
0x6f
,
0x6e
,
0x73
,
0x65
,
0x12
,
0x12
,
0x0a
,
0x04
,
0x68
,
0x61
,
0x73
,
0x68
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x04
,
0x68
,
0x61
,
0x73
,
0x68
,
0x22
,
0x3c
,
0x0a
,
0x0a
,
0x47
,
0x65
,
0x74
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x12
,
0x2e
,
0x0a
,
0x0e
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x5f
,
0x68
,
0x61
,
0x73
,
0x68
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x42
,
0x07
,
0xfa
,
0x42
,
0x04
,
0x72
,
0x02
,
0x20
,
0x01
,
0x52
,
0x0d
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x48
,
0x61
,
0x73
,
0x68
,
0x22
,
0x5c
,
0x0a
,
0x0b
,
0x47
,
0x65
,
0x74
,
0x52
,
0x65
,
0x73
,
0x2e
,
0x76
,
0x31
,
0x1a
,
0x1c
,
0x67
,
0x6f
,
0x6f
,
0x67
,
0x6c
,
0x65
,
0x2f
,
0x61
,
0x70
,
0x69
,
0x2f
,
0x61
,
0x6e
,
0x6e
,
0x6f
,
0x74
,
0x61
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x73
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x1a
,
0x17
,
0x76
,
0x61
,
0x6c
,
0x69
,
0x64
,
0x61
,
0x74
,
0x65
,
0x2f
,
0x76
,
0x61
,
0x6c
,
0x69
,
0x64
,
0x61
,
0x74
,
0x65
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x1a
,
0x1c
,
0x67
,
0x6f
,
0x6f
,
0x67
,
0x6c
,
0x65
,
0x2f
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x62
,
0x75
,
0x66
,
0x2f
,
0x73
,
0x74
,
0x72
,
0x75
,
0x63
,
0x74
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x1a
,
0x18
,
0x61
,
0x70
,
0x69
,
0x2f
,
0x76
,
0x31
,
0x2f
,
0x61
,
0x6e
,
0x6e
,
0x6f
,
0x74
,
0x61
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x73
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x22
,
0x71
,
0x0a
,
0x0d
,
0x43
,
0x72
,
0x65
,
0x61
,
0x74
,
0x65
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x12
,
0x1b
,
0x0a
,
0x04
,
0x70
,
0x61
,
0x74
,
0x68
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x42
,
0x07
,
0xfa
,
0x42
,
0x04
,
0x72
,
0x02
,
0x20
,
0x01
,
0x52
,
0x04
,
0x70
,
0x61
,
0x74
,
0x68
,
0x12
,
0x43
,
0x0a
,
0x05
,
0x73
,
0x74
,
0x61
,
0x74
,
0x65
,
0x18
,
0x02
,
0x20
,
0x03
,
0x28
,
0x0b
,
0x32
,
0x23
,
0x2e
,
0x63
,
0x6c
,
0x75
,
0x74
,
0x63
,
0x68
,
0x2e
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2e
,
0x76
,
0x31
,
0x2e
,
0x53
,
0x68
,
0x61
,
0x72
,
0x65
,
0x61
,
0x62
,
0x6c
,
0x65
,
0x53
,
0x74
,
0x61
,
0x74
,
0x65
,
0x42
,
0x08
,
0xfa
,
0x42
,
0x05
,
0x92
,
0x01
,
0x02
,
0x08
,
0x01
,
0x52
,
0x05
,
0x73
,
0x74
,
0x61
,
0x74
,
0x65
,
0x22
,
0x24
,
0x0a
,
0x0e
,
0x43
,
0x72
,
0x65
,
0x61
,
0x74
,
0x65
,
0x52
,
0x65
,
0x73
,
0x70
,
0x6f
,
0x6e
,
0x73
,
0x65
,
0x12
,
0x12
,
0x0a
,
0x04
,
0x68
,
0x61
,
0x73
,
0x68
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x04
,
0x68
,
0x61
,
0x73
,
0x68
,
0x22
,
0x29
,
0x0a
,
0x0a
,
0x47
,
0x65
,
0x74
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x12
,
0x1b
,
0x0a
,
0x04
,
0x68
,
0x61
,
0x73
,
0x68
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x42
,
0x07
,
0xfa
,
0x42
,
0x04
,
0x72
,
0x02
,
0x20
,
0x01
,
0x52
,
0x04
,
0x68
,
0x61
,
0x73
,
0x68
,
0x22
,
0x5c
,
0x0a
,
0x0b
,
0x47
,
0x65
,
0x74
,
0x52
,
0x65
,
0x73
,
0x70
,
0x6f
,
0x6e
,
0x73
,
0x65
,
0x12
,
0x12
,
0x0a
,
0x04
,
0x70
,
0x61
,
0x74
,
0x68
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x04
,
0x70
,
0x61
,
0x74
,
0x68
,
0x12
,
0x39
,
0x0a
,
0x05
,
0x73
,
0x74
,
0x61
,
0x74
,
0x65
,
0x18
,
0x02
,
0x20
,
0x03
,
0x28
,
0x0b
,
0x32
,
0x23
,
0x2e
,
0x63
,
0x6c
,
0x75
,
0x74
,
0x63
,
0x68
,
0x2e
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2e
,
0x76
,
0x31
,
0x2e
,
0x53
,
0x68
,
0x61
,
0x72
,
0x65
,
0x61
,
0x62
,
0x6c
,
0x65
,
0x53
,
0x74
,
0x61
,
0x74
,
0x65
,
0x52
,
0x05
,
0x73
,
0x74
,
0x61
,
0x74
,
0x65
,
0x22
,
0x6
1
,
0x0a
,
0x0e
,
0x53
,
0x68
,
0x61
,
0x72
,
0x65
,
0x61
,
0x62
,
0x6c
,
0x74
,
0x61
,
0x74
,
0x65
,
0x22
,
0x6
3
,
0x0a
,
0x0e
,
0x53
,
0x68
,
0x61
,
0x72
,
0x65
,
0x61
,
0x62
,
0x6c
,
0x65
,
0x53
,
0x74
,
0x61
,
0x74
,
0x65
,
0x12
,
0x19
,
0x0a
,
0x03
,
0x6b
,
0x65
,
0x79
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x42
,
0x07
,
0xfa
,
0x42
,
0x04
,
0x72
,
0x02
,
0x20
,
0x01
,
0x52
,
0x03
,
0x6b
,
0x65
,
0x79
,
0x12
,
0x3
4
,
0x0a
,
0x05
,
0x73
,
0x74
,
0x61
,
0x74
,
0x65
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x1
4
,
0x2e
,
0x67
,
0x6f
,
0x6f
,
0x67
,
0x6c
,
0x65
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x62
,
0x75
,
0x66
,
0x2e
,
0x
4
1
,
0x6
e
,
0x7
9
,
0x42
,
0x08
,
0xfa
,
0x42
,
0x05
,
0xa2
,
0x01
,
0x02
,
0x08
,
0x01
,
0x52
,
0x05
,
0x73
,
0x74
,
0x61
,
0x74
,
0x65
,
0x32
,
0xf6
,
0x01
,
0x0a
,
0x0c
,
0x53
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x41
,
0x50
,
0x49
,
0x12
,
0x78
,
0x0a
,
0x06
,
0x43
,
0x72
,
0x65
,
0x61
,
0x74
,
0x65
,
0x12
,
0x22
,
0x2e
,
0x63
,
0x6c
,
0x75
,
0x74
,
0x63
,
0x68
,
0x2e
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2e
,
0x76
,
0x31
,
0x2e
,
0x43
,
0x72
,
0x65
,
0x61
,
0x74
,
0x65
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x1a
,
0x23
,
0x2e
,
0x63
,
0x6c
,
0x75
,
0x74
,
0x63
,
0x68
,
0x2e
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2e
,
0x76
,
0x31
,
0x2e
,
0x43
,
0x72
,
0x65
,
0x61
,
0x74
,
0x65
,
0x52
,
0x65
,
0x73
,
0x70
,
0x6f
,
0x6e
,
0x73
,
0x65
,
0x22
,
0x25
,
0x82
,
0xd3
,
0xe4
,
0x93
,
0x02
,
0x19
,
0x22
,
0x14
,
0x2f
,
0x76
,
0x31
,
0x2f
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2f
,
0x63
,
0x72
,
0x65
,
0x61
,
0x74
,
0x65
,
0x3a
,
0x01
,
0x2a
,
0xaa
,
0xe1
,
0x1c
,
0x02
,
0x08
,
0x01
,
0x12
,
0x6c
,
0x0a
,
0x03
,
0x47
,
0x65
,
0x74
,
0x12
,
0x1f
,
0x2e
,
0x63
,
0x6c
,
0x75
,
0x74
,
0x63
,
0x68
,
0x2e
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2e
,
0x76
,
0x31
,
0x2e
,
0x47
,
0x65
,
0x74
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x1a
,
0x20
,
0x2e
,
0x63
,
0x6c
,
0x75
,
0x74
,
0x63
,
0x68
,
0x2e
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2e
,
0x76
,
0x31
,
0x2e
,
0x47
,
0x65
,
0x74
,
0x52
,
0x65
,
0x73
,
0x70
,
0x6f
,
0x6e
,
0x73
,
0x65
,
0x22
,
0x22
,
0x82
,
0xd3
,
0xe4
,
0x93
,
0x02
,
0x16
,
0x22
,
0x11
,
0x2f
,
0x76
,
0x31
,
0x2f
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2f
,
0x67
,
0x65
,
0x74
,
0x3a
,
0x01
,
0x2a
,
0xaa
,
0xe1
,
0x1c
,
0x02
,
0x08
,
0x02
,
0x42
,
0x3d
,
0x5a
,
0x3b
,
0x67
,
0x69
,
0x74
,
0x68
,
0x75
,
0x62
,
0x2e
,
0x63
,
0x6f
,
0x6d
,
0x2f
,
0x6c
,
0x79
,
0x66
,
0x74
,
0x2f
,
0x63
,
0x6c
,
0x75
,
0x74
,
0x63
,
0x68
,
0x2f
,
0x62
,
0x61
,
0x63
,
0x6b
,
0x65
,
0x6e
,
0x64
,
0x2f
,
0x61
,
0x70
,
0x69
,
0x2f
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2f
,
0x76
,
0x31
,
0x3b
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x76
,
0x31
,
0x62
,
0x06
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x33
,
0x79
,
0x12
,
0x3
6
,
0x0a
,
0x05
,
0x73
,
0x74
,
0x61
,
0x74
,
0x65
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x1
6
,
0x2e
,
0x67
,
0x6f
,
0x6f
,
0x67
,
0x6c
,
0x65
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x62
,
0x75
,
0x66
,
0x2e
,
0x
56
,
0x6
1
,
0x6
c
,
0x7
5
,
0x65
,
0x42
,
0x08
,
0xfa
,
0x42
,
0x05
,
0xa2
,
0x01
,
0x02
,
0x08
,
0x01
,
0x52
,
0x05
,
0x73
,
0x74
,
0x61
,
0x74
,
0x65
,
0x32
,
0xf6
,
0x01
,
0x0a
,
0x0c
,
0x53
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x41
,
0x50
,
0x49
,
0x12
,
0x78
,
0x0a
,
0x06
,
0x43
,
0x72
,
0x65
,
0x61
,
0x74
,
0x65
,
0x12
,
0x22
,
0x2e
,
0x63
,
0x6c
,
0x75
,
0x74
,
0x63
,
0x68
,
0x2e
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2e
,
0x76
,
0x31
,
0x2e
,
0x43
,
0x72
,
0x65
,
0x61
,
0x74
,
0x65
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x1a
,
0x23
,
0x2e
,
0x63
,
0x6c
,
0x75
,
0x74
,
0x63
,
0x68
,
0x2e
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2e
,
0x76
,
0x31
,
0x2e
,
0x43
,
0x72
,
0x65
,
0x61
,
0x74
,
0x65
,
0x52
,
0x65
,
0x73
,
0x70
,
0x6f
,
0x6e
,
0x73
,
0x65
,
0x22
,
0x25
,
0x82
,
0xd3
,
0xe4
,
0x93
,
0x02
,
0x19
,
0x22
,
0x14
,
0x2f
,
0x76
,
0x31
,
0x2f
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2f
,
0x63
,
0x72
,
0x65
,
0x61
,
0x74
,
0x65
,
0x3a
,
0x01
,
0x2a
,
0xaa
,
0xe1
,
0x1c
,
0x02
,
0x08
,
0x01
,
0x12
,
0x6c
,
0x0a
,
0x03
,
0x47
,
0x65
,
0x74
,
0x12
,
0x1f
,
0x2e
,
0x63
,
0x6c
,
0x75
,
0x74
,
0x63
,
0x68
,
0x2e
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2e
,
0x76
,
0x31
,
0x2e
,
0x47
,
0x65
,
0x74
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x1a
,
0x20
,
0x2e
,
0x63
,
0x6c
,
0x75
,
0x74
,
0x63
,
0x68
,
0x2e
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2e
,
0x76
,
0x31
,
0x2e
,
0x47
,
0x65
,
0x74
,
0x52
,
0x65
,
0x73
,
0x70
,
0x6f
,
0x6e
,
0x73
,
0x65
,
0x22
,
0x22
,
0x82
,
0xd3
,
0xe4
,
0x93
,
0x02
,
0x16
,
0x22
,
0x11
,
0x2f
,
0x76
,
0x31
,
0x2f
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2f
,
0x67
,
0x65
,
0x74
,
0x3a
,
0x01
,
0x2a
,
0xaa
,
0xe1
,
0x1c
,
0x02
,
0x08
,
0x02
,
0x42
,
0x3d
,
0x5a
,
0x3b
,
0x67
,
0x69
,
0x74
,
0x68
,
0x75
,
0x62
,
0x2e
,
0x63
,
0x6f
,
0x6d
,
0x2f
,
0x6c
,
0x79
,
0x66
,
0x74
,
0x2f
,
0x63
,
0x6c
,
0x75
,
0x74
,
0x63
,
0x68
,
0x2f
,
0x62
,
0x61
,
0x63
,
0x6b
,
0x65
,
0x6e
,
0x64
,
0x2f
,
0x61
,
0x70
,
0x69
,
0x2f
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x2f
,
0x76
,
0x31
,
0x3b
,
0x73
,
0x68
,
0x6f
,
0x72
,
0x74
,
0x6c
,
0x69
,
0x6e
,
0x6b
,
0x76
,
0x31
,
0x62
,
0x06
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x33
,
}
var
(
...
...
@@ -367,12 +366,12 @@ var file_shortlink_v1_shortlink_proto_goTypes = []interface{}{
(
*
GetRequest
)(
nil
),
// 2: clutch.shortlink.v1.GetRequest
(
*
GetResponse
)(
nil
),
// 3: clutch.shortlink.v1.GetResponse
(
*
ShareableState
)(
nil
),
// 4: clutch.shortlink.v1.ShareableState
(
*
anypb
.
Any
)(
nil
),
// 5: google.protobuf.
Any
(
*
structpb
.
Value
)(
nil
),
// 5: google.protobuf.
Value
}
var
file_shortlink_v1_shortlink_proto_depIdxs
=
[]
int32
{
4
,
// 0: clutch.shortlink.v1.CreateRequest.state:type_name -> clutch.shortlink.v1.ShareableState
4
,
// 1: clutch.shortlink.v1.GetResponse.state:type_name -> clutch.shortlink.v1.ShareableState
5
,
// 2: clutch.shortlink.v1.ShareableState.state:type_name -> google.protobuf.
Any
5
,
// 2: clutch.shortlink.v1.ShareableState.state:type_name -> google.protobuf.
Value
0
,
// 3: clutch.shortlink.v1.ShortlinkAPI.Create:input_type -> clutch.shortlink.v1.CreateRequest
2
,
// 4: clutch.shortlink.v1.ShortlinkAPI.Get:input_type -> clutch.shortlink.v1.GetRequest
1
,
// 5: clutch.shortlink.v1.ShortlinkAPI.Create:output_type -> clutch.shortlink.v1.CreateResponse
...
...
This diff is collapsed.
Click to expand it.
backend/api/shortlink/v1/shortlink.pb.validate.go
+
2
-
2
View file @
41c8584e
...
...
@@ -313,9 +313,9 @@ func (m *GetRequest) validate(all bool) error {
var
errors
[]
error
if
len
(
m
.
Get
Shortlink
Hash
())
<
1
{
if
len
(
m
.
GetHash
())
<
1
{
err
:=
GetRequestValidationError
{
field
:
"
Shortlink
Hash"
,
field
:
"Hash"
,
reason
:
"value length must be at least 1 bytes"
,
}
if
!
all
{
...
...
This diff is collapsed.
Click to expand it.
backend/cmd/migrate/migrations/000014_create_shortlink_table.down.sql
0 → 100644
+
1
-
0
View file @
41c8584e
DROP
TABLE
IF
EXISTS
shortlink
;
This diff is collapsed.
Click to expand it.
backend/cmd/migrate/migrations/000014_create_shortlink_table.up.sql
0 → 100644
+
10
-
0
View file @
41c8584e
CREATE
TABLE
shortlink
(
-- hash is the unique identifer for the shortlink
slhash
text
PRIMARY
KEY
,
-- path is the page path to rediect to
page_path
text
,
-- state is shortlink state
state
JSONB
);
CREATE
INDEX
IF
NOT
EXISTS
state_json
ON
shortlink
USING
GIN
(
state
jsonb_path_ops
);
This diff is collapsed.
Click to expand it.
frontend/api/src/index.d.ts
+
6
-
6
View file @
41c8584e
...
...
@@ -22200,8 +22200,8 @@ export namespace clutch {
/** Properties of a GetRequest. */
interface IGetRequest {
/** GetRequest
shortlinkH
ash */
shortlinkH
ash?: (string|null);
/** GetRequest
h
ash */
h
ash?: (string|null);
}
/** Represents a GetRequest. */
...
...
@@ -22213,8 +22213,8 @@ export namespace clutch {
*/
constructor(properties?: clutch.shortlink.v1.IGetRequest);
/** GetRequest
shortlinkH
ash. */
public
shortlinkH
ash: string;
/** GetRequest
h
ash. */
public
h
ash: string;
/**
* Verifies a GetRequest message.
...
...
@@ -22306,7 +22306,7 @@ export namespace clutch {
key?: (string|null);
/** ShareableState state */
state?: (google.protobuf.I
Any
|null);
state?: (google.protobuf.I
Value
|null);
}
/** Represents a ShareableState. */
...
...
@@ -22322,7 +22322,7 @@ export namespace clutch {
public key: string;
/** ShareableState state. */
public state?: (google.protobuf.I
Any
|null);
public state?: (google.protobuf.I
Value
|null);
/**
* Verifies a ShareableState message.
This diff is collapsed.
Click to expand it.
frontend/api/src/index.js
+
17
-
17
View file @
41c8584e
...
...
@@ -52987,7 +52987,7 @@ export const clutch = $root.clutch = (() => {
* Properties of a GetRequest.
* @memberof clutch.shortlink.v1
* @interface IGetRequest
* @property {string|null} [
shortlinkH
ash] GetRequest
shortlinkH
ash
* @property {string|null} [
h
ash] GetRequest
h
ash
*/
/**
...
...
@@ -53006,12 +53006,12 @@ export const clutch = $root.clutch = (() => {
}
/**
* GetRequest
shortlinkH
ash.
* @member {string}
shortlinkH
ash
* GetRequest
h
ash.
* @member {string}
h
ash
* @memberof clutch.shortlink.v1.GetRequest
* @instance
*/
GetRequest.prototype.
shortlinkH
ash = "";
GetRequest.prototype.
h
ash = "";
/**
* Verifies a GetRequest message.
...
...
@@ -53024,9 +53024,9 @@ export const clutch = $root.clutch = (() => {
GetRequest.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.
shortlinkH
ash != null && message.hasOwnProperty("
shortlinkH
ash"))
if (!$util.isString(message.
shortlinkH
ash))
return "
shortlinkH
ash: string expected";
if (message.
h
ash != null && message.hasOwnProperty("
h
ash"))
if (!$util.isString(message.
h
ash))
return "
h
ash: string expected";
return null;
};
...
...
@@ -53042,8 +53042,8 @@ export const clutch = $root.clutch = (() => {
if (object instanceof $root.clutch.shortlink.v1.GetRequest)
return object;
let message = new $root.clutch.shortlink.v1.GetRequest();
if (object.
shortlinkH
ash != null)
message.
shortlinkH
ash = String(object.
shortlinkH
ash);
if (object.
h
ash != null)
message.
h
ash = String(object.
h
ash);
return message;
};
...
...
@@ -53061,9 +53061,9 @@ export const clutch = $root.clutch = (() => {
options = {};
let object = {};
if (options.defaults)
object.
shortlinkH
ash = "";
if (message.
shortlinkH
ash != null && message.hasOwnProperty("
shortlinkH
ash"))
object.
shortlinkH
ash = message.
shortlinkH
ash;
object.
h
ash = "";
if (message.
h
ash != null && message.hasOwnProperty("
h
ash"))
object.
h
ash = message.
h
ash;
return object;
};
...
...
@@ -53224,7 +53224,7 @@ export const clutch = $root.clutch = (() => {
* @memberof clutch.shortlink.v1
* @interface IShareableState
* @property {string|null} [key] ShareableState key
* @property {google.protobuf.I
Any
|null} [state] ShareableState state
* @property {google.protobuf.I
Value
|null} [state] ShareableState state
*/
/**
...
...
@@ -53252,7 +53252,7 @@ export const clutch = $root.clutch = (() => {
/**
* ShareableState state.
* @member {google.protobuf.I
Any
|null|undefined} state
* @member {google.protobuf.I
Value
|null|undefined} state
* @memberof clutch.shortlink.v1.ShareableState
* @instance
*/
...
...
@@ -53273,7 +53273,7 @@ export const clutch = $root.clutch = (() => {
if (!$util.isString(message.key))
return "key: string expected";
if (message.state != null && message.hasOwnProperty("state")) {
let error = $root.google.protobuf.
Any
.verify(message.state);
let error = $root.google.protobuf.
Value
.verify(message.state);
if (error)
return "state." + error;
}
...
...
@@ -53297,7 +53297,7 @@ export const clutch = $root.clutch = (() => {
if (object.state != null) {
if (typeof object.state !== "object")
throw TypeError(".clutch.shortlink.v1.ShareableState.state: object expected");
message.state = $root.google.protobuf.
Any
.fromObject(object.state);
message.state = $root.google.protobuf.
Value
.fromObject(object.state);
}
return message;
};
...
...
@@ -53322,7 +53322,7 @@ export const clutch = $root.clutch = (() => {
if (message.key != null && message.hasOwnProperty("key"))
object.key = message.key;
if (message.state != null && message.hasOwnProperty("state"))
object.state = $root.google.protobuf.
Any
.toObject(message.state, options);
object.state = $root.google.protobuf.
Value
.toObject(message.state, options);
return object;
};
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help