preparing notes module (backend)
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -19,9 +19,12 @@ public class Constants {
|
||||
public static final String COMPANY = "company";
|
||||
public static final String COMPANY_ID = "company_id";
|
||||
public static final String CONTENT_TYPE = "Content-Type";
|
||||
public static final String CUSTOMER_NUMBER_PREFIX = "customer_number_prefix";
|
||||
|
||||
public static final String DATA = "data";
|
||||
public static final String DATE = "date";
|
||||
public static final String DECIMALS = "decimals";
|
||||
public static final String DECIMAL_SEPARATOR = "decimal_separator";
|
||||
public static final String DEFAULT_LANGUAGE = "en";
|
||||
public static final String DEFAULT_THEME = "winter";
|
||||
public static final String DELETED = "deleted";
|
||||
@@ -33,7 +36,7 @@ public class Constants {
|
||||
|
||||
public static final String EMAIL = "email";
|
||||
public static final String END_TIME = "end_time";
|
||||
|
||||
public static final String ENTITY_ID = "entity_id";
|
||||
public static final String ERROR_FAILED_CREATE_TABLE = "Failed to create \"{0}\" table!";
|
||||
public static final String ERROR_INVALID_FIELD = "Expected {0} to be {1}!";
|
||||
public static final String ERROR_MISSING_CONFIG = "Config is missing value for {0}!";
|
||||
@@ -41,19 +44,30 @@ public class Constants {
|
||||
public static final String ERROR_READ_TABLE = "Failed to read {0} from {1} table";
|
||||
public static final String EST_TIME = "est_time";
|
||||
public static final String ESTIMATED_TIME = "estimated_time";
|
||||
|
||||
public static final String EXPIRATION = "expiration";
|
||||
|
||||
public static final String FALLBACK_LANG = "de";
|
||||
public static final String FIELD_BANK_ACCOUNT = "bank_account";
|
||||
public static final String FIELD_COURT = "court";
|
||||
public static final String FIELD_CURRENCY = "currency";
|
||||
public static final String FIELD_PHONE = "phone";
|
||||
public static final String FIELD_TAX_NUMBER = "tax_number";
|
||||
|
||||
public static final String GET = "GET";
|
||||
|
||||
public static final String ID = "id";
|
||||
|
||||
public static final String JSONARRAY = "json array";
|
||||
public static final String JSONOBJECT = "json object";
|
||||
public static final String KEY = "key";
|
||||
|
||||
public static final String LANGUAGE = "language";
|
||||
public static final String LAST_CUSTOMER_NUMBER = "last_customer_number";
|
||||
public static final String LOGIN = "login";
|
||||
|
||||
public static final String MEMBERS = "members";
|
||||
public static final String MESSAGES = "messages";
|
||||
public static final String MODULE = "module";
|
||||
|
||||
public static final String NAME = "name";
|
||||
public static final String NEW_MEMBER = "new_member";
|
||||
@@ -90,8 +104,10 @@ public class Constants {
|
||||
public static final String TAGS = "tags";
|
||||
public static final String TEMPLATE = "template";
|
||||
public static final String TEXT = "text";
|
||||
public static final String THOUSANDS_SEPARATOR = "thousands_separator";
|
||||
public static final String THEME = "theme";
|
||||
public static final String TITLE = "title";
|
||||
public static final String TIMESTAMP = "timestamp";
|
||||
public static final String TOKEN = "token";
|
||||
|
||||
public static final String UMBRELLA = "Umbrella";
|
||||
@@ -100,16 +116,7 @@ public class Constants {
|
||||
public static final String USER_ID = "user_id";
|
||||
public static final String USER_LIST = "user_list";
|
||||
public static final String UTF8 = UTF_8.displayName();
|
||||
|
||||
public static final String VALUE = "value";
|
||||
|
||||
public static final String FIELD_COURT = "court";
|
||||
public static final String FIELD_TAX_NUMBER = "tax_number";
|
||||
public static final String FIELD_PHONE = "phone";
|
||||
public static final String DECIMAL_SEPARATOR = "decimal_separator";
|
||||
public static final String THOUSANDS_SEPARATOR = "thousands_separator";
|
||||
public static final String LAST_CUSTOMER_NUMBER = "last_customer_number";
|
||||
public static final String DECIMALS = "decimals";
|
||||
public static final String CUSTOMER_NUMBER_PREFIX = "customer_number_prefix";
|
||||
public static final String FIELD_CURRENCY = "currency";
|
||||
public static final String FIELD_BANK_ACCOUNT = "bank_account";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/* © SRSoftware 2025 */
|
||||
package de.srsoftware.umbrella.core.api;
|
||||
|
||||
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
||||
import de.srsoftware.umbrella.core.model.Note;
|
||||
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface NoteService {
|
||||
void deleteEntity(String task, long taskId);
|
||||
|
||||
Collection<Note> getNotes(String module, long entityId) throws UmbrellaException;
|
||||
|
||||
Note save(Note note);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/* © SRSoftware 2025 */
|
||||
package de.srsoftware.umbrella.core.model;
|
||||
|
||||
import de.srsoftware.tools.Mappable;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
import static de.srsoftware.umbrella.core.Constants.*;
|
||||
import static de.srsoftware.umbrella.core.Util.markdown;
|
||||
|
||||
public record Note(long id, String module, long entityId, long authorId, String text, LocalDateTime timestamp) implements Mappable {
|
||||
public static Note of(ResultSet rs) throws SQLException {
|
||||
return new Note(
|
||||
rs.getLong(ID),
|
||||
rs.getString(MODULE),
|
||||
rs.getLong(ENTITY_ID),
|
||||
rs.getLong(USER_ID),
|
||||
rs.getString(TEXT),
|
||||
LocalDateTime.parse(rs.getString(TIMESTAMP))
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> toMap() {
|
||||
return Map.of(
|
||||
ID,id,
|
||||
MODULE,module,
|
||||
ENTITY_ID,entityId,
|
||||
USER_ID,authorId,
|
||||
TEXT,text,
|
||||
RENDERED,markdown(text),
|
||||
TIMESTAMP,timestamp
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user