mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-08 19:16:35 +08:00
feat: v2 to v3 data conversion (#1164)
* fix: user update group notification, group member face url * fix: user update group notification, group member face url * feat: v2 to v3 data conversion * feat: v2 to v3 data conversion
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
// Copyright © 2023 OpenIM open source community. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package admin
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Admin 后台管理员.
|
||||
type Admin struct {
|
||||
Account string `gorm:"column:account;primary_key;type:varchar(64)"`
|
||||
Password string `gorm:"column:password;type:varchar(64)"`
|
||||
FaceURL string `gorm:"column:face_url;type:varchar(255)"`
|
||||
Nickname string `gorm:"column:nickname;type:varchar(64)"`
|
||||
UserID string `gorm:"column:user_id;type:varchar(64)"` // openIM userID
|
||||
Level int32 `gorm:"column:level;default:1" `
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
}
|
||||
|
||||
func (Admin) TableName() string {
|
||||
return "admins"
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright © 2023 OpenIM open source community. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package admin
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Applet struct {
|
||||
ID string `gorm:"column:id;primary_key;size:64"`
|
||||
Name string `gorm:"column:name;size:64"`
|
||||
AppID string `gorm:"column:app_id;uniqueIndex;size:255"`
|
||||
Icon string `gorm:"column:icon;size:255"`
|
||||
URL string `gorm:"column:url;size:255"`
|
||||
MD5 string `gorm:"column:md5;size:255"`
|
||||
Size int64 `gorm:"column:size"`
|
||||
Version string `gorm:"column:version;size:64"`
|
||||
Priority uint32 `gorm:"column:priority;size:64"`
|
||||
Status uint8 `gorm:"column:status"`
|
||||
CreateTime time.Time `gorm:"column:create_time;autoCreateTime;size:64"`
|
||||
}
|
||||
|
||||
func (Applet) TableName() string {
|
||||
return "applets"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// Copyright © 2023 OpenIM open source community. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package admin
|
||||
|
||||
// ClientConfig 客户端相关配置项.
|
||||
type ClientConfig struct {
|
||||
Key string `gorm:"column:key;primary_key;type:varchar(255)"`
|
||||
Value string `gorm:"column:value;not null;type:text"`
|
||||
}
|
||||
|
||||
func (ClientConfig) TableName() string {
|
||||
return "client_config"
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Copyright © 2023 OpenIM open source community. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package admin
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// ForbiddenAccount 封号表.
|
||||
type ForbiddenAccount struct {
|
||||
UserID string `gorm:"column:user_id;index:userID;primary_key;type:char(64)"`
|
||||
Reason string `gorm:"column:reason;type:varchar(255)" `
|
||||
OperatorUserID string `gorm:"column:operator_user_id;type:varchar(255)"`
|
||||
CreateTime time.Time `gorm:"column:create_time" `
|
||||
}
|
||||
|
||||
func (ForbiddenAccount) TableName() string {
|
||||
return "forbidden_accounts"
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright © 2023 OpenIM open source community. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package admin
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// 邀请码被注册使用.
|
||||
type InvitationRegister struct {
|
||||
InvitationCode string `gorm:"column:invitation_code;primary_key;type:char(32)"`
|
||||
UsedByUserID string `gorm:"column:user_id;index:userID;type:char(64)"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
}
|
||||
|
||||
func (InvitationRegister) TableName() string {
|
||||
return "invitation_registers"
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Copyright © 2023 OpenIM open source community. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package admin
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// 禁止ip登录 注册.
|
||||
type IPForbidden struct {
|
||||
IP string `gorm:"column:ip;primary_key;type:char(32)"`
|
||||
LimitRegister bool `gorm:"column:limit_register"`
|
||||
LimitLogin bool `gorm:"column:limit_login"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
}
|
||||
|
||||
func (IPForbidden) TableName() string {
|
||||
return "ip_forbiddens"
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright © 2023 OpenIM open source community. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package admin
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// 限制userID只能在某些ip登录.
|
||||
type LimitUserLoginIP struct {
|
||||
UserID string `gorm:"column:user_id;primary_key;type:char(64)"`
|
||||
IP string `gorm:"column:ip;primary_key;type:char(32)"`
|
||||
CreateTime time.Time `gorm:"column:create_time" `
|
||||
}
|
||||
|
||||
func (LimitUserLoginIP) TableName() string {
|
||||
return "limit_user_login_ips"
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright © 2023 OpenIM open source community. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package admin
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// RegisterAddFriend 注册时默认好友.
|
||||
type RegisterAddFriend struct {
|
||||
UserID string `gorm:"column:user_id;primary_key;type:char(64)"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
}
|
||||
|
||||
func (RegisterAddFriend) TableName() string {
|
||||
return "register_add_friends"
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright © 2023 OpenIM open source community. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package admin
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// RegisterAddGroup 注册时默认群组.
|
||||
type RegisterAddGroup struct {
|
||||
GroupID string `gorm:"column:group_id;primary_key;type:char(64)"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
}
|
||||
|
||||
func (RegisterAddGroup) TableName() string {
|
||||
return "register_add_groups"
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Copyright © 2023 OpenIM open source community. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package chat
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Account 账号密码表.
|
||||
type Account struct {
|
||||
UserID string `gorm:"column:user_id;primary_key;type:char(64)"`
|
||||
Password string `gorm:"column:password;type:varchar(32)"`
|
||||
CreateTime time.Time `gorm:"column:create_time;autoCreateTime"`
|
||||
ChangeTime time.Time `gorm:"column:change_time;autoUpdateTime"`
|
||||
OperatorUserID string `gorm:"column:operator_user_id;type:varchar(64)"`
|
||||
}
|
||||
|
||||
func (Account) TableName() string {
|
||||
return "accounts"
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright © 2023 OpenIM open source community. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package chat
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Attribute 用户属性表.
|
||||
type Attribute struct {
|
||||
UserID string `gorm:"column:user_id;primary_key;type:char(64)"`
|
||||
Account string `gorm:"column:account;type:char(64)"`
|
||||
PhoneNumber string `gorm:"column:phone_number;type:varchar(32)"`
|
||||
AreaCode string `gorm:"column:area_code;type:varchar(8)"`
|
||||
Email string `gorm:"column:email;type:varchar(64)" `
|
||||
Nickname string `gorm:"column:nickname;type:varchar(64)" `
|
||||
FaceURL string `gorm:"column:face_url;type:varchar(255)" `
|
||||
Gender int32 `gorm:"column:gender"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
ChangeTime time.Time `gorm:"column:change_time"`
|
||||
BirthTime time.Time `gorm:"column:birth_time"`
|
||||
Level int32 `gorm:"column:level;default:1"`
|
||||
AllowVibration int32 `gorm:"column:allow_vibration;default:1"`
|
||||
AllowBeep int32 `gorm:"column:allow_beep;default:1"`
|
||||
AllowAddFriend int32 `gorm:"column:allow_add_friend;default:1"`
|
||||
GlobalRecvMsgOpt int32 `gorm:"column:global_recv_msg_opt;default:0"`
|
||||
}
|
||||
|
||||
func (Attribute) TableName() string {
|
||||
return "attributes"
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Copyright © 2023 OpenIM open source community. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package chat
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Register 注册信息表.
|
||||
type Register struct {
|
||||
UserID string `gorm:"column:user_id;primary_key;type:char(64)"`
|
||||
DeviceID string `gorm:"column:device_id;type:varchar(255)"`
|
||||
IP string `gorm:"column:ip;type:varchar(64)"`
|
||||
Platform string `gorm:"column:platform;type:varchar(32)"`
|
||||
AccountType string `gorm:"column:account_type;type:varchar(32)"` // email phone account
|
||||
Mode string `gorm:"column:mode;type:varchar(32)"` // user admin
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
}
|
||||
|
||||
func (Register) TableName() string {
|
||||
return "registers"
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Copyright © 2023 OpenIM open source community. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package chat
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// 用户登录信息表.
|
||||
type UserLoginRecord struct {
|
||||
UserID string `gorm:"column:user_id;size:64"`
|
||||
LoginTime time.Time `gorm:"column:login_time"`
|
||||
IP string `gorm:"column:ip;type:varchar(32)"`
|
||||
DeviceID string `gorm:"column:device_id;type:varchar(255)"`
|
||||
Platform string `gorm:"column:platform;type:varchar(32)"`
|
||||
}
|
||||
|
||||
func (UserLoginRecord) TableName() string {
|
||||
return "user_login_records"
|
||||
}
|
||||
Reference in New Issue
Block a user