fixed: unnecessary information in project response

This commit is contained in:
naudachu 2023-11-24 14:54:20 +05:00
parent 86b00e03b6
commit e5feb56360
1 changed files with 19 additions and 9 deletions

View File

@ -2,6 +2,7 @@ package domain
import (
"fmt"
"strings"
"time"
)
@ -143,22 +144,31 @@ type Git struct {
type Project struct {
ID string `json:"id"` //15
ShortName string `json:"shortName"` //key-15
Key string `json:"shortName"` //key-15
Name string `json:"name"` //default project name
ChannelID string `json:"channel_id"` //123412341234
ProjectGit string `json:"project_git"` //https://github.com/mobilerino/dap-108
BuildGit string `json:"build_git"` //https://github.com/mobilerino/dap-108-build
Cloud string `json:"cloud"` //http://82.151.222.22:7000/f/86658
Folder string `json:"cloud"` //http://82.151.222.22:7000/f/86658
}
func (p *Project) DiscordString() string {
return fmt.Sprintf(
"## Project info:\n> 🔑 key: %s\n> 📂 folder: %s\n> 👾 project git: %s\n> 🚀 build git: %s\n",
p.ShortName,
p.Cloud,
p.ProjectGit,
p.BuildGit,
)
var builder strings.Builder
builder.WriteString(fmt.Sprintf("## Project `%s`:\n> 🔑 key: %s", p.Name, p.Key))
if p.Folder != "" {
builder.WriteString(fmt.Sprintf("\n> 📂 folder: %s", p.Folder))
}
if p.ProjectGit != "" {
builder.WriteString(fmt.Sprintf("\n> 👾 project git: %s", p.ProjectGit))
}
if p.BuildGit != "" {
builder.WriteString(fmt.Sprintf("\n> 🚀 build git: %s", p.BuildGit))
}
return builder.String()
}