-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (SRS-06) : implement API click shorteners
- Loading branch information
Showing
9 changed files
with
281 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package model | ||
|
||
const ( | ||
KeyShortURL = "short_url:%s" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,33 @@ | ||
package model | ||
|
||
import "go.mongodb.org/mongo-driver/bson/primitive" | ||
import ( | ||
"time" | ||
|
||
"go.mongodb.org/mongo-driver/bson/primitive" | ||
) | ||
|
||
type ( | ||
Short struct { | ||
ID primitive.ObjectID `bson:"_id"` | ||
UserID string `bson:"user_id"` | ||
FullURL string `bson:"full_url"` | ||
ShortURL string `bson:"short_url"` | ||
Visited int64 `bson:"visited"` | ||
ID primitive.ObjectID `bson:"_id"` | ||
UserID string `bson:"user_id"` | ||
FullURL string `bson:"full_url"` | ||
ShortURL string `bson:"short_url"` | ||
Visited int64 `bson:"visited"` | ||
CreatedAt time.Time `bson:"created_at"` | ||
UpdatedAt *time.Time `bson:"updated_at"` | ||
} | ||
|
||
CreateShortRequest struct { | ||
UserID string `json:"user_id"` | ||
FullURL string `json:"full_url"` | ||
ShortURL string `json:"short_url"` | ||
} | ||
|
||
ClickShortResponse struct { | ||
FullURL string `json:"full_url"` | ||
} | ||
|
||
UpdateVisitorRequest struct { | ||
ShortURL string `json:"short_url"` | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.