✨ Realm avatar, banner and access policy
This commit is contained in:
parent
582e6cdb61
commit
313f6b8d4f
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="dataSourceStorageLocal" created-in="GO-242.21829.165">
|
<component name="dataSourceStorageLocal" created-in="GO-242.21829.220">
|
||||||
<data-source name="hy_passport@localhost" uuid="74bcf3ef-a2b9-435b-b9e5-f32902a33b25">
|
<data-source name="hy_passport@localhost" uuid="74bcf3ef-a2b9-435b-b9e5-f32902a33b25">
|
||||||
<database-info product="PostgreSQL" version="16.3 (Homebrew)" jdbc-version="4.2" driver-name="PostgreSQL JDBC Driver" driver-version="42.6.0" dbms="POSTGRES" exact-version="16.3" exact-driver-version="42.6">
|
<database-info product="PostgreSQL" version="16.3 (Homebrew)" jdbc-version="4.2" driver-name="PostgreSQL JDBC Driver" driver-version="42.6.0" dbms="POSTGRES" exact-version="16.3" exact-driver-version="42.6">
|
||||||
<identifier-quote-string>"</identifier-quote-string>
|
<identifier-quote-string>"</identifier-quote-string>
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
<option name="autoReloadType" value="ALL" />
|
<option name="autoReloadType" value="ALL" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Fix daily sign batch list query issue">
|
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Fix daily sign random panic">
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.local.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/sign.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/sign.go" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/pkg/internal/models/realms.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/models/realms.go" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/realms_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/realms_api.go" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -112,8 +114,8 @@
|
|||||||
<component name="SharedIndexes">
|
<component name="SharedIndexes">
|
||||||
<attachedChunks>
|
<attachedChunks>
|
||||||
<set>
|
<set>
|
||||||
<option value="bundled-gosdk-5df93f7ad4aa-df9ad98b711f-org.jetbrains.plugins.go.sharedIndexes.bundled-GO-242.21829.165" />
|
<option value="bundled-gosdk-5df93f7ad4aa-df9ad98b711f-org.jetbrains.plugins.go.sharedIndexes.bundled-GO-242.21829.220" />
|
||||||
<option value="bundled-js-predefined-d6986cc7102b-7c0b70fcd90d-JavaScript-GO-242.21829.165" />
|
<option value="bundled-js-predefined-d6986cc7102b-7c0b70fcd90d-JavaScript-GO-242.21829.220" />
|
||||||
</set>
|
</set>
|
||||||
</attachedChunks>
|
</attachedChunks>
|
||||||
</component>
|
</component>
|
||||||
@ -153,7 +155,6 @@
|
|||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value=":arrow_up: Implement list user relative grpc function" />
|
|
||||||
<MESSAGE value=":alien: Change avatar and banner id to string" />
|
<MESSAGE value=":alien: Change avatar and banner id to string" />
|
||||||
<MESSAGE value=":card_file_box: Update modeling" />
|
<MESSAGE value=":card_file_box: Update modeling" />
|
||||||
<MESSAGE value=":sparkles: Bot token aka. API token" />
|
<MESSAGE value=":sparkles: Bot token aka. API token" />
|
||||||
@ -178,7 +179,8 @@
|
|||||||
<MESSAGE value=":bug: Fix auto maintain range missing models" />
|
<MESSAGE value=":bug: Fix auto maintain range missing models" />
|
||||||
<MESSAGE value=":bug: Fix date formatting issue on daily signing" />
|
<MESSAGE value=":bug: Fix date formatting issue on daily signing" />
|
||||||
<MESSAGE value=":bug: Fix daily sign batch list query issue" />
|
<MESSAGE value=":bug: Fix daily sign batch list query issue" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix daily sign batch list query issue" />
|
<MESSAGE value=":bug: Fix daily sign random panic" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix daily sign random panic" />
|
||||||
</component>
|
</component>
|
||||||
<component name="VgoProject">
|
<component name="VgoProject">
|
||||||
<settings-migrated>true</settings-migrated>
|
<settings-migrated>true</settings-migrated>
|
||||||
|
@ -1,15 +1,20 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
|
import "gorm.io/datatypes"
|
||||||
|
|
||||||
type Realm struct {
|
type Realm struct {
|
||||||
BaseModel
|
BaseModel
|
||||||
|
|
||||||
Alias string `json:"alias" gorm:"uniqueIndex"`
|
Alias string `json:"alias" gorm:"uniqueIndex"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
Members []RealmMember `json:"members"`
|
Members []RealmMember `json:"members"`
|
||||||
IsPublic bool `json:"is_public"`
|
Avatar *string `json:"avatar"`
|
||||||
IsCommunity bool `json:"is_community"`
|
Banner *string `json:"banner"`
|
||||||
AccountID uint `json:"account_id"`
|
AccessPolicy datatypes.JSONMap `json:"access_policy"`
|
||||||
|
IsPublic bool `json:"is_public"`
|
||||||
|
IsCommunity bool `json:"is_community"`
|
||||||
|
AccountID uint `json:"account_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RealmMember struct {
|
type RealmMember struct {
|
||||||
|
@ -57,11 +57,14 @@ func createRealm(c *fiber.Ctx) error {
|
|||||||
user := c.Locals("user").(models.Account)
|
user := c.Locals("user").(models.Account)
|
||||||
|
|
||||||
var data struct {
|
var data struct {
|
||||||
Alias string `json:"alias" validate:"required,lowercase,min=4,max=32"`
|
Alias string `json:"alias" validate:"required,lowercase,min=4,max=32"`
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
IsPublic bool `json:"is_public"`
|
Avatar *string `json:"avatar"`
|
||||||
IsCommunity bool `json:"is_community"`
|
Banner *string `json:"banner"`
|
||||||
|
AccessPolicy map[string]any `json:"access_policy"`
|
||||||
|
IsPublic bool `json:"is_public"`
|
||||||
|
IsCommunity bool `json:"is_community"`
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := exts.BindAndValidate(c, &data); err != nil {
|
if err := exts.BindAndValidate(c, &data); err != nil {
|
||||||
@ -69,12 +72,15 @@ func createRealm(c *fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
realm, err := services.NewRealm(models.Realm{
|
realm, err := services.NewRealm(models.Realm{
|
||||||
Alias: data.Alias,
|
Alias: data.Alias,
|
||||||
Name: data.Name,
|
Name: data.Name,
|
||||||
Description: data.Description,
|
Description: data.Description,
|
||||||
IsPublic: data.IsPublic,
|
Avatar: data.Avatar,
|
||||||
IsCommunity: data.IsCommunity,
|
Banner: data.Banner,
|
||||||
AccountID: user.ID,
|
AccessPolicy: data.AccessPolicy,
|
||||||
|
IsPublic: data.IsPublic,
|
||||||
|
IsCommunity: data.IsCommunity,
|
||||||
|
AccountID: user.ID,
|
||||||
}, user)
|
}, user)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -91,11 +97,14 @@ func editRealm(c *fiber.Ctx) error {
|
|||||||
id, _ := c.ParamsInt("realmId", 0)
|
id, _ := c.ParamsInt("realmId", 0)
|
||||||
|
|
||||||
var data struct {
|
var data struct {
|
||||||
Alias string `json:"alias" validate:"required,lowercase,min=4,max=32"`
|
Alias string `json:"alias" validate:"required,lowercase,min=4,max=32"`
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
IsPublic bool `json:"is_public"`
|
Avatar *string `json:"avatar"`
|
||||||
IsCommunity bool `json:"is_community"`
|
Banner *string `json:"banner"`
|
||||||
|
AccessPolicy map[string]any `json:"access_policy"`
|
||||||
|
IsPublic bool `json:"is_public"`
|
||||||
|
IsCommunity bool `json:"is_community"`
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := exts.BindAndValidate(c, &data); err != nil {
|
if err := exts.BindAndValidate(c, &data); err != nil {
|
||||||
@ -113,6 +122,9 @@ func editRealm(c *fiber.Ctx) error {
|
|||||||
realm.Alias = data.Alias
|
realm.Alias = data.Alias
|
||||||
realm.Name = data.Name
|
realm.Name = data.Name
|
||||||
realm.Description = data.Description
|
realm.Description = data.Description
|
||||||
|
realm.Avatar = data.Avatar
|
||||||
|
realm.Banner = data.Banner
|
||||||
|
realm.AccessPolicy = data.AccessPolicy
|
||||||
realm.IsPublic = data.IsPublic
|
realm.IsPublic = data.IsPublic
|
||||||
realm.IsCommunity = data.IsCommunity
|
realm.IsCommunity = data.IsCommunity
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user