파일 업로드/삭제, maintenance 메뉴 추가

This commit is contained in:
2023-06-05 11:56:34 +09:00
parent 827abf34fe
commit 41387ba902
3 changed files with 199 additions and 73 deletions

View File

@ -172,16 +172,19 @@ type division struct {
Maintenance *maintenance `bson:",omitempty" json:",omitempty"`
}
type ServiceDescriptionSummary struct {
Id primitive.ObjectID `bson:"_id"`
ServiceName string `bson:"service"`
ServiceCode string `bson:"code"`
UseWhitelist bool `bson:"use_whitelist"`
Closed bool `bson:"closed"`
}
type serviceDescription struct {
// sync.Mutex
Id primitive.ObjectID `bson:"_id"`
ServiceName string `bson:"service"`
Divisions map[string]*division `bson:"divisions"`
ServiceCode string `bson:"code"`
UseWhitelist bool `bson:"use_whitelist"`
Closed bool `bson:"closed"`
ServerApiTokens []primitive.ObjectID `bson:"api_tokens"`
ApiUsers map[string][]string `bson:"api_users"`
ServiceDescriptionSummary `bson:",inline"`
Divisions map[string]*division `bson:"divisions"`
ServerApiTokens []primitive.ObjectID `bson:"api_tokens"`
ApiUsers map[string][]string `bson:"api_users"`
auths *common.AuthCollection
wl whitelist
@ -327,7 +330,7 @@ func (sh *serviceDescription) prepare(mg *Maingate) error {
mg.apiTokenToService.add(keyid.Hex(), sh.ServiceCode)
}
bt, _ := json.Marshal(sh)
bt, _ := json.Marshal(sh.ServiceDescriptionSummary)
atomic.StorePointer(&sh.serviceSerialized, unsafe.Pointer(&bt))
logger.Println("service is ready :", sh.ServiceName, sh.ServiceCode, sh.UseWhitelist, sh.ApiUsers, string(divmarshaled))