diff --git a/src/managers/dateManager.ts b/src/managers/dateManager.ts index 9b7d6f7..919f33c 100644 --- a/src/managers/dateManager.ts +++ b/src/managers/dateManager.ts @@ -21,25 +21,25 @@ class DateManager { // When a GM sets the time, update the current date and update the world file public async setTime(time: string): Promise { try { - let newDate: Date; + let newDate: Date // Check if it's just a time (HH:mm or HH:mm:ss format) if (/^\d{1,2}:\d{2}(:\d{2})?$/.test(time)) { - const [hours, minutes] = time.split(':').map(Number); - newDate = new Date(this.currentDate); // Clone current date - newDate.setHours(hours, minutes); + const [hours, minutes] = time.split(':').map(Number) + newDate = new Date(this.currentDate) // Clone current date + newDate.setHours(hours, minutes) } else { // Treat as full datetime string - newDate = new Date(time); - if (isNaN(newDate.getTime())) return; + newDate = new Date(time) + if (isNaN(newDate.getTime())) return } - this.currentDate = newDate; - this.emitDate(); - await this.saveDate(); + this.currentDate = newDate + this.emitDate() + await this.saveDate() } catch (error) { - appLogger.error(`Failed to set time: ${error instanceof Error ? error.message : String(error)}`); - throw error; + appLogger.error(`Failed to set time: ${error instanceof Error ? error.message : String(error)}`) + throw error } } diff --git a/src/managers/weatherManager.ts b/src/managers/weatherManager.ts index f4bfcac..21e6c8d 100644 --- a/src/managers/weatherManager.ts +++ b/src/managers/weatherManager.ts @@ -123,4 +123,4 @@ class WeatherManager { } } -export default new WeatherManager() \ No newline at end of file +export default new WeatherManager() diff --git a/src/server.ts b/src/server.ts index 6195f36..a8e516a 100644 --- a/src/server.ts +++ b/src/server.ts @@ -28,9 +28,11 @@ export class Server { */ constructor() { this.app = express() - this.app.use(cors({ - origin: config.CLIENT_URL - })) + this.app.use( + cors({ + origin: config.CLIENT_URL + }) + ) this.app.use(express.json()) this.app.use(express.urlencoded({ extended: true })) this.http = httpServer(this.app) diff --git a/src/services/passwordResetTokenService.ts b/src/services/passwordResetTokenService.ts index cc85d36..edba78c 100644 --- a/src/services/passwordResetTokenService.ts +++ b/src/services/passwordResetTokenService.ts @@ -8,7 +8,6 @@ class PasswordResetTokenService { * @param token */ public async delete(token: string): Promise { - try { const tokenData = await passwordResetTokenRepository.getByToken(token) if (!tokenData) { diff --git a/src/socketEvents/chat/gameMaster/teleportCommand.ts b/src/socketEvents/chat/gameMaster/teleportCommand.ts index e9bcef7..3e38be0 100644 --- a/src/socketEvents/chat/gameMaster/teleportCommand.ts +++ b/src/socketEvents/chat/gameMaster/teleportCommand.ts @@ -23,7 +23,7 @@ export default class TeleportCommandEvent { private async handleTeleportCommand(data: TypePayload, callback: (response: boolean) => void): Promise { try { // Check if character exists - const character = await CharacterRepository.getByUserAndId(this.socket.user?.id as number, this.socket.characterId as number) as ExtendedCharacter + const character = (await CharacterRepository.getByUserAndId(this.socket.user?.id as number, this.socket.characterId as number)) as ExtendedCharacter if (!character) { gameLogger.error('chat:alert_command error', 'Character not found') callback(false) diff --git a/src/utilities/zodTypes.ts b/src/utilities/zodTypes.ts index 9620a60..7252173 100644 --- a/src/utilities/zodTypes.ts +++ b/src/utilities/zodTypes.ts @@ -42,10 +42,7 @@ export const resetPasswordSchema = z.object({ }) export const newPasswordSchema = z.object({ - urlToken: z - .string() - .min(10, { message: 'Invalid request' }) - .max(255, { message: 'Invalid request' }), + urlToken: z.string().min(10, { message: 'Invalid request' }).max(255, { message: 'Invalid request' }), password: z .string() .min(8, {