Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.decepticons.linkshortener.api.dto;

import java.time.Instant;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;


/**
* Data Transfer Object (DTO) for updating the expiration date of a shortened link.
* This object is used to encapsulate the data required to update the expiration
* date of an existing short link in the system.
*/
@Getter
@Setter
@AllArgsConstructor
public class UpdateLinkExpirationRequestDto {

@NonNull
private Instant newExpirationDate;


}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.decepticons.linkshortener.api.exceptions;
package org.decepticons.linkshortener.api.exception;

/**
* Base class for custom exceptions in the application.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package org.decepticons.linkshortener.api.exceptions;
package org.decepticons.linkshortener.api.exception;

import org.decepticons.linkshortener.api.exception.BaseException;

/**
* Thrown when a JWT token is expired.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.decepticons.linkshortener.api.exception;

import java.time.Instant;
import lombok.Getter;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
* Exception thrown when an invalid expiration date is provided for a link.
* This exception indicates that the provided expiration date does not meet
* the required criteria (e.g., it may be in the past or too far in the future).
*/
@ResponseStatus(HttpStatus.BAD_REQUEST)
@Getter
public class InvalidExpirationDateException extends RuntimeException {
private final Instant invalidDate;

/**
* Constructs a new InvalidExpirationDateException with the specified detail message
* and the invalid expiration date.
*
* @param message the detail message.
* @param invalidDate the invalid expiration date that caused this exception.
*/
public InvalidExpirationDateException(String message, Instant invalidDate) {
super(message);
this.invalidDate = invalidDate;
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package org.decepticons.linkshortener.api.exceptions;
package org.decepticons.linkshortener.api.exception;

import org.decepticons.linkshortener.api.exception.BaseException;

/**
* Thrown when a password does not meet complexity requirements.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package org.decepticons.linkshortener.api.exceptions;
package org.decepticons.linkshortener.api.exception;

import org.decepticons.linkshortener.api.exception.BaseException;

/**
* Thrown when a JWT token is missing, malformed, or invalid.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package org.decepticons.linkshortener.api.exceptions;
package org.decepticons.linkshortener.api.exception;

import org.decepticons.linkshortener.api.exception.BaseException;

/**
* Thrown when trying to register a user with a username that already exists.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package org.decepticons.linkshortener.api.exceptions;
package org.decepticons.linkshortener.api.exception;

import org.decepticons.linkshortener.api.exception.BaseException;

/**
* Thrown when a user is not found in the system.
Expand Down
Loading