Skip to content

Commit a1f5bd7

Browse files
committed
add qrcode type
1 parent bc7783f commit a1f5bd7

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

src/services/shortn/utils/utils_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package utils
22

33
import (
44
"fmt"
5-
"math/rand"
65
"testing"
76
)
87

@@ -66,7 +65,6 @@ func TestIsUrl(t *testing.T) {
6665

6766
func TestGetRandomIntInRange(t *testing.T) {
6867
min, max := 10, 20
69-
rand.Seed(1)
7068
for i := 0; i < 100; i++ {
7169
got := GetRandomIntInRange(min, max)
7270
if got < min || got > max {

src/shared/model/model.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
package model
22

3-
import "time"
3+
import (
4+
"time"
5+
6+
"go.mongodb.org/mongo-driver/bson/primitive"
7+
)
48

59
type ShortURL struct {
10+
Name string `bson:"name"`
611
Short string `bson:"short"`
712
URL string `bson:"url"`
813
Count int `bson:"count"`
@@ -11,6 +16,14 @@ type ShortURL struct {
1116
UpdatedAt time.Time `bson:"updatedAt"`
1217
}
1318

19+
type QrCode struct {
20+
ID primitive.ObjectID `bson:"_id,omitempty"` // MongoDB primary key
21+
Short string `bson:"short"` // Reference to short code or object
22+
Owner string `bson:"owner"`
23+
CreatedAt time.Time `bson:"createdAt"`
24+
UpdatedAt time.Time `bson:"updatedAt"`
25+
}
26+
1427
type ShortClick struct {
1528
Short string
1629
Timestamp time.Time

0 commit comments

Comments
 (0)