1
0

test cors

This commit is contained in:
syui 2023-08-12 00:03:24 +09:00
parent 433959a932
commit bdab76bb35
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
4 changed files with 15 additions and 15 deletions

View File

@ -88,7 +88,7 @@ var (
{Name: "ten_post", Type: field.TypeString, Nullable: true}, {Name: "ten_post", Type: field.TypeString, Nullable: true},
{Name: "ten_get", Type: field.TypeString, Nullable: true}, {Name: "ten_get", Type: field.TypeString, Nullable: true},
{Name: "ten_at", Type: field.TypeTime, Nullable: true}, {Name: "ten_at", Type: field.TypeTime, Nullable: true},
{Name: "next", Type: field.TypeString, Nullable: true, Default: "20230811"}, {Name: "next", Type: field.TypeString, Nullable: true, Default: "20230812"},
{Name: "group_users", Type: field.TypeInt, Nullable: true}, {Name: "group_users", Type: field.TypeInt, Nullable: true},
} }
// UsersTable holds the schema information for the "users" table. // UsersTable holds the schema information for the "users" table.

View File

@ -374,7 +374,7 @@ func encodeDrawStartResponse(response *DrawStartNoContent, w http.ResponseWriter
} }
func encodeListCardResponse(response ListCardRes, w http.ResponseWriter, span trace.Span) error { func encodeListCardResponse(response ListCardRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai") w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
switch response := response.(type) { switch response := response.(type) {
case *ListCardOKApplicationJSON: case *ListCardOKApplicationJSON:
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
@ -576,7 +576,7 @@ func encodeListGroupUsersResponse(response ListGroupUsersRes, w http.ResponseWri
} }
func encodeListUserResponse(response ListUserRes, w http.ResponseWriter, span trace.Span) error { func encodeListUserResponse(response ListUserRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai") w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
switch response := response.(type) { switch response := response.(type) {
case *ListUserOKApplicationJSON: case *ListUserOKApplicationJSON:
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
@ -644,7 +644,7 @@ func encodeListUserResponse(response ListUserRes, w http.ResponseWriter, span tr
} }
func encodeListUserCardResponse(response ListUserCardRes, w http.ResponseWriter, span trace.Span) error { func encodeListUserCardResponse(response ListUserCardRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai") w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
switch response := response.(type) { switch response := response.(type) {
case *ListUserCardOKApplicationJSON: case *ListUserCardOKApplicationJSON:
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
@ -712,7 +712,7 @@ func encodeListUserCardResponse(response ListUserCardRes, w http.ResponseWriter,
} }
func encodeReadCardResponse(response ReadCardRes, w http.ResponseWriter, span trace.Span) error { func encodeReadCardResponse(response ReadCardRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai") w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
switch response := response.(type) { switch response := response.(type) {
case *CardRead: case *CardRead:
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
@ -780,7 +780,7 @@ func encodeReadCardResponse(response ReadCardRes, w http.ResponseWriter, span tr
} }
func encodeReadCardOwnerResponse(response ReadCardOwnerRes, w http.ResponseWriter, span trace.Span) error { func encodeReadCardOwnerResponse(response ReadCardOwnerRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai") w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
switch response := response.(type) { switch response := response.(type) {
case *CardOwnerRead: case *CardOwnerRead:
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
@ -915,7 +915,7 @@ func encodeReadGroupResponse(response ReadGroupRes, w http.ResponseWriter, span
} }
func encodeReadUserResponse(response ReadUserRes, w http.ResponseWriter, span trace.Span) error { func encodeReadUserResponse(response ReadUserRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai") w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
switch response := response.(type) { switch response := response.(type) {
case *UserRead: case *UserRead:
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")

View File

@ -185,8 +185,8 @@ func (h *OgentHandler) UpdateCard(ctx context.Context, req *UpdateCardReq, param
// DeleteCard handles DELETE /cards/{id} requests. // DeleteCard handles DELETE /cards/{id} requests.
func (h *OgentHandler) DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error) { func (h *OgentHandler) DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error) {
//err := h.client.Card.DeleteOneID(0).Exec(ctx) err := h.client.Card.DeleteOneID(0).Exec(ctx)
err := h.client.Card.DeleteOneID(params.ID).Exec(ctx) //err := h.client.Card.DeleteOneID(params.ID).Exec(ctx)
if err != nil { if err != nil {
switch { switch {
case ent.IsNotFound(err): case ent.IsNotFound(err):

View File

@ -374,7 +374,7 @@ func encodeDrawStartResponse(response *DrawStartNoContent, w http.ResponseWriter
} }
func encodeListCardResponse(response ListCardRes, w http.ResponseWriter, span trace.Span) error { func encodeListCardResponse(response ListCardRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai") w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
switch response := response.(type) { switch response := response.(type) {
case *ListCardOKApplicationJSON: case *ListCardOKApplicationJSON:
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
@ -576,7 +576,7 @@ func encodeListGroupUsersResponse(response ListGroupUsersRes, w http.ResponseWri
} }
func encodeListUserResponse(response ListUserRes, w http.ResponseWriter, span trace.Span) error { func encodeListUserResponse(response ListUserRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai") w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
switch response := response.(type) { switch response := response.(type) {
case *ListUserOKApplicationJSON: case *ListUserOKApplicationJSON:
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
@ -644,7 +644,7 @@ func encodeListUserResponse(response ListUserRes, w http.ResponseWriter, span tr
} }
func encodeListUserCardResponse(response ListUserCardRes, w http.ResponseWriter, span trace.Span) error { func encodeListUserCardResponse(response ListUserCardRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai") w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
switch response := response.(type) { switch response := response.(type) {
case *ListUserCardOKApplicationJSON: case *ListUserCardOKApplicationJSON:
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
@ -712,7 +712,7 @@ func encodeListUserCardResponse(response ListUserCardRes, w http.ResponseWriter,
} }
func encodeReadCardResponse(response ReadCardRes, w http.ResponseWriter, span trace.Span) error { func encodeReadCardResponse(response ReadCardRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai") w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
switch response := response.(type) { switch response := response.(type) {
case *CardRead: case *CardRead:
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
@ -780,7 +780,7 @@ func encodeReadCardResponse(response ReadCardRes, w http.ResponseWriter, span tr
} }
func encodeReadCardOwnerResponse(response ReadCardOwnerRes, w http.ResponseWriter, span trace.Span) error { func encodeReadCardOwnerResponse(response ReadCardOwnerRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai") w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
switch response := response.(type) { switch response := response.(type) {
case *CardOwnerRead: case *CardOwnerRead:
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
@ -915,7 +915,7 @@ func encodeReadGroupResponse(response ReadGroupRes, w http.ResponseWriter, span
} }
func encodeReadUserResponse(response ReadUserRes, w http.ResponseWriter, span trace.Span) error { func encodeReadUserResponse(response ReadUserRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai") w.Header().Set("Access-Control-Allow-Origin", "https://*.syui.ai")
switch response := response.(type) { switch response := response.(type) {
case *UserRead: case *UserRead:
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")