|
|
@ -1,17 +1,4 @@
|
|
|
|
import * as sqz from "sequelize";
|
|
|
|
import {BelongsTo, BelongsToMany, Column, ForeignKey, Model, NotNull, Table,} from "sequelize-typescript";
|
|
|
|
import {
|
|
|
|
|
|
|
|
BelongsTo,
|
|
|
|
|
|
|
|
BelongsToMany,
|
|
|
|
|
|
|
|
Column,
|
|
|
|
|
|
|
|
CreatedAt, ForeignKey,
|
|
|
|
|
|
|
|
HasMany,
|
|
|
|
|
|
|
|
Model,
|
|
|
|
|
|
|
|
NotNull,
|
|
|
|
|
|
|
|
Table,
|
|
|
|
|
|
|
|
Unique,
|
|
|
|
|
|
|
|
UpdatedAt,
|
|
|
|
|
|
|
|
} from "sequelize-typescript";
|
|
|
|
|
|
|
|
import {ChatMessage} from "./ChatMessage";
|
|
|
|
|
|
|
|
import {ChatRoom} from "./ChatRoom";
|
|
|
|
import {ChatRoom} from "./ChatRoom";
|
|
|
|
import {GroupAdmin} from "./GroupAdmin";
|
|
|
|
import {GroupAdmin} from "./GroupAdmin";
|
|
|
|
import {GroupMember} from "./GroupMember";
|
|
|
|
import {GroupMember} from "./GroupMember";
|
|
|
@ -20,7 +7,7 @@ import {User} from "./User";
|
|
|
|
@Table({underscored: true})
|
|
|
|
@Table({underscored: true})
|
|
|
|
export class Group extends Model<Group> {
|
|
|
|
export class Group extends Model<Group> {
|
|
|
|
@NotNull
|
|
|
|
@NotNull
|
|
|
|
@Column( {allowNull: false})
|
|
|
|
@Column({allowNull: false})
|
|
|
|
public name: string;
|
|
|
|
public name: string;
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
@NotNull
|
|
|
@ -53,7 +40,7 @@ export class Group extends Model<Group> {
|
|
|
|
return await this.$get("rAdmins") as User[];
|
|
|
|
return await this.$get("rAdmins") as User[];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async members({first, offset}: {first: number, offset: number}): Promise<User[]> {
|
|
|
|
public async members({first, offset}: { first: number, offset: number }): Promise<User[]> {
|
|
|
|
const limit = first || 10;
|
|
|
|
const limit = first || 10;
|
|
|
|
offset = offset || 0;
|
|
|
|
offset = offset || 0;
|
|
|
|
return await this.$get("rMembers", {limit, offset}) as User[];
|
|
|
|
return await this.$get("rMembers", {limit, offset}) as User[];
|
|
|
|