-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API: allow to update team #16716
base: master
Are you sure you want to change the base?
API: allow to update team #16716
Conversation
I wouldn't say simplify
given fieldsInstance: TeamForm.Fields.type = TeamForm.Fields | ||
private def changing[A] = lila.common.Form.SingleChange.changing[Team, TeamForm.Fields.type, A] | ||
|
||
val changes: Map[String, Change[?]] = List[Change[?]]( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flair not added, because it requires the flair api, and was not sure how to integrate it. Simply adding TeamSingleChange
inside TeamForm
would work
modules/common/src/main/Form.scala
Outdated
object SingleChange: | ||
case class Change[Model, A](field: String, mapping: Mapping[A], update: A => Model => Model): | ||
def form: PlayForm[A] = PlayForm(single(field -> mapping)) | ||
|
||
def changing[Model, FieldsType, A](field: FieldsType => (String, Mapping[A]))( | ||
f: A => Model => Model | ||
)(using fieldsType: FieldsType): Change[Model, A] = | ||
Change(field(fieldsType)._1, field(fieldsType)._2, f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole partial update thing feels more convoluted and restrictive than it needs to be I think.
I've no concrete plan though, only thinking something using filled form etc would allow multiple changes at the same time, but no concrete plan.
close #11380 but is more general, all fields but flairs are supported
testing code