Skip to content

Commit

Permalink
Merge pull request #6 from APSfurizon/checkstyle-management
Browse files Browse the repository at this point in the history
Checkstyle management
  • Loading branch information
stranck authored Oct 16, 2024
2 parents dfecd15 + 7f566f6 commit b3e0f3c
Show file tree
Hide file tree
Showing 50 changed files with 1,886 additions and 1,459 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BACKEND_SERVER_PORT=8080
BACKEND_DATASOURCE_URL=jdbc:postgresql://localhost:5433/postgres
BACKEND_DATASOURCE_USERNAME=postgres
BACKEND_DATASOURCE_PASSWORD=postgres
9 changes: 1 addition & 8 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
-->

<module name="Checker">

<property name="charset" value="UTF-8"/>

<property name="severity" value="${org.checkstyle.google.severity}" default="error"/>
Expand Down Expand Up @@ -83,15 +82,9 @@
value="ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, ENUM_DEF,
INTERFACE_DEF, LAMBDA, LITERAL_CATCH,
LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF,
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF,
LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF,
OBJBLOCK, STATIC_INIT, RECORD_DEF, COMPACT_CTOR_DEF"/>
</module>
<module name="LeftCurly">
<property name="id" value="LeftCurlyNl"/>
<property name="option" value="nl"/>
<property name="tokens"
value="LITERAL_CASE, LITERAL_DEFAULT"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlySame"/>
<property name="tokens"
Expand Down
21 changes: 0 additions & 21 deletions config.properties

This file was deleted.

Empty file modified mvnw
100644 → 100755
Empty file.
10 changes: 3 additions & 7 deletions src/main/java/net/furizon/backend/BackendApplication.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package net.furizon.backend;

import net.furizon.backend.service.pretix.PretixService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class BackendApplication {

public static void main(String[] args) {
SpringApplication.run(BackendApplication.class, args);
}

public static void main(String[] args) {
SpringApplication.run(BackendApplication.class, args);
}
}
28 changes: 0 additions & 28 deletions src/main/java/net/furizon/backend/CmdRunner.java

This file was deleted.

117 changes: 68 additions & 49 deletions src/main/java/net/furizon/backend/db/entities/pretix/Event.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
package net.furizon.backend.db.entities.pretix;

import jakarta.persistence.*;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
import jakarta.persistence.Transient;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
Expand All @@ -13,68 +21,79 @@
import java.util.Map;
import java.util.Set;

// TODO -> Replace on JOOQ

@Entity
@Table(name = "events")
@Getter
@Setter
public final class Event {
@Id
@Column(name = "event_slug")
@Setter(AccessLevel.NONE)
private String slug;

@Id
@Column(name = "event_slug")
@Setter(AccessLevel.NONE)
private String slug;

@Column(name = "event_public_url")
private String publicUrl;
@Column(name = "event_public_url")
private String publicUrl;

@Transient
@Setter(AccessLevel.NONE)
@Getter(AccessLevel.NONE)
private Map<String, String> eventNames;
private String eventNamesRaw;//map lang -> name
@Transient
@Setter(AccessLevel.NONE)
@Getter(AccessLevel.NONE)
private Map<String, String> eventNames;
private String eventNamesRaw; //map lang -> name

@Column(name = "event_date_from")
@Temporal(TemporalType.TIMESTAMP)
private Date dateFrom;
@Column(name = "event_date_end")
@Temporal(TemporalType.TIMESTAMP)
private Date dateEnd;
@Column(name = "event_date_from")
@Temporal(TemporalType.TIMESTAMP)
private Date dateFrom;
@Column(name = "event_date_end")
@Temporal(TemporalType.TIMESTAMP)
private Date dateEnd;

@Column(name = "event_is_current")
private boolean isCurrentEvent;
@Column(name = "event_is_current")
private boolean isCurrentEvent;

@OneToMany(mappedBy = "orderEvent", fetch = FetchType.LAZY)
private Set<Order> orders;
@OneToMany(mappedBy = "orderEvent", fetch = FetchType.LAZY)
private Set<Order> orders;

public Event() {}
public Event() {
}

public Event(String organizer, String eventCode, String publicUrl, Map<String, String> eventName, String dateFrom, String dateEnd){
slug = getSlug(organizer, eventCode);
this.publicUrl = TextUtil.leadingSlash(publicUrl) + eventCode;
this.eventNames = eventName;
this.eventNamesRaw = new JSONObject(eventName).toString();
this.dateFrom = Date.from(ZonedDateTime.parse(dateFrom).toInstant());
this.dateEnd = Date.from(ZonedDateTime.parse(dateEnd).toInstant());
}
public Event(
String organizer,
String eventCode,
String publicUrl,
Map<String, String> eventName,
String dateFrom,
String dateEnd
) {
slug = getSlug(organizer, eventCode);
this.publicUrl = TextUtil.leadingSlash(publicUrl) + eventCode;
this.eventNames = eventName;
this.eventNamesRaw = new JSONObject(eventName).toString();
this.dateFrom = Date.from(ZonedDateTime.parse(dateFrom).toInstant());
this.dateEnd = Date.from(ZonedDateTime.parse(dateEnd).toInstant());
}

public String getEventName(String lang){
if(eventNames == null){
eventNames = new HashMap<>();
JSONObject obj = new JSONObject(eventNamesRaw);
for(String s : obj.keySet()) eventNames.put(s, obj.getString(s));
}
return eventNames.get(lang);
}
public String getEventName(String lang) {
if (eventNames == null) {
eventNames = new HashMap<>();
JSONObject obj = new JSONObject(eventNamesRaw);
for (String s : obj.keySet()) {
eventNames.put(s, obj.getString(s));
}
}
return eventNames.get(lang);
}

public void setSlug (String organizer, String event) {
this.slug = getSlug(organizer, event);
}
public void setSlug(String organizer, String event) {
this.slug = getSlug(organizer, event);
}

public void setSlug (String slug){
this.slug = slug;
}
public void setSlug(String slug) {
this.slug = slug;
}

public static String getSlug(String organizer, String event){
return organizer + "/" + event;
}
public static String getSlug(String organizer, String event) {
return organizer + "/" + event;
}
}
Loading

0 comments on commit b3e0f3c

Please sign in to comment.