Repository: novuhq/novu
File: apps/worker/src/app/workflow/usecases/process-unsnooze-job/process-unsnooze-job.usecase.ts (TypeScript)

Code before:
      const snoozedNotification = await this.messageRepository.findOne({
        _notificationId: job._notificationId,
        _environmentId: job._environmentId,
        channel: ChannelTypeEnum.IN_APP,
        snoozedUntil: { $exists: true, $ne: null },
      });

      if (!snoozedNotification) {
        throw new NotFoundException(
          `Could not find a snoozed notification with id '${job._notificationId}'. ` +
            'The notification may not exist or may not be in a snoozed state.'
        );
      }

      const now = new Date();

      await this.messageRepository.update(
        { _environmentId: job._environmentId, _notificationId: job._notificationId },
        [
          {
            $set: {
              snoozedUntil: null,
              createdAt: now,
              read: false,
              lastReadDate: null,
              deliveredAt: {
                $cond: {
                  if: { $isArray: '$deliveredAt' },
                  then: { $concatArrays: ['$deliveredAt', [now]] },
                  else: [snoozedNotification.createdAt, now],
                },
              },
            },
          },
        ],
        {
          timestamps: false,
          strict: false,
        }
      );

      await Promise.all([
        this.webSocketsQueueService.add({
          name: 'sendMessage',
          data: {
            event: WebSocketEventEnum.RECEIVED,
            userId: job._subscriberId,
            _environmentId: job._environmentId,
            payload: {
              messageId: snoozedNotification._id,
            },

Review comment (suggestion):
this comment is saying that we should set `archived: false` and probably `archivedAt: null`
```
unsnoozed -> { seen: true, read: false, archived: false, snoozedUntil: null }
```

Code after:
      const snoozedNotification = await this.messageRepository.findOne({
        _notificationId: job._notificationId,
        _environmentId: job._environmentId,
        channel: ChannelTypeEnum.IN_APP,
        snoozedUntil: { $exists: true, $ne: null },
      });

      if (!snoozedNotification) {
        throw new NotFoundException(
          `Could not find a snoozed notification with id '${job._notificationId}'. ` +
            'The notification may not exist or may not be in a snoozed state.'
        );
      }

      const nowDate = new Date();
      const createdAtDate = new Date(snoozedNotification.createdAt);

      await this.messageRepository.update(
        { _environmentId: job._environmentId, _notificationId: job._notificationId },
        [
          {
            $set: {
              snoozedUntil: null,
              createdAt: nowDate,
              read: false,
              lastReadDate: null,
              deliveredAt: {
                $cond: {
                  if: { $isArray: '$deliveredAt' },
                  then: { $concatArrays: ['$deliveredAt', [nowDate]] },
                  else: [createdAtDate, nowDate],
                },
              },
            },
          },
        ],
        {
          timestamps: false,
          strict: false,
        }
      );

      await Promise.all([
        this.webSocketsQueueService.add({
          name: 'sendMessage',
          data: {
            event: WebSocketEventEnum.RECEIVED,
            userId: job._subscriberId,
            _environmentId: job._environmentId,
            payload: {
              messageId: snoozedNotification._id,