Skip to content

Commit

Permalink
refact(model): media resource and user fields for brainx
Browse files Browse the repository at this point in the history
  • Loading branch information
Matrix-X committed Dec 3, 2024
1 parent 1fcb974 commit d97bd74
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 35 deletions.
15 changes: 8 additions & 7 deletions etc/powerx-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,17 @@ JWT:
OpenAPI:
platforms:
# 访问PowerX OpenAPI的restful 配置
brain_x:
access_key: "key_power_x"
secret_key: "123456789"
BrainX:
AccessKey: "key_power_x"
SecretKey: "123456789"

providers:
# 访问BrainX OpenAPI的restful 配置
brain_x:
base_url: "http://127.0.0.1:8000/openapi/v1"
access_key: "key_brain_x"
secret_key: '987654321'
BrainX:
BaseUrl: "http://127.0.0.1:8000/openapi/v1"
AccessKey: "key_brain_x"
SecretKey: '987654321'
ProviderName: 'powerx'

Casbin:
SelfHosted: true # 是否使用自己的Casbin服务
Expand Down
23 changes: 13 additions & 10 deletions internal/model/media/mediaresource.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ import (
"PowerX/internal/model"
"PowerX/internal/model/powermodel"
"PowerX/internal/types"
"github.com/google/uuid"
)

type MediaResource struct {
powermodel.PowerUUIDModel

CustomerId int64 `gorm:"comment:客户Id; index" json:"customerId"`
Filename string `gorm:"comment:名称" json:"filename"`
Size int64 `gorm:"comment:尺寸" json:"size"`
Width int64 `gorm:"comment:宽度" json:"width"`
Height int64 `gorm:"comment:长度" json:"height"`
Url string `gorm:"comment:url" json:"url"`
BucketName string `gorm:"comment:Bucket名称" json:"bucketName"`
IsLocalStored bool `gorm:"comment:是否本地存储" json:"isLocalStored"`
ContentType string `gorm:"comment:内容类型" json:"contentType"`
ResourceType string `gorm:"comment:媒体类型" json:"mediaType"`
TenantUUID uuid.UUID `gorm:"type:uuid;foreignKey:TenantUUID;references:UUID"`
CreatedUserBy uuid.UUID `gorm:"type:uuid;foreignKey:CreatedUserBy;references:UUID;not null"`
CustomerId int64 `gorm:"comment:客户Id; index" json:"customerId"`
Filename string `gorm:"comment:名称" json:"filename"`
Size int64 `gorm:"comment:尺寸" json:"size"`
Width int64 `gorm:"comment:宽度" json:"width"`
Height int64 `gorm:"comment:长度" json:"height"`
Url string `gorm:"comment:url" json:"url"`
BucketName string `gorm:"comment:Bucket名称" json:"bucketName"`
IsLocalStored bool `gorm:"comment:是否本地存储" json:"isLocalStored"`
ContentType string `gorm:"comment:内容类型" json:"contentType"`
ResourceType string `gorm:"comment:媒体类型" json:"mediaType"`
}

type MediaSet struct {
Expand Down
38 changes: 20 additions & 18 deletions internal/model/organization/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"PowerX/internal/model"
"PowerX/internal/model/powermodel"
"PowerX/pkg/securityx"
"github.com/google/uuid"
"github.com/pkg/errors"
"golang.org/x/crypto/bcrypt"
"gorm.io/gorm"
Expand All @@ -13,24 +14,25 @@ import (
type User struct {
powermodel.PowerUUIDModel

Account string `gorm:"comment:账户;column:account unique;type:varchar" json:"account"`
Name string `gorm:"comment:名称;column:name;type:varchar" json:"name"`
NickName string `gorm:"comment:别称;column:nick_name;type:varchar" json:"nick_name"`
Desc string `gorm:"comment:描述;column:desc" json:"desc"`
PositionID int64 `gorm:"comment:职位ID;column:position_id" json:"position_id"`
Position *Position
JobTitle string `gorm:"comment:职务;column:job_title;type:varchar" json:"job_title"`
DepartmentId int64 `gorm:"comment:部门ID;column:department_id" json:"department_id"`
MobilePhone string `gorm:"comment:电话;column:mobile_phone;type:varchar" json:"mobile_phone"`
Gender string `gorm:"comment:性别;column:gender;type:varchar" json:"gender"`
Email string `gorm:"comment:内部邮箱;column:email;type:varchar" json:"email"`
ExternalEmail string `gorm:"comment:外部邮箱;column:external_email;type:varchar" json:"external_email"`
Avatar string `gorm:"comment:图标;column:avatar;type:varchar" json:"avatar"`
Password string `gorm:"comment:密码;column:password;type:varchar" json:"password"`
Status string `gorm:"comment:状态;column:status;index;type:varchar" json:"status"`
IsReserved bool `gorm:"comment:保留字段;column:is_reserved" json:"is_reserved"`
IsActivated bool `gorm:"comment:活跃;column:is_activated" json:"is_activated"`
Department *Department
TenantOwnerUUID uuid.UUID `gorm:"type:uuid;foreignKey:TenantOwnerUUID;references:UUID" json:"tenant_owner_uuid"`
Account string `gorm:"comment:账户;column:account unique;type:varchar" json:"account"`
Name string `gorm:"comment:名称;column:name;type:varchar" json:"name"`
NickName string `gorm:"comment:别称;column:nick_name;type:varchar" json:"nick_name"`
Desc string `gorm:"comment:描述;column:desc" json:"desc"`
PositionID int64 `gorm:"comment:职位ID;column:position_id" json:"position_id"`
Position *Position
JobTitle string `gorm:"comment:职务;column:job_title;type:varchar" json:"job_title"`
DepartmentId int64 `gorm:"comment:部门ID;column:department_id" json:"department_id"`
MobilePhone string `gorm:"comment:电话;column:mobile_phone;type:varchar" json:"mobile_phone"`
Gender string `gorm:"comment:性别;column:gender;type:varchar" json:"gender"`
Email string `gorm:"comment:内部邮箱;column:email;type:varchar" json:"email"`
ExternalEmail string `gorm:"comment:外部邮箱;column:external_email;type:varchar" json:"external_email"`
Avatar string `gorm:"comment:图标;column:avatar;type:varchar" json:"avatar"`
Password string `gorm:"comment:密码;column:password;type:varchar" json:"password"`
Status string `gorm:"comment:状态;column:status;index;type:varchar" json:"status"`
IsReserved bool `gorm:"comment:保留字段;column:is_reserved" json:"is_reserved"`
IsActivated bool `gorm:"comment:活跃;column:is_activated" json:"is_activated"`
Department *Department
// comment f9280798048e034c1f4118a2220ade5f847d94b4 该字段不能设置为unique,否则没有关联企业微信账户的员工将会添加失败(null duplicate key)
WeWorkUserId string `gorm:"comment:微信账户;column:we_work_user_id;type:varchar" json:"we_work_user_id"`
}
Expand Down
Binary file added wechat/info-2024-10-30T14-25-47.066.log.gz
Binary file not shown.

0 comments on commit d97bd74

Please sign in to comment.