MCPcopy Create free account
hub / github.com/codemistic/Web-Development / ShortUrl

Class ShortUrl

Url Shortener/core/models.py:5–19  ·  view source on GitHub ↗

Class that represents a shorturl of our application The following attributes of a shorturl are stored in this table: * original_url - url who user give us * short_id - short_id that serves to redirect to the original_url * created_at - creation date

Source from the content-addressed store, hash-verified

3
4
5class ShortUrl(db.Model):
6 """
7 Class that represents a shorturl of our application
8 The following attributes of a shorturl are stored in this table:
9 * original_url - url who user give us
10 * short_id - short_id that serves to redirect to the original_url
11 * created_at - creation date
12 """
13 id = db.Column(db.Integer, primary_key=True)
14 original_url = db.Column(db.String(500), nullable=False)
15 short_id = db.Column(db.String(20), nullable=False, unique=True)
16 created_at = db.Column(db.DateTime(), default=datetime.now(), nullable=False)
17
18 def __repr__(self):
19 return f'ShortUrl: {self.short_id}'

Callers 2

indexFunction · 0.90
new_shorturlFunction · 0.90

Calls

no outgoing calls

Tested by 1

new_shorturlFunction · 0.72