You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,12 +25,12 @@ This command is a record that acts as a data transfer object (DTO) for the neces
25
25
### GenerateShortCodeCommandHandler
26
26
This class handles the logic for generating a shortened link. It involves several steps:
27
27
28
-
Validation: It first ensures that the provided URL and other parameters meet specific criteria through the GenerateShortCodeValidator.
29
-
Short Code Generation: If no custom back half is provided, it generates a unique short code for the URL using the IShortCodeGenerator service.
30
-
Link Creation: It creates a new Link entity with the provided details and the generated or provided short code.
31
-
Database Insertion: The new link entity is added to the database.
32
-
Caching: The newly created link is cached using the ICacheProvider service, with the expiration date set accordingly.
33
-
Response: It returns a Result<LinksDto> object, which includes details of the created link, such as the short code, original URL, and expiration date.
28
+
-Validation: It first ensures that the provided URL and other parameters meet specific criteria through the GenerateShortCodeValidator.
29
+
-Short Code Generation: If no custom back half is provided, it generates a unique short code for the URL using the IShortCodeGenerator service.
30
+
-Link Creation: It creates a new Link entity with the provided details and the generated or provided short code.
31
+
-Database Insertion: The new link entity is added to the database.
32
+
-Caching: The newly created link is cached using the ICacheProvider service, with the expiration date set accordingly.
33
+
-Response: It returns a Result<LinksDto> object, which includes details of the created link, such as the short code, original URL, and expiration date.
34
34
Execution Flow in the Controller
35
35
The LinkController class exposes an endpoint that handles the "Shorten" use case. The Shorten method in the controller:
0 commit comments