mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-08-05 02:24:52 +00:00
Trim values of some input data
Some values don't make sense when padded with whitespace, like organization name, source ids etc. These are trimmed now when received.
This commit is contained in:
@ -401,15 +401,15 @@ trait Conversions {
|
|||||||
org = ROrganization(
|
org = ROrganization(
|
||||||
oid,
|
oid,
|
||||||
cid,
|
cid,
|
||||||
v.name,
|
v.name.trim,
|
||||||
v.address.street,
|
v.address.street.trim,
|
||||||
v.address.zip,
|
v.address.zip.trim,
|
||||||
v.address.city,
|
v.address.city.trim,
|
||||||
v.address.country,
|
v.address.country.trim,
|
||||||
v.notes,
|
v.notes,
|
||||||
now,
|
now,
|
||||||
now,
|
now,
|
||||||
v.shortName
|
v.shortName.map(_.trim)
|
||||||
)
|
)
|
||||||
} yield OOrganization.OrgAndContacts(org, cont)
|
} yield OOrganization.OrgAndContacts(org, cont)
|
||||||
}
|
}
|
||||||
@ -426,15 +426,15 @@ trait Conversions {
|
|||||||
org = ROrganization(
|
org = ROrganization(
|
||||||
v.id,
|
v.id,
|
||||||
cid,
|
cid,
|
||||||
v.name,
|
v.name.trim,
|
||||||
v.address.street,
|
v.address.street.trim,
|
||||||
v.address.zip,
|
v.address.zip.trim,
|
||||||
v.address.city,
|
v.address.city.trim,
|
||||||
v.address.country,
|
v.address.country.trim,
|
||||||
v.notes,
|
v.notes,
|
||||||
v.created,
|
v.created,
|
||||||
now,
|
now,
|
||||||
v.shortName
|
v.shortName.map(_.trim)
|
||||||
)
|
)
|
||||||
} yield OOrganization.OrgAndContacts(org, cont)
|
} yield OOrganization.OrgAndContacts(org, cont)
|
||||||
}
|
}
|
||||||
@ -463,11 +463,11 @@ trait Conversions {
|
|||||||
pers = RPerson(
|
pers = RPerson(
|
||||||
pid,
|
pid,
|
||||||
cid,
|
cid,
|
||||||
v.name,
|
v.name.trim,
|
||||||
v.address.street,
|
v.address.street.trim,
|
||||||
v.address.zip,
|
v.address.zip.trim,
|
||||||
v.address.city,
|
v.address.city.trim,
|
||||||
v.address.country,
|
v.address.country.trim,
|
||||||
v.notes,
|
v.notes,
|
||||||
now,
|
now,
|
||||||
now,
|
now,
|
||||||
@ -489,11 +489,11 @@ trait Conversions {
|
|||||||
pers = RPerson(
|
pers = RPerson(
|
||||||
v.id,
|
v.id,
|
||||||
cid,
|
cid,
|
||||||
v.name,
|
v.name.trim,
|
||||||
v.address.street,
|
v.address.street.trim,
|
||||||
v.address.zip,
|
v.address.zip.trim,
|
||||||
v.address.city,
|
v.address.city.trim,
|
||||||
v.address.country,
|
v.address.country.trim,
|
||||||
v.notes,
|
v.notes,
|
||||||
v.created,
|
v.created,
|
||||||
now,
|
now,
|
||||||
@ -513,7 +513,7 @@ trait Conversions {
|
|||||||
pid: Option[Ident]
|
pid: Option[Ident]
|
||||||
): F[RContact] =
|
): F[RContact] =
|
||||||
timeId.map { case (id, now) =>
|
timeId.map { case (id, now) =>
|
||||||
RContact(id, c.value, c.kind, pid, oid, now)
|
RContact(id, c.value.trim, c.kind, pid, oid, now)
|
||||||
}
|
}
|
||||||
|
|
||||||
// users
|
// users
|
||||||
@ -564,11 +564,11 @@ trait Conversions {
|
|||||||
|
|
||||||
def newTag[F[_]: Sync](t: Tag, cid: Ident): F[RTag] =
|
def newTag[F[_]: Sync](t: Tag, cid: Ident): F[RTag] =
|
||||||
timeId.map { case (id, now) =>
|
timeId.map { case (id, now) =>
|
||||||
RTag(id, cid, t.name, t.category, now)
|
RTag(id, cid, t.name.trim, t.category.map(_.trim), now)
|
||||||
}
|
}
|
||||||
|
|
||||||
def changeTag(t: Tag, cid: Ident): RTag =
|
def changeTag(t: Tag, cid: Ident): RTag =
|
||||||
RTag(t.id, cid, t.name, t.category, t.created)
|
RTag(t.id, cid, t.name.trim, t.category.map(_.trim), t.created)
|
||||||
|
|
||||||
// sources
|
// sources
|
||||||
|
|
||||||
@ -593,7 +593,7 @@ trait Conversions {
|
|||||||
RSource(
|
RSource(
|
||||||
id,
|
id,
|
||||||
cid,
|
cid,
|
||||||
s.abbrev,
|
s.abbrev.trim,
|
||||||
s.description,
|
s.description,
|
||||||
0,
|
0,
|
||||||
s.enabled,
|
s.enabled,
|
||||||
@ -608,7 +608,7 @@ trait Conversions {
|
|||||||
RSource(
|
RSource(
|
||||||
s.id,
|
s.id,
|
||||||
coll,
|
coll,
|
||||||
s.abbrev,
|
s.abbrev.trim,
|
||||||
s.description,
|
s.description,
|
||||||
s.counter,
|
s.counter,
|
||||||
s.enabled,
|
s.enabled,
|
||||||
@ -624,13 +624,13 @@ trait Conversions {
|
|||||||
|
|
||||||
def newEquipment[F[_]: Sync](e: Equipment, cid: Ident): F[REquipment] =
|
def newEquipment[F[_]: Sync](e: Equipment, cid: Ident): F[REquipment] =
|
||||||
timeId.map({ case (id, now) =>
|
timeId.map({ case (id, now) =>
|
||||||
REquipment(id, cid, e.name, now, now, e.notes)
|
REquipment(id, cid, e.name.trim, now, now, e.notes)
|
||||||
})
|
})
|
||||||
|
|
||||||
def changeEquipment[F[_]: Sync](e: Equipment, cid: Ident): F[REquipment] =
|
def changeEquipment[F[_]: Sync](e: Equipment, cid: Ident): F[REquipment] =
|
||||||
Timestamp
|
Timestamp
|
||||||
.current[F]
|
.current[F]
|
||||||
.map(now => REquipment(e.id, cid, e.name, e.created, now, e.notes))
|
.map(now => REquipment(e.id, cid, e.name.trim, e.created, now, e.notes))
|
||||||
|
|
||||||
// idref
|
// idref
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user