Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing rabbit and security #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 2 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
implementation 'org.jsoup:jsoup:1.13.1'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-starter-amqp'
implementation 'com.github.pengrad:java-telegram-bot-api:5.4.0'
implementation 'org.jsoup:jsoup:1.14.3'
implementation 'com.github.pengrad:java-telegram-bot-api:6.0.1'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package dev.publio.telegrampackagenotifier;

import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.scheduling.annotation.EnableScheduling;

@EnableCaching
@EnableRabbit
@EnableScheduling
@SpringBootApplication
public class Application {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package dev.publio.telegrampackagenotifier.exceptions;

public class UsernameNotFoundException extends
RuntimeException {

public UsernameNotFoundException() {
}

public UsernameNotFoundException(String message) {
super(message);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import dev.publio.telegrampackagenotifier.exceptions.NoUpdatesFoundException;
import dev.publio.telegrampackagenotifier.models.Package;
import dev.publio.telegrampackagenotifier.models.ShippingUpdate;
import dev.publio.telegrampackagenotifier.service.QueueService;
import dev.publio.telegrampackagenotifier.service.TrackingService;
import dev.publio.telegrampackagenotifier.telegram.UserNotifierTelegram;
import java.time.LocalDateTime;
import java.util.Comparator;
import java.util.Optional;
Expand All @@ -21,16 +21,16 @@
public class ShippingTrackerUpdate {

private final TrackingService trackingService;
private final QueueService queueService;
private final UserNotifierTelegram queueService;

public ShippingTrackerUpdate(
TrackingService trackingService,
QueueService queueService) {
UserNotifierTelegram queueService) {
this.trackingService = trackingService;
this.queueService = queueService;
}

@Scheduled(fixedDelay = 5, timeUnit = java.util.concurrent.TimeUnit.MINUTES)
@Scheduled(fixedDelay = 1, timeUnit = java.util.concurrent.TimeUnit.MINUTES)
public void updateTrackers() {
log.info("Updating trackers");
Set<Package> allActivePackages = trackingService.getAllActivePackages();
Expand Down Expand Up @@ -61,7 +61,7 @@ public void updateTrackers() {
} else {
log.info("New updates for package {}", activePackage.getTrackId());
activePackage.getUpdates().add(lastUpdate.toShippingUpdate());
queueService.sendToTelegramNotification(new QueueTelegramMessage(
queueService.notify(new QueueTelegramMessage(
activePackage.getTrackId(), activePackage.getUser(), lastUpdate));
}
activePackage.setLastUpdate(LocalDateTime.now());
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package dev.publio.telegrampackagenotifier.service;

import dev.publio.telegrampackagenotifier.exceptions.UsernameNotFoundException;
import dev.publio.telegrampackagenotifier.models.User;
import dev.publio.telegrampackagenotifier.repository.UserRepository;
import lombok.extern.log4j.Log4j2;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

@Log4j2
Expand Down
14 changes: 0 additions & 14 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,9 @@ transporter:
madeira_madeira: https://eagle.madeiramadeira.com.br/tracking/mm/eventos?order=%s&collect=%s

spring:
rabbitmq:
addresses: ${RABBIT_URL}
data:
mongodb:
uri: ${MONGO_URL}
security:
oauth2:
resourceserver:
jwt:
issuer-uri: ${ISSUER_URL}

auth0:
audience: ${AUDIENCE_URL}

queue:
name: telegram-notification

telegram:
bot:
token: ${TELEGRAM_BOT_TOKEN}
Expand Down