Fix dapper user json parsing

This commit is contained in:
Zoe Roux 2024-03-02 16:47:18 +01:00
parent 1335ae13e8
commit 633db89031
2 changed files with 9 additions and 1 deletions

View File

@ -99,7 +99,7 @@ public class UserRepository(
from
users as u
where
u.external_id->{provider}->>'id' = {id}
u.external_id->{provider}->>'Id' = {id}
""",
new() { ["u"] = typeof(User) },
(items) => (items[0] as User)!,

View File

@ -97,6 +97,14 @@ namespace Kyoo.Postgresql
typeof(Dictionary<string, MetadataId>),
new JsonTypeHandler<Dictionary<string, MetadataId>>()
);
SqlMapper.AddTypeHandler(
typeof(Dictionary<string, string>),
new JsonTypeHandler<Dictionary<string, string>>()
);
SqlMapper.AddTypeHandler(
typeof(Dictionary<string, ExternalToken>),
new JsonTypeHandler<Dictionary<string, ExternalToken>>()
);
SqlMapper.AddTypeHandler(typeof(List<string>), new ListTypeHandler<string>());
SqlMapper.AddTypeHandler(typeof(List<Genre>), new ListTypeHandler<Genre>());
SqlMapper.AddTypeHandler(typeof(Wrapper), new Wrapper.Handler());