- Документирование API:
swagger
ASP.NET Core 3.0
- база данных:
PostgreSQL
- ОРМ:
EF
. - валидация:
FluentValidation
- мапинг:
AutoMaper
- фильтрация/сортировка/пагинация:
Sieve
Объявление
- Id (
guid
) - Номер (
int
)* - Пользователь (
guid
) ссылка на таблицу* - Текст (
string
)* - Картинка*
- Рейтинг (
int
)* - Создано (
datetime
)*
Пользователь
- Id (
guid
) - Имя (
string
) - Количество объявлений (
int
)
- добавление
- удаление
- редактирование
- поиск.
- сортировки
- поиск по всем полям
- фильтрацию
- постраничный просмотр
- один пользователь может опубликовать не более X(брать из настроек) объявлений
An example sort/filter/page query:
api/ads
?sorts= userId,-creationDate // sort by user, then descendingly by creation date
&filters= rating>10, Content@=продам // filter to ads with more than 10 rating, and a content that contains the phrase "продам"
&page= 1 // get the first page...
&pageSize= 10 // ...which contains 10 ads
More formally:
sorts
is a comma-delimited ordered list of property names to sort by. Adding a-
before the name switches to sorting descendingly.filters
is a comma-delimited list of{Name}{Operator}{Value}
where{Name}
is the name of a property with the Sieve attribute or the name of a custom filter method for TEntity- You can also have multiple names (for OR logic) by enclosing them in brackets and using a pipe delimiter, eg.
(LikeCount|CommentCount)>10
asks ifLikeCount
orCommentCount
is>10
- You can also have multiple names (for OR logic) by enclosing them in brackets and using a pipe delimiter, eg.
{Operator}
is one of the Operators{Value}
is the value to use for filtering- You can also have multiple values (for OR logic) by using a pipe delimiter, eg.
Title@=new|hot
will return posts with titles that contain the text "new
" or "hot
"
- You can also have multiple values (for OR logic) by using a pipe delimiter, eg.
page
is the number of page to returnpageSize
is the number of items returned per page
Notes:
- You can use backslashes to escape commas and pipes within value fields
- You can have spaces anywhere except within
{Name}
or{Operator}
fields
Operator | Meaning |
---|---|
== |
Equals |
!= |
Not equals |
> |
Greater than |
< |
Less than |
>= |
Greater than or equal to |
<= |
Less than or equal to |
@= |
Contains |
_= |
Starts with |
!@= |
Does not Contains |
!_= |
Does not Starts with |
@=* |
Case-insensitive string Contains |
_=* |
Case-insensitive string Starts with |
==* |
Case-insensitive string Equals |
!@=* |
Case-insensitive string does not Contains |
!_=* |
Case-insensitive string does not Starts with |