Browse Source

fix: Update format. (#107)

Signed-off-by: IRONICBo <47499836+IRONICBo@users.noreply.github.com>
tags/v0.1.2
Asklv GitHub 3 years ago
parent
commit
173795ea75
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 48 additions and 45 deletions
  1. +1
    -1
      Makefile
  2. +2
    -1
      server/internal/dal/gen/sys_community.gen.go
  3. +2
    -2
      server/internal/models/base/model.go
  4. +4
    -4
      server/internal/models/base/user_base.go
  5. +2
    -2
      server/internal/models/system_roles/sys_bot.go
  6. +3
    -3
      server/internal/models/system_roles/sys_customer.go
  7. +3
    -3
      server/internal/models/system_roles/sys_user.go
  8. +5
    -5
      server/internal/params/request/bot.go
  9. +2
    -2
      server/internal/params/request/community.go
  10. +6
    -6
      server/internal/params/request/user.go
  11. +2
    -2
      server/pkg/openim/param/request/auth.go
  12. +3
    -3
      server/pkg/openim/param/request/user.go
  13. +10
    -7
      web/src/views/login/components/LoginHeader.vue
  14. +3
    -4
      web/src/views/login/index.vue

+ 1
- 1
Makefile View File

@@ -253,7 +253,7 @@ format: tools.verify.golines tools.verify.goimports
@echo "===========> Formating codes"
@$(FIND) -type f -name '*.go' | $(XARGS) gofmt -s -w
@$(FIND) -type f -name '*.go' | $(XARGS) $(TOOLS_DIR)/goimports -w -local $(ROOT_PACKAGE)
@$(FIND) -type f -name '*.go' | $(XARGS) $(TOOLS_DIR)/golines -w --max-len=120 --reformat-tags --shorten-comments --ignore-generated .
@$(FIND) -type f -name '*.go' | $(XARGS) $(TOOLS_DIR)/golines -w --max-len=200 --reformat-tags --shorten-comments --ignore-generated .
@cd $(SERVER_DIR) && $(GO) mod edit -fmt

## updates: Check for updates to go.mod dependencies


+ 2
- 1
server/internal/dal/gen/sys_community.gen.go View File

@@ -7,11 +7,12 @@ package gen
import (
"context"

systemroles "github.com/OpenIMSDK/OpenKF/server/internal/models/system_roles"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"

systemroles "github.com/OpenIMSDK/OpenKF/server/internal/models/system_roles"

"gorm.io/gen"
"gorm.io/gen/field"



+ 2
- 2
server/internal/models/base/model.go View File

@@ -20,8 +20,8 @@ import (

// Model base model.
type Model struct {
Id uint `json:"id" gorm:"column:id;primary_key;auto_increment" `
Id uint `json:"id" gorm:"column:id;primary_key;auto_increment"`
CreatedAt *time.Time `json:"created_at" gorm:"column:created_at"`
UpdatedAt *time.Time `json:"updated_at" gorm:"column:updated_at"`
DeletedAt *time.Time `json:"deleted_at" sql:"index" gorm:"column:deleted_at"`
DeletedAt *time.Time `json:"deleted_at" gorm:"column:deleted_at" sql:"index"`
}

+ 4
- 4
server/internal/models/base/user_base.go View File

@@ -20,9 +20,9 @@ import "github.com/gofrs/uuid"
type UserBase struct {
Model

UUID uuid.UUID `json:"uuid" gorm:"index;type:varchar(36);not null;comment:UUID"`
Email string `json:"email" gorm:"type:varchar(255);not null;unique;comment:Email"`
UUID uuid.UUID `json:"uuid" gorm:"index;type:varchar(36);not null;comment:UUID"`
Email string `json:"email" gorm:"type:varchar(255);not null;unique;comment:Email"`
Nickname string `json:"nickname" gorm:"type:varchar(20);not null;comment:Nickname"`
Avatar string `json:"avatar" gorm:"type:varchar(255);not null;comment:Avatar"`
IsEnable bool `json:"enable" gorm:"type:tinyint(1);not null;default:1;comment:IsEnable,1:enable,0:disable"`
Avatar string `json:"avatar" gorm:"type:varchar(255);not null;comment:Avatar"`
IsEnable bool `json:"enable" gorm:"type:tinyint(1);not null;default:1;comment:IsEnable,1:enable,0:disable"`
}

+ 2
- 2
server/internal/models/system_roles/sys_bot.go View File

@@ -27,8 +27,8 @@ type SysBot struct {
BotToken string `gorm:"column:bot_token;type:varchar(255);not null;comment:'AI bot token'"`
Nickname string `gorm:"column:nickname;type:varchar(255);not null;comment:'AI bot nickname'"`
Avatar string `gorm:"column:avatar;type:varchar(255);not null;comment:'AI bot avatar'"`
CommunityId uint `json:"community_id" gorm:"index;column:community_id;type:int(11);not null;comment:'Community id'"`
Community SysCommunity `json:"community" gorm:"foreignKey:CommunityId;"`
CommunityId uint `gorm:"index;column:community_id;type:int(11);not null;comment:'Community id'" json:"community_id"`
Community SysCommunity `gorm:"foreignKey:CommunityId;" json:"community"`
}

// TableName table name.


+ 3
- 3
server/internal/models/system_roles/sys_customer.go View File

@@ -22,9 +22,9 @@ import (
type SysCustomer struct {
base.UserBase

Device string `gorm:"column:device;type:varchar(255);not null;default:'';comment:'Customer device'" json:"device"`
IPAddress string `gorm:"column:ip_address;type:varchar(255);not null;default:'';comment:'Customer IP address'" json:"ip_address"`
Source string `gorm:"column:source;type:varchar(255);not null;default:'';comment:'Visitor source'" json:"source"`
Device string `gorm:"column:device;type:varchar(255);not null;default:'';comment:'Customer device'" json:"device"`
IPAddress string `gorm:"column:ip_address;type:varchar(255);not null;default:'';comment:'Customer IP address'" json:"ip_address"`
Source string `gorm:"column:source;type:varchar(255);not null;default:'';comment:'Visitor source'" json:"source"`
SourceType int `gorm:"column:source_type;type:int(11);not null;default:0;comment:'Visitor type, 0:web, 1: slack'" json:"source_type"`
}



+ 3
- 3
server/internal/models/system_roles/sys_user.go View File

@@ -22,10 +22,10 @@ import (
type SysUser struct {
base.UserBase

IsAdmin bool `json:"is_admin" gorm:"index;column:is_admin;type:tinyint(1);not null;default:0;comment:'Is admin'"`
Password string `json:"-" gorm:"type:varchar(64);not null;comment:Password"`
IsAdmin bool `json:"is_admin" gorm:"index;column:is_admin;type:tinyint(1);not null;default:0;comment:'Is admin'"`
Password string `json:"-" gorm:"type:varchar(64);not null;comment:Password"`
CommunityId uint `json:"community_id" gorm:"column:community_id;type:int(11);not null;comment:'Community id'"`
Community SysCommunity `json:"community" gorm:"foreignKey:CommunityId;"`
Community SysCommunity `json:"community" gorm:"foreignKey:CommunityId;"`
}

// TableName table name.


+ 5
- 5
server/internal/params/request/bot.go View File

@@ -16,10 +16,10 @@ package requestparams

// RegisterBotParams register params for bot.
type RegisterBotParams struct {
BotAddr string `json:"bot_addr" binding:"required"`
BotPort int `json:"bot_port" binding:"required"`
BotToken string `json:"bot_token" binding:"required"`
Nickname string `json:"nickname" binding:"required"`
Avatar string `json:"avatar" binding:"required"`
BotAddr string `json:"bot_addr" binding:"required"`
BotPort int `json:"bot_port" binding:"required"`
BotToken string `json:"bot_token" binding:"required"`
Nickname string `json:"nickname" binding:"required"`
Avatar string `json:"avatar" binding:"required"`
CommunityId uint `json:"community_id" binding:"required"`
}

+ 2
- 2
server/internal/params/request/community.go View File

@@ -16,7 +16,7 @@ package requestparams

// CommunityParams register params for community.
type CommunityParams struct {
Name string `json:"name" binding:"required"`
Email string `json:"email" binding:"required"`
Name string `json:"name" binding:"required"`
Email string `json:"email" binding:"required"`
Avatar *string `json:"avatar" binding:"required"` // Avatar is optional.
}

+ 6
- 6
server/internal/params/request/user.go View File

@@ -16,27 +16,27 @@ package requestparams

// CreateUserParams register params for user.
type CreateUserParams struct {
Email string `json:"email" binding:"required"`
Email string `json:"email" binding:"required"`
Nickname string `json:"nickname" binding:"required"`
Avatar *string `json:"avatar" binding:"required"` // Avatar is optional.
Avatar *string `json:"avatar" binding:"required"` // Avatar is optional.
Password string `json:"password" binding:"required"`
}

// RegisterAdminParams register params for admin.
type RegisterAdminParams struct {
UserInfo CreateUserParams `json:"user_info" binding:"required"`
UserInfo CreateUserParams `json:"user_info" binding:"required"`
CommunityInfo CommunityParams `json:"community_info" binding:"required"`
Code string `json:"code" binding:"required"`
Code string `json:"code" binding:"required"`
}

// RegisterStaffParams register params for staff.
type RegisterStaffParams struct {
UserInfo CreateUserParams `json:"user_info" binding:"required"`
UserInfo CreateUserParams `json:"user_info" binding:"required"`
CommunityId uint `json:"community_id" binding:"required"`
}

// LoginParamsWithAccount login params.
type LoginParamsWithAccount struct {
Email string `json:"email" binding:"required"`
Email string `json:"email" binding:"required"`
Password string `json:"password" binding:"required"`
}

+ 2
- 2
server/pkg/openim/param/request/auth.go View File

@@ -16,7 +16,7 @@ package request

// UserTokenParams register admin params.
type UserTokenParams struct {
Secret string `json:"secret" binding:"required"`
Secret string `json:"secret" binding:"required"`
PlatformID uint `json:"platformID" binding:"required"`
UserID string `json:"userID" binding:"required"`
UserID string `json:"userID" binding:"required"`
}

+ 3
- 3
server/pkg/openim/param/request/user.go View File

@@ -17,12 +17,12 @@ package request
// RegisterUserParams register user params.
type RegisterUserParams struct {
Secret string `json:"secret" binding:"required"`
Users []User `json:"users" binding:"required"`
Users []User `json:"users" binding:"required"`
}

// User user.
type User struct {
UserID string `json:"userID" binding:"required"`
UserID string `json:"userID" binding:"required"`
Nickname string `json:"nickname" binding:"required"`
FaceURL string `json:"faceURL" binding:"required"`
FaceURL string `json:"faceURL" binding:"required"`
}

+ 10
- 7
web/src/views/login/components/LoginHeader.vue View File

@@ -1,6 +1,5 @@
<script setup lang="ts">
import { ref } from "vue";
import { CloseIcon, CheckIcon } from 'tdesign-icons-vue-next';
import { ref } from 'vue';
import OpenKFLogo from '@/assets/openkf-logo.svg?component';

const navToGitHub = () => {
@@ -13,13 +12,12 @@ const navToDoc = () => {

const darkMode = ref(false);
const emit = defineEmits<{
(e: 'changeMode', value: boolean): void
(e: 'changeMode', value: boolean): void;
}>();

const changeModeAction = () => {
emit('changeMode', darkMode.value);
emit('changeMode', darkMode.value);
};

</script>

<template>
@@ -46,7 +44,11 @@ const changeModeAction = () => {
<t-icon name="help-circle-filled" class="icon" />
</t-button>
<!-- Add theme tabs -->
<t-switch v-model="darkMode" size="small" @change="changeModeAction"></t-switch>
<t-switch
v-model="darkMode"
size="small"
@change="changeModeAction"
></t-switch>
</div>
</header>
</template>
@@ -87,7 +89,8 @@ const changeModeAction = () => {
.operations-container {
display: flex;
align-items: center;
.t-button, .t-switch {
.t-button,
.t-switch {
margin-left: var(--td-comp-margin-l);
}
}


+ 3
- 4
web/src/views/login/index.vue View File

@@ -12,19 +12,18 @@ const switchType = (val: string) => {
};
const changeMode = (value: boolean) => {
console.log(value);
isDark.value = value
isDark.value = value;
if (isDark.value) {
document.documentElement.setAttribute('theme-mode', 'dark');
} else {
document.documentElement.setAttribute('theme-mode', 'light');
}
}

};
</script>

<template>
<div :class="[isDark ? 'dark' : 'light', 'login-wrapper']">
<login-header @change-mode="changeMode"/>
<login-header @change-mode="changeMode" />

<div class="login-container">
<div class="title-container">


Loading…
Cancel
Save