Skip to content

Commit

Permalink
fix: deploy config error
Browse files Browse the repository at this point in the history
  • Loading branch information
astappiev committed Aug 9, 2024
1 parent 89237d4 commit dd65245
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package de.l3s.interweb.server.features.user;

import java.util.Optional;

import jakarta.inject.Inject;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Email;
Expand Down Expand Up @@ -56,7 +58,7 @@ public class UsersResource {
""";

@ConfigProperty(name = "interweb.admin.email")
String adminEmail;
Optional<String> adminEmail;

@ConfigProperty(name = "interweb.auto-approve.pattern")
String autoApprovePattern;
Expand Down Expand Up @@ -91,8 +93,8 @@ public Uni<String> login(@NotEmpty @QueryParam("email") String email, @Context U

private Uni<User> findOrCreateUser(String email) {
return User.findByEmail(email).onItem().ifNull().switchTo(() -> createUser(email).call(user -> {
if (!user.approved) {
return mailer.send(Mail.withText(adminEmail, NEW_USER_EMAIL_SUBJECT, NEW_USER_EMAIL_BODY.formatted(user.email)));
if (!user.approved && adminEmail.isPresent()) {
return mailer.send(Mail.withText(adminEmail.get(), NEW_USER_EMAIL_SUBJECT, NEW_USER_EMAIL_BODY.formatted(user.email)));
}

return Uni.createFrom().voidItem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ CREATE TABLE IF NOT EXISTS `chat`

CREATE TABLE IF NOT EXISTS `chat_message`
(
`chat_id` UUID NOT NULL,
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`chat_id` UUID NOT NULL,
`role` TINYINT UNSIGNED NOT NULL,
`content` TEXT NOT NULL,
`created` DATETIME DEFAULT NOW(),
Expand All @@ -35,10 +35,10 @@ CREATE TABLE IF NOT EXISTS `user_token`
(
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`user_id` BIGINT UNSIGNED NOT NULL,
`apikey` VARCHAR(64) NOT NULL,
`name` VARCHAR(255) NOT NULL,
`url` VARCHAR(512) DEFAULT NULL,
`description` VARCHAR(1024) DEFAULT NULL,
`apikey` VARCHAR(64) NOT NULL,
UNIQUE KEY `index_user_token_apikey` (`apikey`),
CONSTRAINT `fk_user_token_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
);

0 comments on commit dd65245

Please sign in to comment.