Skip to content

Commit

Permalink
fix: Update format. (#107)
Browse files Browse the repository at this point in the history
Signed-off-by: IRONICBo <[email protected]>
  • Loading branch information
IRONICBo authored Jul 14, 2023
1 parent b576718 commit 173795e
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion server/internal/dal/gen/sys_community.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions server/internal/models/base/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
8 changes: 4 additions & 4 deletions server/internal/models/base/user_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
4 changes: 2 additions & 2 deletions server/internal/models/system_roles/sys_bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions server/internal/models/system_roles/sys_customer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down
6 changes: 3 additions & 3 deletions server/internal/models/system_roles/sys_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions server/internal/params/request/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
4 changes: 2 additions & 2 deletions server/internal/params/request/community.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
12 changes: 6 additions & 6 deletions server/internal/params/request/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
4 changes: 2 additions & 2 deletions server/pkg/openim/param/request/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
6 changes: 3 additions & 3 deletions server/pkg/openim/param/request/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
17 changes: 10 additions & 7 deletions web/src/views/login/components/LoginHeader.vue
Original file line number Diff line number Diff line change
@@ -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 = () => {
Expand All @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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);
}
}
Expand Down
7 changes: 3 additions & 4 deletions web/src/views/login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down

0 comments on commit 173795e

Please sign in to comment.