feat(server, web): quotas (#4471)
* feat: quotas * chore: open api * chore: update status box and upload error message --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
@@ -45,6 +45,8 @@ export class UsageByUserDto {
|
||||
videos!: number;
|
||||
@ApiProperty({ type: 'integer', format: 'int64' })
|
||||
usage!: number;
|
||||
@ApiProperty({ type: 'integer', format: 'int64' })
|
||||
quotaSizeInBytes!: number | null;
|
||||
}
|
||||
|
||||
export class ServerStatsResponseDto {
|
||||
|
||||
@@ -220,6 +220,7 @@ describe(ServerInfoService.name, () => {
|
||||
photos: 10,
|
||||
videos: 11,
|
||||
usage: 12345,
|
||||
quotaSizeInBytes: 0,
|
||||
},
|
||||
{
|
||||
userId: 'user2',
|
||||
@@ -227,6 +228,7 @@ describe(ServerInfoService.name, () => {
|
||||
photos: 10,
|
||||
videos: 20,
|
||||
usage: 123456,
|
||||
quotaSizeInBytes: 0,
|
||||
},
|
||||
{
|
||||
userId: 'user3',
|
||||
@@ -234,6 +236,7 @@ describe(ServerInfoService.name, () => {
|
||||
photos: 100,
|
||||
videos: 0,
|
||||
usage: 987654,
|
||||
quotaSizeInBytes: 0,
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -244,6 +247,7 @@ describe(ServerInfoService.name, () => {
|
||||
usageByUser: [
|
||||
{
|
||||
photos: 10,
|
||||
quotaSizeInBytes: 0,
|
||||
usage: 12345,
|
||||
userName: '1 User',
|
||||
userId: 'user1',
|
||||
@@ -251,6 +255,7 @@ describe(ServerInfoService.name, () => {
|
||||
},
|
||||
{
|
||||
photos: 10,
|
||||
quotaSizeInBytes: 0,
|
||||
usage: 123456,
|
||||
userName: '2 User',
|
||||
userId: 'user2',
|
||||
@@ -258,6 +263,7 @@ describe(ServerInfoService.name, () => {
|
||||
},
|
||||
{
|
||||
photos: 100,
|
||||
quotaSizeInBytes: 0,
|
||||
usage: 987654,
|
||||
userName: '3 User',
|
||||
userId: 'user3',
|
||||
|
||||
@@ -118,6 +118,7 @@ export class ServerInfoService {
|
||||
usage.photos = user.photos;
|
||||
usage.videos = user.videos;
|
||||
usage.usage = user.usage;
|
||||
usage.quotaSizeInBytes = user.quotaSizeInBytes;
|
||||
|
||||
serverStats.photos += usage.photos;
|
||||
serverStats.videos += usage.videos;
|
||||
|
||||
Reference in New Issue
Block a user