Add command and query for organizations

* Added command and query for organizations
* Saving unknown organizations into database in `background` service
* Added `List` method in `OrganizationRepository`
This commit is contained in:
Aleksandr Trushkin
2024-03-24 22:59:32 +03:00
parent 9d2efcc1c4
commit e7c2832865
14 changed files with 463 additions and 41 deletions

View File

@ -5,3 +5,11 @@ func ForEach[T any](items []T, f func(T)) {
f(item)
}
}
func AsMap[T any, U comparable](items []T, f func(T) U) map[U]struct{} {
out := make(map[U]struct{}, len(items))
ForEach(items, func(in T) {
out[f(in)] = struct{}{}
})
return out
}