fix initialisation of Bot members, 'published' was not copied up
This commit is contained in:
parent
95fed42020
commit
d64a9c75e8
4 changed files with 8 additions and 10 deletions
|
|
@ -41,14 +41,15 @@ public class Bot {
|
|||
|
||||
Bot() {
|
||||
}
|
||||
Bot( String username, String name, String summary, String type, boolean manuallyApproveFollowers, boolean indexable, String pubicKeyPem ) {
|
||||
Bot( String username, String name, String summary, Instant published, String publicKeyPem, String type, boolean manuallyApproveFollowers, boolean indexable ) {
|
||||
this.username = username;
|
||||
this.name = name;
|
||||
this.summary = summary;
|
||||
this.published = published;
|
||||
this.publicKeyPem = publicKeyPem;
|
||||
this.type = type;
|
||||
this.manuallyApproveFollowers = manuallyApproveFollowers;
|
||||
this.indexable = indexable;
|
||||
this.publicKeyPem = publicKeyPem;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,11 +41,9 @@ public class BotController {
|
|||
}
|
||||
|
||||
@PostMapping("/makebot")
|
||||
public String makebotpost(@ModelAttribute("bot") Bot bot) {
|
||||
//log.info(bot);
|
||||
|
||||
botServ.save(bot);
|
||||
|
||||
public String makebotpost(Bot bot, Model model) {
|
||||
bot = botServ.save(bot);
|
||||
model.addAttribute("bot", bot);
|
||||
return "makebot_submitted";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@ public class BotJpaRepo implements BotRepo {
|
|||
BotModel botModel = BotModel.from(bot);
|
||||
BotModel saved = botJdbcRepo.save(botModel);
|
||||
return saved.asBot();
|
||||
// this pattern comes from the 'ensembler' MemberRepositoryJdbcAdapter impl
|
||||
// TODO: in our case I'm not sure we need to be returning a Bot, could be void?
|
||||
// returning the bot here means that automated fields like creation dates are bubbled up
|
||||
}
|
||||
|
||||
public Optional<Bot> findByUsername(String username) {
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public class BotModel {
|
|||
}
|
||||
|
||||
Bot asBot() {
|
||||
return new Bot( username, name, summary, type, manuallyApproveFollowers, indexable, publicKeyPem );
|
||||
return new Bot( username, name, summary, published, publicKeyPem, type, manuallyApproveFollowers, indexable );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue