Add composite primary key to player_capes and update messages
Added a composite primary key (playerUuid, assetHash) to the player_capes table for better data integrity. Updated userRepository.js to use English messages for cape assignment and removal operations.
This commit is contained in:
@@ -229,6 +229,7 @@ async function setupDatabase() {
|
||||
assetHash VARCHAR(64) NOT NULL,
|
||||
isSelected TINYINT(1) DEFAULT 0,
|
||||
createdAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (playerUuid, assetHash),
|
||||
FOREIGN KEY (playerUuid) REFERENCES players(uuid) ON DELETE CASCADE,
|
||||
FOREIGN KEY (assetHash) REFERENCES textures(hash) ON DELETE CASCADE
|
||||
)
|
||||
|
||||
@@ -63,6 +63,9 @@ function getUrlParam(url, param) {
|
||||
}
|
||||
|
||||
function handleDBError(error, errorMessage = "Internal Server Error", code = 500) {
|
||||
if (error instanceof DefaultError) {
|
||||
throw error
|
||||
}
|
||||
logger.log(errorMessage.bold + " : " + error.toString(), ["MariaDB", "yellow"])
|
||||
throw new DefaultError(code, errorMessage, "InternalServerError")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user