~aleteoryx/muditaos

ref: 6059ac716e0db2e30e5d04c7009c406ac7720a7d muditaos/module-db/queries/multimedia_files/QueryMultimediaFilesGetLimited.hpp -rw-r--r-- 3.7 KiB
6059ac71 — Lefucjusz [BH-2034] Various cleanups and refactors across the OS 1 year, 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include "module-db/Interface/MultimediaFilesRecord.hpp"

#include <Common/Query.hpp>

#include <string>

namespace db::multimedia_files::query
{
    class GetLimited : public Query
    {
      public:
        GetLimited(uint32_t offset, uint32_t limit);
        [[nodiscard]] auto debugInfo() const -> std::string override;

        const uint32_t offset = 0;
        const uint32_t limit  = 0;
    };

    class GetLimitedForArtist : public Query
    {
      public:
        GetLimitedForArtist(Artist artist, uint32_t offset, uint32_t limit);
        [[nodiscard]] auto debugInfo() const -> std::string override;

        const Artist artist;

        const uint32_t offset = 0;
        const uint32_t limit  = 0;
    };

    class GetLimitedForAlbum : public Query
    {
      public:
        GetLimitedForAlbum(Album album, uint32_t offset, uint32_t limit);
        [[nodiscard]] auto debugInfo() const -> std::string override;

        const Album album;

        const uint32_t offset = 0;
        const uint32_t limit  = 0;
    };

    class GetLimitedResult : public QueryResult
    {
        const std::vector<MultimediaFilesRecord> records;
        unsigned int dbRecordsCount;

      public:
        explicit GetLimitedResult(std::vector<MultimediaFilesRecord> records, unsigned int dbRecordsCount);
        [[nodiscard]] auto getResult() const -> std::vector<MultimediaFilesRecord>;
        [[nodiscard]] auto getCount() const noexcept -> unsigned int;
        [[nodiscard]] auto debugInfo() const -> std::string override;
    };

    class GetArtistsLimited : public Query
    {
      public:
        GetArtistsLimited(uint32_t offset, uint32_t limit);
        [[nodiscard]] auto debugInfo() const -> std::string override;

        const uint32_t offset = 0;
        const uint32_t limit  = 0;
    };

    class GetArtistsLimitedResult : public QueryResult
    {
        const std::vector<Artist> records;
        unsigned int dbRecordsCount;

      public:
        explicit GetArtistsLimitedResult(std::vector<Artist> records, unsigned int dbRecordsCount);
        [[nodiscard]] auto getResult() const -> std::vector<Artist>;
        [[nodiscard]] auto getCount() const noexcept -> unsigned int;
        [[nodiscard]] auto debugInfo() const -> std::string override;
    };

    class GetAlbumsLimited : public Query
    {
      public:
        GetAlbumsLimited(uint32_t offset, uint32_t limit);
        [[nodiscard]] auto debugInfo() const -> std::string override;

        const uint32_t offset = 0;
        const uint32_t limit  = 0;
    };

    class GetAlbumsLimitedResult : public QueryResult
    {
        const std::vector<Album> records;
        unsigned int dbRecordsCount;

      public:
        explicit GetAlbumsLimitedResult(std::vector<Album> records, unsigned int dbRecordsCount);
        [[nodiscard]] auto getResult() const -> std::vector<Album>;
        [[nodiscard]] auto getCount() const noexcept -> unsigned int;
        [[nodiscard]] auto debugInfo() const -> std::string override;
    };

    class GetLimitedByPaths : public Query
    {
      public:
        GetLimitedByPaths(const std::vector<std::string> &paths,
                          std::uint32_t offset,
                          std::uint32_t limit,
                          SortingBy sorting = SortingBy::TitleAscending);
        [[nodiscard]] auto debugInfo() const -> std::string override;

        const std::vector<std::string> paths;
        const uint32_t offset = 0;
        const uint32_t limit  = 0;
        const SortingBy sorting = SortingBy::TitleAscending;
    };
} // namespace db::multimedia_files::query