1.0.0 #253
@ -1 +1 @@
|
||||
Subproject commit 7986144705052ff38472a5d3f0776cb6c1752a55
|
||||
Subproject commit 6e2ec8f2f88cca5355624da9c83c034949d12ae3
|
@ -69,11 +69,11 @@ class ApiKey(TableABC):
|
||||
return str(
|
||||
f"""
|
||||
INSERT INTO `ApiKeys` (
|
||||
`Identifier`, `Key`, {"" if self._creator is None else "`CreatorId`,"} `CreatedAt`, `LastModifiedAt`
|
||||
`Identifier`, `Key`, `CreatorId`, `CreatedAt`, `LastModifiedAt`
|
||||
) VALUES (
|
||||
'{self._identifier}',
|
||||
'{self._key}',
|
||||
{"" if self._creator is None else f"{self._creator.id},"}
|
||||
{"NULL" if self._creator is None else f"'{self._creator.id}'"},
|
||||
'{self._created_at}',
|
||||
'{self._modified_at}'
|
||||
);
|
||||
@ -87,7 +87,7 @@ class ApiKey(TableABC):
|
||||
UPDATE `ApiKeys`
|
||||
SET `Identifier` = '{self._identifier}',
|
||||
`Key` = '{self._key}',
|
||||
{"" if self._creator is None else f"`CreatorId` = {self._creator.id},"}
|
||||
`CreatorId` = {"NULL" if self._creator is None else f"'{self._creator.id}'"},
|
||||
`LastModifiedAt` = '{self._modified_at}'
|
||||
WHERE `Id` = {self._id};
|
||||
"""
|
||||
|
@ -215,10 +215,10 @@ class AuthUser(TableABC):
|
||||
`EMail`,
|
||||
`Password`,
|
||||
`PasswordSalt`,
|
||||
{"" if self._refresh_token is None else f"`RefreshToken`,"}
|
||||
{"" if self._confirmation_id is None else f"`ConfirmationId`,"}
|
||||
{"" if self._forgot_password_id is None else f"`ForgotPasswordId`,"}
|
||||
{"" if self._oauth_id is None else f"`OAuthId`,"}
|
||||
`RefreshToken`,
|
||||
`ConfirmationId`,
|
||||
`ForgotPasswordId`,
|
||||
`OAuthId`,
|
||||
`RefreshTokenExpiryTime`,
|
||||
`AuthRole`,
|
||||
`CreatedAt`,
|
||||
@ -230,10 +230,10 @@ class AuthUser(TableABC):
|
||||
'{self._email}',
|
||||
'{self._password}',
|
||||
'{self._password_salt}',
|
||||
{"" if self._refresh_token is None else f"'{self._refresh_token}',"}
|
||||
{"" if self._confirmation_id is None else f"'{self._confirmation_id}',"}
|
||||
{"" if self._forgot_password_id is None else f"'{self._forgot_password_id}',"}
|
||||
{"" if self._oauth_id is None else f"'{self._oauth_id}',"}
|
||||
{"NULL" if self._refresh_token is None else f"'{self._refresh_token}'"},
|
||||
{"NULL" if self._confirmation_id is None else f"'{self._confirmation_id}'"},
|
||||
{"NULL" if self._forgot_password_id is None else f"'{self._forgot_password_id}'"},
|
||||
{"NULL" if self._oauth_id is None else f"'{self._oauth_id}'"},
|
||||
'{self._refresh_token_expire_time.isoformat()}',
|
||||
{self._auth_role_id.value},
|
||||
'{self._created_at}',
|
||||
@ -252,10 +252,10 @@ class AuthUser(TableABC):
|
||||
`EMail` = '{self._email}',
|
||||
`Password` = '{self._password}',
|
||||
`PasswordSalt` = '{self._password_salt}',
|
||||
{'' if self._refresh_token is None else f"`RefreshToken` = '{self._refresh_token}',"}
|
||||
{'' if self._confirmation_id is None else f"'`ConfirmationId` = '{self._confirmation_id}',"}
|
||||
{'' if self._forgot_password_id is None else f"`ForgotPasswordId` = '{self._forgot_password_id}',"}
|
||||
{'' if self._oauth_id is None else f"`OAuthId` = '{self._oauth_id}',"}
|
||||
`RefreshToken` = {"NULL" if self._refresh_token is None else f"'{self._refresh_token}'"},
|
||||
`ConfirmationId` = {"NULL" if self._confirmation_id is None else f"'{self._confirmation_id}'"},
|
||||
`ForgotPasswordId` = {"NULL" if self._forgot_password_id is None else f"'{self._forgot_password_id}'"},
|
||||
`OAuthId` = {"NULL" if self._oauth_id is None else f"'{self._oauth_id}'"},
|
||||
`RefreshTokenExpiryTime` = '{self._refresh_token_expire_time.isoformat()}',
|
||||
`AuthRole` = {self._auth_role_id.value},
|
||||
`LastModifiedAt` = '{self._modified_at}'
|
||||
|
@ -150,11 +150,11 @@ class User(TableABC):
|
||||
return str(
|
||||
f"""
|
||||
INSERT INTO `Users` (
|
||||
`DiscordId`, `XP`, {"" if self._minecraft_id is None else "`MinecraftId`,"} `ServerId`, `CreatedAt`, `LastModifiedAt`
|
||||
`DiscordId`, `XP`, `MinecraftId`, `ServerId`, `CreatedAt`, `LastModifiedAt`
|
||||
) VALUES (
|
||||
{self._discord_id},
|
||||
{self._xp},
|
||||
{"" if self._minecraft_id is None else f"'{self._minecraft_id}',"}
|
||||
{"NULL" if self._minecraft_id is None else f"'{self._minecraft_id}'"},
|
||||
{self._server.id},
|
||||
'{self._created_at}',
|
||||
'{self._modified_at}'
|
||||
@ -168,7 +168,7 @@ class User(TableABC):
|
||||
f"""
|
||||
UPDATE `Users`
|
||||
SET `XP` = {self._xp},
|
||||
{"" if self._minecraft_id is None else f"`MinecraftId` = '{self._minecraft_id}',"}
|
||||
`MinecraftId` = {"NULL" if self._minecraft_id is None else f"'{self._minecraft_id}'"},
|
||||
`LastModifiedAt` = '{self._modified_at}'
|
||||
WHERE `UserId` = {self._user_id};
|
||||
"""
|
||||
|
@ -101,12 +101,12 @@ class UserJoinedGameServer(TableABC):
|
||||
return str(
|
||||
f"""
|
||||
INSERT INTO `UserJoinedGameServer` (
|
||||
`UserId`, `GameServer`, `JoinedOn`, {"" if self._leaved_on is None else "`LeavedOn`,"} `CreatedAt`, `LastModifiedAt`
|
||||
`UserId`, `GameServer`, `JoinedOn`, `LeavedOn`, `CreatedAt`, `LastModifiedAt`
|
||||
) VALUES (
|
||||
{self._user.id},
|
||||
'{self._game_server}',
|
||||
'{self._joined_on}',
|
||||
{"" if self._leaved_on is None else f"'{self._leaved_on}',"}
|
||||
{"NULL" if self._leaved_on is None else f"'{self._leaved_on}'"},
|
||||
'{self._created_at}',
|
||||
'{self._modified_at}'
|
||||
);
|
||||
@ -118,8 +118,7 @@ class UserJoinedGameServer(TableABC):
|
||||
return str(
|
||||
f"""
|
||||
UPDATE `UserJoinedGameServer`
|
||||
SET
|
||||
{"" if self._leaved_on is None else f"`LeavedOn` = '{self._leaved_on}',"}
|
||||
SET `LeavedOn` = {"NULL" if self._leaved_on is None else f"'{self._leaved_on}'"},
|
||||
`LastModifiedAt` = '{self._modified_at}'
|
||||
WHERE `Id` = {self._id};
|
||||
"""
|
||||
|
@ -100,11 +100,11 @@ class UserJoinedServer(TableABC):
|
||||
return str(
|
||||
f"""
|
||||
INSERT INTO `UserJoinedServers` (
|
||||
`UserId`, `JoinedOn`, {"" if self._leaved_on is None else "`LeavedOn`,"} `CreatedAt`, `LastModifiedAt`
|
||||
`UserId`, `JoinedOn`, `LeavedOn`, `CreatedAt`, `LastModifiedAt`
|
||||
) VALUES (
|
||||
{self._user.id},
|
||||
'{self._joined_on}',
|
||||
{"" if self._leaved_on is None else f"'{self._leaved_on}',"}
|
||||
{"NULL" if self._leaved_on is None else f"'{self._leaved_on}'"},
|
||||
'{self._created_at}',
|
||||
'{self._modified_at}'
|
||||
);
|
||||
@ -116,8 +116,7 @@ class UserJoinedServer(TableABC):
|
||||
return str(
|
||||
f"""
|
||||
UPDATE `UserJoinedServers`
|
||||
SET
|
||||
{"" if self._leaved_on is None else f"`LeavedOn` = '{self._leaved_on}',"}
|
||||
SET `LeavedOn` = {"NULL" if self._leaved_on is None else f"'{self._leaved_on}'"},
|
||||
`LastModifiedAt` = '{self._modified_at}'
|
||||
WHERE `UserId` = {self._user.id};
|
||||
"""
|
||||
|
@ -108,12 +108,12 @@ class UserJoinedVoiceChannel(TableABC):
|
||||
return str(
|
||||
f"""
|
||||
INSERT INTO `UserJoinedVoiceChannel` (
|
||||
`UserId`, `DiscordChannelId`, `JoinedOn`, {"" if self._leaved_on is None else "`LeavedOn`,"} `CreatedAt`, `LastModifiedAt`
|
||||
`UserId`, `DiscordChannelId`, `JoinedOn`, `LeavedOn`, `CreatedAt`, `LastModifiedAt`
|
||||
) VALUES (
|
||||
{self._user.id},
|
||||
{self._channel_id},
|
||||
'{self._joined_on}',
|
||||
{"" if self._leaved_on is None else f"'{self._leaved_on}',"}
|
||||
{"NULL" if self._leaved_on is None else f"'{self._leaved_on}'"},
|
||||
'{self._created_at}',
|
||||
'{self._modified_at}'
|
||||
);
|
||||
@ -125,8 +125,7 @@ class UserJoinedVoiceChannel(TableABC):
|
||||
return str(
|
||||
f"""
|
||||
UPDATE `UserJoinedVoiceChannel`
|
||||
SET
|
||||
{"" if self._leaved_on is None else f"`LeavedOn` = '{self._leaved_on}',"}
|
||||
SET `LeavedOn` = {"NULL" if self._leaved_on is None else f"'{self._leaved_on}'"},
|
||||
`LastModifiedAt` = '{self._modified_at}'
|
||||
WHERE `JoinId` = {self._join_id};
|
||||
"""
|
||||
|
@ -28,7 +28,7 @@ class AuthUserRepositoryService(AuthUserRepositoryABC):
|
||||
|
||||
@staticmethod
|
||||
def _get_value_from_result(value: any) -> Optional[any]:
|
||||
if isinstance(value, str) and "null" in value:
|
||||
if isinstance(value, str) and "NULL" in value:
|
||||
return None
|
||||
|
||||
return value
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "kdb-web",
|
||||
"version": "1.0.dev133",
|
||||
"version": "1.0.dev220",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"update-version": "ts-node-esm update-version.ts",
|
||||
|
@ -26,6 +26,7 @@ export class Queries {
|
||||
|
||||
static serversQuery = `
|
||||
query ServerInfo($filter: ServerFilter, $page: Page, $sort: Sort) {
|
||||
serverCount
|
||||
servers(filter: $filter, page: $page, sort: $sort) {
|
||||
id
|
||||
name
|
||||
@ -46,114 +47,76 @@ export class Queries {
|
||||
`;
|
||||
|
||||
static levelQuery = `
|
||||
query LevelsList($filter: LevelFilter, $page: Page, $sort: Sort) {
|
||||
levelCount
|
||||
levels(filter: $filter, page: $page, sort: $sort) {
|
||||
id
|
||||
name
|
||||
color
|
||||
minXp
|
||||
permissions
|
||||
server {
|
||||
query LevelsList($serverId: ID, $filter: LevelFilter, $page: Page, $sort: Sort) {
|
||||
servers(filter: {id: $serverId}) {
|
||||
levelCount
|
||||
levels(filter: $filter, page: $page, sort: $sort) {
|
||||
id
|
||||
name
|
||||
color
|
||||
minXp
|
||||
permissions
|
||||
server {
|
||||
id
|
||||
name
|
||||
}
|
||||
createdAt
|
||||
modifiedAt
|
||||
}
|
||||
createdAt
|
||||
modifiedAt
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
static usersQuery = `
|
||||
query UsersList($filter: UserFilter, $page: Page, $sort: Sort) {
|
||||
userCount
|
||||
users(filter: $filter, page: $page, sort: $sort) {
|
||||
id
|
||||
discordId
|
||||
name
|
||||
xp
|
||||
ontime
|
||||
level {
|
||||
query UsersList($serverId: ID, $filter: UserFilter, $page: Page, $sort: Sort) {
|
||||
servers(filter: {id: $serverId}) {
|
||||
userCount
|
||||
users(filter: $filter, page: $page, sort: $sort) {
|
||||
id
|
||||
discordId
|
||||
name
|
||||
}
|
||||
server {
|
||||
id
|
||||
name
|
||||
}
|
||||
leftServer
|
||||
xp
|
||||
ontime
|
||||
minecraftId
|
||||
level {
|
||||
id
|
||||
name
|
||||
}
|
||||
leftServer
|
||||
server {
|
||||
id
|
||||
name
|
||||
}
|
||||
|
||||
joinedServerCount
|
||||
joinedServers {
|
||||
id
|
||||
}
|
||||
joinedServerCount
|
||||
joinedServers {
|
||||
id
|
||||
joinedOn
|
||||
leavedOn
|
||||
}
|
||||
|
||||
joinedVoiceChannelCount
|
||||
joinedVoiceChannels {
|
||||
id
|
||||
channelId
|
||||
channelName
|
||||
}
|
||||
joinedVoiceChannelCount
|
||||
joinedVoiceChannels {
|
||||
id
|
||||
channelId
|
||||
channelName
|
||||
time
|
||||
joinedOn
|
||||
leavedOn
|
||||
}
|
||||
|
||||
userJoinedGameServerCount
|
||||
userJoinedGameServers {
|
||||
id
|
||||
gameServer
|
||||
}
|
||||
userJoinedGameServerCount
|
||||
userJoinedGameServers {
|
||||
id
|
||||
gameServer
|
||||
time
|
||||
joinedOn
|
||||
leavedOn
|
||||
}
|
||||
|
||||
createdAt
|
||||
modifiedAt
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
static singleUserQuery = `
|
||||
query singleUserQuery($filter: UserFilter) {
|
||||
users(filter: $filter) {
|
||||
id
|
||||
discordId
|
||||
name
|
||||
xp
|
||||
ontime
|
||||
minecraftId
|
||||
level {
|
||||
id
|
||||
name
|
||||
createdAt
|
||||
modifiedAt
|
||||
}
|
||||
leftServer
|
||||
server {
|
||||
id
|
||||
name
|
||||
}
|
||||
|
||||
joinedServerCount
|
||||
joinedServers {
|
||||
id
|
||||
joinedOn
|
||||
leavedOn
|
||||
}
|
||||
|
||||
joinedVoiceChannelCount
|
||||
joinedVoiceChannels {
|
||||
id
|
||||
channelId
|
||||
channelName
|
||||
time
|
||||
joinedOn
|
||||
leavedOn
|
||||
}
|
||||
|
||||
userJoinedGameServerCount
|
||||
userJoinedGameServers {
|
||||
id
|
||||
gameServer
|
||||
time
|
||||
joinedOn
|
||||
leavedOn
|
||||
}
|
||||
|
||||
createdAt
|
||||
modifiedAt
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
@ -1,14 +1,19 @@
|
||||
import { User } from "../data/user.model";
|
||||
import { AutoRole, AutoRoleRule } from "../data/auto_role.model";
|
||||
import { Level } from "../data/level.model";
|
||||
import { Server } from "../data/server.model";
|
||||
|
||||
export interface GraphQLResult {
|
||||
data: any;
|
||||
data: {
|
||||
servers?: Server[];
|
||||
};
|
||||
errors?: [];
|
||||
}
|
||||
|
||||
export interface QueryResult {
|
||||
data: any;
|
||||
data: {
|
||||
servers?: Server[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface UpdateUserMutationResult {
|
||||
|
@ -42,7 +42,6 @@ export class AutoRolesRulesComponent implements OnInit {
|
||||
isEditingNew: boolean = false;
|
||||
|
||||
newAutoRoleTemplate: AutoRoleRule = {
|
||||
id: 0,
|
||||
createdAt: "",
|
||||
modifiedAt: ""
|
||||
};
|
||||
@ -65,6 +64,7 @@ export class AutoRolesRulesComponent implements OnInit {
|
||||
|
||||
totalRecords: number = 0;
|
||||
private unsubscriber = new Subject<void>();
|
||||
private server: Server = {};
|
||||
|
||||
constructor(
|
||||
private authService: AuthService,
|
||||
@ -88,7 +88,7 @@ export class AutoRolesRulesComponent implements OnInit {
|
||||
|
||||
this.setFilterForm();
|
||||
this.data.getServerFromRoute(this.route).then(server => {
|
||||
|
||||
this.server = server;
|
||||
this.spinner.showSpinner();
|
||||
if (!this.route.snapshot.params["autoRoleId"]) {
|
||||
this.spinner.hideSpinner();
|
||||
@ -122,7 +122,7 @@ export class AutoRolesRulesComponent implements OnInit {
|
||||
public loadNextPage(): void {
|
||||
this.loading = true;
|
||||
this.data.query<AutoRoleRuleQuery>(Queries.autoRoleRulesQuery, {
|
||||
serverId: this.sidebar.server$.value?.id, autoRoleId: this.autoRoleId, filter: this.filter, page: this.page, sort: this.sort
|
||||
serverId: this.server.id, autoRoleId: this.autoRoleId, filter: this.filter, page: this.page, sort: this.sort
|
||||
},
|
||||
(x: { servers: Server[] }) => {
|
||||
if (!x.servers[0].autoRoles || x.servers[0].autoRoles?.length == 0) {
|
||||
|
@ -38,7 +38,6 @@ export class AutoRolesComponent implements OnInit {
|
||||
isEditingNew: boolean = false;
|
||||
|
||||
newAutoRoleTemplate: AutoRole = {
|
||||
id: 0,
|
||||
createdAt: "",
|
||||
modifiedAt: ""
|
||||
};
|
||||
@ -60,8 +59,9 @@ export class AutoRolesComponent implements OnInit {
|
||||
sortDirection: undefined
|
||||
};
|
||||
|
||||
totalRecords!: number;
|
||||
totalRecords: number = 0;
|
||||
private unsubscriber = new Subject<void>();
|
||||
private server: Server = {};
|
||||
|
||||
constructor(
|
||||
private authService: AuthService,
|
||||
@ -80,6 +80,7 @@ export class AutoRolesComponent implements OnInit {
|
||||
|
||||
this.setFilterForm();
|
||||
this.data.getServerFromRoute(this.route).then(server => {
|
||||
this.server = server;
|
||||
this.spinner.showSpinner();
|
||||
this.data.query<SingleDiscordQuery>(Queries.guildsQuery, {
|
||||
filter: {
|
||||
@ -102,7 +103,7 @@ export class AutoRolesComponent implements OnInit {
|
||||
public loadNextPage(): void {
|
||||
this.loading = true;
|
||||
this.data.query<AutoRoleQuery>(Queries.autoRolesQuery, {
|
||||
id: this.sidebar.server$.value?.id, filter: this.filter, page: this.page, sort: this.sort
|
||||
serverId: this.server.id, filter: this.filter, page: this.page, sort: this.sort
|
||||
},
|
||||
(x: { servers: Server[] }) => {
|
||||
return x.servers[0];
|
||||
@ -192,7 +193,7 @@ export class AutoRolesComponent implements OnInit {
|
||||
|
||||
this.spinner.showSpinner();
|
||||
this.data.mutation<AutoRoleMutationResult>(Mutations.createAutoRole, {
|
||||
serverId: this.sidebar.server$.value?.id,
|
||||
serverId: this.server.id,
|
||||
channelId: newAutoRole.channelId,
|
||||
messageId: newAutoRole.messageId
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import { ActivatedRoute } from "@angular/router";
|
||||
import { Page } from "../../../../../../models/graphql/filter/page.model";
|
||||
import { Sort, SortDirection } from "../../../../../../models/graphql/filter/sort.model";
|
||||
import { Level, LevelFilter } from "../../../../../../models/data/level.model";
|
||||
import { LevelListQuery } from "../../../../../../models/graphql/query.model";
|
||||
import { LevelListQuery, Query } from "../../../../../../models/graphql/query.model";
|
||||
import { Queries } from "../../../../../../models/graphql/queries.model";
|
||||
import { catchError, debounceTime, takeUntil } from "rxjs/operators";
|
||||
import { LazyLoadEvent } from "primeng/api";
|
||||
@ -20,6 +20,7 @@ import { User } from "../../../../../../models/data/user.model";
|
||||
import { LevelMutationResult, UpdateUserMutationResult } from "../../../../../../models/graphql/result.model";
|
||||
import { Mutations } from "../../../../../../models/graphql/mutations.model";
|
||||
import { Subject, throwError } from "rxjs";
|
||||
import { Server } from "../../../../../../models/data/server.model";
|
||||
|
||||
@Component({
|
||||
selector: "app-levels",
|
||||
@ -28,7 +29,7 @@ import { Subject, throwError } from "rxjs";
|
||||
})
|
||||
export class LevelsComponent implements OnInit, OnDestroy {
|
||||
|
||||
public levels!: Level[];
|
||||
public levels: Level[] = [];
|
||||
public loading = true;
|
||||
|
||||
public isEditingNew: boolean = false;
|
||||
@ -51,11 +52,12 @@ export class LevelsComponent implements OnInit, OnDestroy {
|
||||
sortDirection: undefined
|
||||
};
|
||||
|
||||
public totalRecords!: number;
|
||||
public totalRecords: number = 0;
|
||||
|
||||
public clonedLevels: { [s: string]: Level; } = {};
|
||||
|
||||
private unsubscriber = new Subject<void>();
|
||||
private server: Server = {};
|
||||
|
||||
public constructor(
|
||||
private authService: AuthService,
|
||||
@ -70,8 +72,9 @@ export class LevelsComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.setFilterForm();
|
||||
this.data.getServerFromRoute(this.route).then(server => {
|
||||
this.setFilterForm();
|
||||
this.server = server;
|
||||
this.loadNextPage();
|
||||
});
|
||||
}
|
||||
@ -84,8 +87,11 @@ export class LevelsComponent implements OnInit, OnDestroy {
|
||||
public loadNextPage(): void {
|
||||
this.loading = true;
|
||||
this.data.query<LevelListQuery>(Queries.levelQuery, {
|
||||
filter: this.filter, page: this.page, sort: this.sort
|
||||
}
|
||||
serverId: this.server.id, filter: this.filter, page: this.page, sort: this.sort
|
||||
},
|
||||
(data: Query) => {
|
||||
return data.servers[0];
|
||||
}
|
||||
).subscribe(data => {
|
||||
this.totalRecords = data.levelCount;
|
||||
this.levels = data.levels;
|
||||
@ -179,7 +185,7 @@ export class LevelsComponent implements OnInit, OnDestroy {
|
||||
color: newLevel.color,
|
||||
minXp: newLevel.minXp,
|
||||
permissions: newLevel.permissions,
|
||||
serverId: this.sidebar.server$.value?.id
|
||||
serverId: this.server.id
|
||||
}
|
||||
).pipe(catchError(err => {
|
||||
this.isEditingNew = false;
|
||||
|
@ -10,7 +10,7 @@ import { LazyLoadEvent, MenuItem } from "primeng/api";
|
||||
import { Table } from "primeng/table";
|
||||
import { User, UserFilter } from "../../../../models/data/user.model";
|
||||
import { Queries } from "../../../../models/graphql/queries.model";
|
||||
import { LevelListQuery, UserListQuery } from "../../../../models/graphql/query.model";
|
||||
import { LevelListQuery, Query, UserListQuery } from "../../../../models/graphql/query.model";
|
||||
import { DataService } from "../../../../services/data/data.service";
|
||||
import { Page } from "../../../../models/graphql/filter/page.model";
|
||||
import { Sort, SortDirection } from "../../../../models/graphql/filter/sort.model";
|
||||
@ -19,6 +19,7 @@ import { Subject, throwError } from "rxjs";
|
||||
import { UpdateUserMutationResult } from "../../../../models/graphql/result.model";
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { Level } from "../../../../models/data/level.model";
|
||||
import { Server } from "../../../../models/data/server.model";
|
||||
|
||||
@Component({
|
||||
selector: "app-members",
|
||||
@ -27,7 +28,6 @@ import { Level } from "../../../../models/data/level.model";
|
||||
})
|
||||
export class MembersComponent implements OnInit {
|
||||
members!: User[];
|
||||
// levelsFilter!: MenuItem[];
|
||||
levels!: MenuItem[];
|
||||
leftServerOptions = [
|
||||
{ label: this.translate.instant("common.bool_as_string.true"), value: false },
|
||||
@ -80,6 +80,7 @@ export class MembersComponent implements OnInit {
|
||||
|
||||
totalRecords!: number;
|
||||
private unsubscriber = new Subject<void>();
|
||||
private server: Server = {};
|
||||
|
||||
constructor(
|
||||
private authService: AuthService,
|
||||
@ -97,11 +98,13 @@ export class MembersComponent implements OnInit {
|
||||
this.setFilterForm();
|
||||
|
||||
this.data.getServerFromRoute(this.route).then(server => {
|
||||
this.server = server;
|
||||
this.spinner.showSpinner();
|
||||
this.data.query<LevelListQuery>(Queries.levelQuery, {
|
||||
filter: {
|
||||
server: { id: server.id }
|
||||
}
|
||||
serverId: server.id
|
||||
},
|
||||
(data: Query) => {
|
||||
return data.servers[0];
|
||||
}
|
||||
).subscribe(data => {
|
||||
this.levels = data.levels.map(level => {
|
||||
@ -116,7 +119,10 @@ export class MembersComponent implements OnInit {
|
||||
this.spinner.showSpinner();
|
||||
this.loading = true;
|
||||
this.data.query<UserListQuery>(Queries.usersQuery, {
|
||||
filter: this.filter, page: this.page, sort: this.sort
|
||||
serverId: this.server.id, filter: this.filter, page: this.page, sort: this.sort
|
||||
},
|
||||
(x: { servers: Server[] }) => {
|
||||
return x.servers[0];
|
||||
}
|
||||
).subscribe(data => {
|
||||
this.totalRecords = data.userCount;
|
||||
|
@ -9,6 +9,7 @@ import { UserDTO } from "../../../../models/auth/auth-user.dto";
|
||||
import { AuthService } from "src/app/services/auth/auth.service";
|
||||
import { ToastService } from "src/app/services/toast/toast.service";
|
||||
import { TranslateService } from "@ngx-translate/core";
|
||||
import { Server } from "../../../../models/data/server.model";
|
||||
|
||||
@Component({
|
||||
selector: "app-profile",
|
||||
@ -18,6 +19,7 @@ import { TranslateService } from "@ngx-translate/core";
|
||||
export class ProfileComponent implements OnInit {
|
||||
|
||||
user: User = { createdAt: "", modifiedAt: "" };
|
||||
private server: Server = {};
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
@ -36,6 +38,7 @@ export class ProfileComponent implements OnInit {
|
||||
this.router.navigate([`/server/${server.id}`]);
|
||||
return;
|
||||
}
|
||||
this.server = server;
|
||||
|
||||
let authUser = await this.auth.getLoggedInUser();
|
||||
this.spinner.showSpinner();
|
||||
@ -47,16 +50,20 @@ export class ProfileComponent implements OnInit {
|
||||
return;
|
||||
}
|
||||
|
||||
this.data.query<User>(Queries.singleUserQuery, {
|
||||
this.data.query<UserListQuery>(Queries.usersQuery, {
|
||||
serverId: this.server.id,
|
||||
filter: {
|
||||
id: this.route.snapshot.params["memberId"]
|
||||
}
|
||||
},
|
||||
function(data: UserListQuery) {
|
||||
return data.users.length > 0 ? data.users[0] : null;
|
||||
(x: { servers: Server[] }) => {
|
||||
return x.servers[0];
|
||||
}
|
||||
).subscribe(user => {
|
||||
this.user = user;
|
||||
).subscribe(users => {
|
||||
if (!users.users[0]) {
|
||||
this.router.navigate([`/server/${server.id}`]);
|
||||
}
|
||||
this.user = users.users[0];
|
||||
this.spinner.hideSpinner();
|
||||
});
|
||||
});
|
||||
|
@ -3,7 +3,7 @@
|
||||
"WebVersion": {
|
||||
"Major": "1",
|
||||
"Minor": "0",
|
||||
"Micro": "dev133"
|
||||
"Micro": "dev220"
|
||||
},
|
||||
"Themes": [
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user