mirror of
https://github.com/navidrome/navidrome.git
synced 2026-05-03 06:51:16 +00:00
Merge c6ba4ba6ee56e0f498a61e8b5be149693150043f into e86dc03619ffb8477083de23bb4daed567ef0a2c
This commit is contained in:
commit
25fc221fac
@ -57,6 +57,7 @@ func NewUserRepository(ctx context.Context, db dbx.Builder) model.UserRepository
|
|||||||
r.db = db
|
r.db = db
|
||||||
r.tableName = "user"
|
r.tableName = "user"
|
||||||
r.registerModel(&model.User{}, map[string]filterFunc{
|
r.registerModel(&model.User{}, map[string]filterFunc{
|
||||||
|
"id": idFilter(r.tableName),
|
||||||
"password": invalidFilter(ctx),
|
"password": invalidFilter(ctx),
|
||||||
"name": r.withTableName(startsWithFilter),
|
"name": r.withTableName(startsWithFilter),
|
||||||
})
|
})
|
||||||
|
|||||||
@ -559,4 +559,15 @@ var _ = Describe("UserRepository", func() {
|
|||||||
Expect(user.Libraries[0].ID).To(Equal(1))
|
Expect(user.Libraries[0].ID).To(Equal(1))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Describe("filters", func() {
|
||||||
|
It("qualifies id filter with table name", func() {
|
||||||
|
r := repo.(*userRepository)
|
||||||
|
qo := r.parseRestOptions(r.ctx, rest.QueryOptions{Filters: map[string]any{"id": "123"}})
|
||||||
|
sel := r.selectUserWithLibraries(qo)
|
||||||
|
query, _, err := r.toSQL(sel)
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
Expect(query).To(ContainSubstring("user.id = {:p0}"))
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user