implemented updating of option names. next: update option description

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-02-23 14:58:47 +01:00
parent 0eab5619d1
commit e5ab655787
6 changed files with 96 additions and 15 deletions

View File

@@ -80,8 +80,9 @@ public class Text {
public static final String WIKI_PAGE = "wiki page";
public static final String WIKI_PAGES = "wiki pages";
public static final String UNIT_PRICE = "unit price";
public static final String USER = "user";
public static final String USERS = "users";
public static final String UNIT_PRICE = "unit price";
public static final String UNKNOWN_FIELD = "unknown field: {id}";
public static final String USER = "user";
public static final String USERS = "users";
}

View File

@@ -19,7 +19,8 @@ public record Poll(String id, Owner owner, String name, String description, bool
public static class Option implements Mappable{
private int id;
Integer status;
private final String description, name;
private String description;
private String name;
private final Set<String> dirtyFields = new HashSet<>();
public Option(int id, String name, String description, Integer status) {
@@ -33,6 +34,12 @@ public record Poll(String id, Owner owner, String name, String description, bool
return description;
}
public Option description(String newVal){
description = newVal;
dirtyFields.add(DESCRIPTION);
return this;
}
public int id(){
return id;
}
@@ -55,6 +62,12 @@ public record Poll(String id, Owner owner, String name, String description, bool
return name;
}
public Option name(String newVal){
name = newVal;
dirtyFields.add(NAME);
return this;
}
public static Option of(ResultSet rs) throws SQLException {
var id = rs.getInt(ID);
var name = rs.getString(NAME);