MCPcopy Create free account
hub / github.com/daodst/chat / InsertChainData

Function InsertChainData

clientapi/routing/profile.go:39–63  ·  view source on GitHub ↗

InsertChainData implements POST /local/insert/chainData

(
	req *http.Request, profileAPI userapi.ClientUserAPI,
)

Source from the content-addressed store, hash-verified

37
38// InsertChainData implements POST /local/insert/chainData
39func InsertChainData(
40 req *http.Request, profileAPI userapi.ClientUserAPI,
41) util.JSONResponse {
42 var r types.UserChainInfo
43 if resErr := httputil.UnmarshalJSONRequest(req, &r); resErr != nil {
44 return *resErr
45 }
46 if r.Localpart == "" {
47 return util.JSONResponse{
48 Code: http.StatusBadRequest,
49 JSON: jsonerror.BadJSON("'localpart' must be supplied."),
50 }
51 }
52 err := profileAPI.InsertChainData(req.Context(), r.Localpart, r.Servername, r.ChatFee, r.MortgageFee)
53 if err != nil {
54 return util.JSONResponse{
55 Code: http.StatusBadRequest,
56 JSON: jsonerror.BadJSON("InsertChainData err."),
57 }
58 }
59 return util.JSONResponse{
60 Code: http.StatusOK,
61 JSON: struct{}{},
62 }
63}
64
65// InsertRelationInvite implements POST /local/insert/relationInvite
66func InsertRelationInvite(

Callers 1

SetupFunction · 0.85

Calls 2

ContextMethod · 0.80
InsertChainDataMethod · 0.65

Tested by

no test coverage detected