Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

题解评论区功能后端,添加相应字段与接口 #129

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .minio.sys/buckets/.bloomcycle.bin
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"1.0.2","checksum":{"algorithm":"","blocksize":0,"hashes":null},"meta":{"etag":"24875af2ad02c0be3096aa4475889d38"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"1.0.2","checksum":{"algorithm":"","blocksize":0,"hashes":null},"meta":{"etag":"a43ee200a9b5b13ca89d536328b55eb0"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"1.0.2","checksum":{"algorithm":"","blocksize":0,"hashes":null},"meta":{"etag":"b0f726419ecd7eeb85e584ba57d77b7f"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"1.0.2","checksum":{"algorithm":"","blocksize":0,"hashes":null},"meta":{"etag":"e7546e8e99df0980c20811145ef54c51"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"1.0.2","checksum":{"algorithm":"","blocksize":0,"hashes":null},"meta":{"etag":"5111bcbd33222bfbdd82354c36cc0337"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"1.0.2","checksum":{"algorithm":"","blocksize":0,"hashes":null},"meta":{"etag":"4c19a1f21a85db0bc7b89e0fcfe39191"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"1.0.2","checksum":{"algorithm":"","blocksize":0,"hashes":null},"meta":{"etag":"eddb3a38ec980fb5bf0afedd7bd482c5"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"1.0.2","checksum":{"algorithm":"","blocksize":0,"hashes":null},"meta":{"etag":"38c1017dea279b7022faa23459828676"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"1.0.2","checksum":{"algorithm":"","blocksize":0,"hashes":null},"meta":{"etag":"53e9679469590a412cf8ef076841e1dc"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"1.0.2","checksum":{"algorithm":"","blocksize":0,"hashes":null},"meta":{"etag":"d74225a715028548a67b160bbcc00244"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"1.0.2","checksum":{"algorithm":"","blocksize":0,"hashes":null},"meta":{"etag":"c52a3c6609fb5daa573eb326389aaae1"}}
Binary file added .minio.sys/buckets/.tracker.bin
Binary file not shown.
Binary file added .minio.sys/buckets/.usage-cache.bin
Binary file not shown.
1 change: 1 addition & 0 deletions .minio.sys/buckets/.usage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"lastUpdate":"2022-08-27T21:11:14.1118762+08:00","objectsCount":151,"objectsTotalSize":61095515,"objectsReplicationInfo":null,"bucketsCount":10,"bucketsUsageInfo":{"app":{"size":60755226,"objectsPendingReplicationTotalSize":0,"objectsFailedReplicationTotalSize":0,"objectsReplicatedTotalSize":0,"objectsPendingReplicationCount":0,"objectsFailedReplicationCount":0,"objectsCount":77,"objectsSizesHistogram":{"BETWEEN_1024_B_AND_1_MB":56,"BETWEEN_10_MB_AND_64_MB":1,"BETWEEN_128_MB_AND_512_MB":0,"BETWEEN_1_MB_AND_10_MB":0,"BETWEEN_64_MB_AND_128_MB":0,"GREATER_THAN_512_MB":0,"LESS_THAN_1024_B":20},"objectReplicaTotalSize":0,"objectsReplicationInfo":{}},"base":{"size":129938,"objectsPendingReplicationTotalSize":0,"objectsFailedReplicationTotalSize":0,"objectsReplicatedTotalSize":0,"objectsPendingReplicationCount":0,"objectsFailedReplicationCount":0,"objectsCount":38,"objectsSizesHistogram":{"BETWEEN_1024_B_AND_1_MB":28,"BETWEEN_10_MB_AND_64_MB":0,"BETWEEN_128_MB_AND_512_MB":0,"BETWEEN_1_MB_AND_10_MB":0,"BETWEEN_64_MB_AND_128_MB":0,"GREATER_THAN_512_MB":0,"LESS_THAN_1024_B":10},"objectReplicaTotalSize":0,"objectsReplicationInfo":{}},"database":{"size":104362,"objectsPendingReplicationTotalSize":0,"objectsFailedReplicationTotalSize":0,"objectsReplicatedTotalSize":0,"objectsPendingReplicationCount":0,"objectsFailedReplicationCount":0,"objectsCount":25,"objectsSizesHistogram":{"BETWEEN_1024_B_AND_1_MB":14,"BETWEEN_10_MB_AND_64_MB":0,"BETWEEN_128_MB_AND_512_MB":0,"BETWEEN_1_MB_AND_10_MB":0,"BETWEEN_64_MB_AND_128_MB":0,"GREATER_THAN_512_MB":0,"LESS_THAN_1024_B":11},"objectReplicaTotalSize":0,"objectsReplicationInfo":{}},"docs":{"size":93002,"objectsPendingReplicationTotalSize":0,"objectsFailedReplicationTotalSize":0,"objectsReplicatedTotalSize":0,"objectsPendingReplicationCount":0,"objectsFailedReplicationCount":0,"objectsCount":3,"objectsSizesHistogram":{"BETWEEN_1024_B_AND_1_MB":3,"BETWEEN_10_MB_AND_64_MB":0,"BETWEEN_128_MB_AND_512_MB":0,"BETWEEN_1_MB_AND_10_MB":0,"BETWEEN_64_MB_AND_128_MB":0,"GREATER_THAN_512_MB":0,"LESS_THAN_1024_B":0},"objectReplicaTotalSize":0,"objectsReplicationInfo":{}},"event":{"size":2852,"objectsPendingReplicationTotalSize":0,"objectsFailedReplicationTotalSize":0,"objectsReplicatedTotalSize":0,"objectsPendingReplicationCount":0,"objectsFailedReplicationCount":0,"objectsCount":7,"objectsSizesHistogram":{"BETWEEN_1024_B_AND_1_MB":1,"BETWEEN_10_MB_AND_64_MB":0,"BETWEEN_128_MB_AND_512_MB":0,"BETWEEN_1_MB_AND_10_MB":0,"BETWEEN_64_MB_AND_128_MB":0,"GREATER_THAN_512_MB":0,"LESS_THAN_1024_B":6},"objectReplicaTotalSize":0,"objectsReplicationInfo":{}},"images":{"size":0,"objectsPendingReplicationTotalSize":0,"objectsFailedReplicationTotalSize":0,"objectsReplicatedTotalSize":0,"objectsPendingReplicationCount":0,"objectsFailedReplicationCount":0,"objectsCount":0,"objectsSizesHistogram":{"BETWEEN_1024_B_AND_1_MB":0,"BETWEEN_10_MB_AND_64_MB":0,"BETWEEN_128_MB_AND_512_MB":0,"BETWEEN_1_MB_AND_10_MB":0,"BETWEEN_64_MB_AND_128_MB":0,"GREATER_THAN_512_MB":0,"LESS_THAN_1024_B":0},"objectReplicaTotalSize":0,"objectsReplicationInfo":null},"problems":{"size":0,"objectsPendingReplicationTotalSize":0,"objectsFailedReplicationTotalSize":0,"objectsReplicatedTotalSize":0,"objectsPendingReplicationCount":0,"objectsFailedReplicationCount":0,"objectsCount":0,"objectsSizesHistogram":{"BETWEEN_1024_B_AND_1_MB":0,"BETWEEN_10_MB_AND_64_MB":0,"BETWEEN_128_MB_AND_512_MB":0,"BETWEEN_1_MB_AND_10_MB":0,"BETWEEN_64_MB_AND_128_MB":0,"GREATER_THAN_512_MB":0,"LESS_THAN_1024_B":0},"objectReplicaTotalSize":0,"objectsReplicationInfo":null},"scripts":{"size":0,"objectsPendingReplicationTotalSize":0,"objectsFailedReplicationTotalSize":0,"objectsReplicatedTotalSize":0,"objectsPendingReplicationCount":0,"objectsFailedReplicationCount":0,"objectsCount":0,"objectsSizesHistogram":{"BETWEEN_1024_B_AND_1_MB":0,"BETWEEN_10_MB_AND_64_MB":0,"BETWEEN_128_MB_AND_512_MB":0,"BETWEEN_1_MB_AND_10_MB":0,"BETWEEN_64_MB_AND_128_MB":0,"GREATER_THAN_512_MB":0,"LESS_THAN_1024_B":0},"objectReplicaTotalSize":0,"objectsReplicationInfo":null},"submissions":{"size":0,"objectsPendingReplicationTotalSize":0,"objectsFailedReplicationTotalSize":0,"objectsReplicatedTotalSize":0,"objectsPendingReplicationCount":0,"objectsFailedReplicationCount":0,"objectsCount":0,"objectsSizesHistogram":{"BETWEEN_1024_B_AND_1_MB":0,"BETWEEN_10_MB_AND_64_MB":0,"BETWEEN_128_MB_AND_512_MB":0,"BETWEEN_1_MB_AND_10_MB":0,"BETWEEN_64_MB_AND_128_MB":0,"GREATER_THAN_512_MB":0,"LESS_THAN_1024_B":0},"objectReplicaTotalSize":0,"objectsReplicationInfo":null},"template":{"size":10135,"objectsPendingReplicationTotalSize":0,"objectsFailedReplicationTotalSize":0,"objectsReplicatedTotalSize":0,"objectsPendingReplicationCount":0,"objectsFailedReplicationCount":0,"objectsCount":1,"objectsSizesHistogram":{"BETWEEN_1024_B_AND_1_MB":1,"BETWEEN_10_MB_AND_64_MB":0,"BETWEEN_128_MB_AND_512_MB":0,"BETWEEN_1_MB_AND_10_MB":0,"BETWEEN_64_MB_AND_128_MB":0,"GREATER_THAN_512_MB":0,"LESS_THAN_1024_B":0},"objectReplicaTotalSize":0,"objectsReplicationInfo":{}}},"bucketsSizes":null}
Binary file added .minio.sys/buckets/app/.usage-cache.bin
Binary file not shown.
Binary file added .minio.sys/buckets/base/.usage-cache.bin
Binary file not shown.
Binary file added .minio.sys/buckets/database/.usage-cache.bin
Binary file not shown.
Binary file added .minio.sys/buckets/docs/.usage-cache.bin
Binary file not shown.
Binary file added .minio.sys/buckets/event/.usage-cache.bin
Binary file not shown.
Binary file added .minio.sys/buckets/images/.metadata.bin
Binary file not shown.
Binary file added .minio.sys/buckets/images/.usage-cache.bin
Binary file not shown.
Binary file added .minio.sys/buckets/problems/.metadata.bin
Binary file not shown.
Binary file added .minio.sys/buckets/problems/.usage-cache.bin
Binary file not shown.
Binary file added .minio.sys/buckets/scripts/.metadata.bin
Binary file not shown.
Binary file added .minio.sys/buckets/scripts/.usage-cache.bin
Binary file not shown.
Binary file added .minio.sys/buckets/submissions/.metadata.bin
Binary file not shown.
Binary file added .minio.sys/buckets/submissions/.usage-cache.bin
Binary file not shown.
Binary file added .minio.sys/buckets/template/.usage-cache.bin
Binary file not shown.
1 change: 1 addition & 0 deletions .minio.sys/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"api":{"_":[{"key":"requests_max","value":"0"},{"key":"requests_deadline","value":"10s"},{"key":"cluster_deadline","value":"10s"},{"key":"cors_allow_origin","value":"*"},{"key":"remote_transport_deadline","value":"2h"},{"key":"list_quorum","value":"strict"},{"key":"replication_workers","value":"250"},{"key":"replication_failed_workers","value":"8"},{"key":"transition_workers","value":"100"},{"key":"stale_uploads_cleanup_interval","value":"6h"},{"key":"stale_uploads_expiry","value":"24h"},{"key":"delete_cleanup_interval","value":"5m"},{"key":"disable_odirect","value":"off"}]},"audit_kafka":{"_":[{"key":"enable","value":"off"},{"key":"topic","value":""},{"key":"brokers","value":""},{"key":"sasl_username","value":""},{"key":"sasl_password","value":""},{"key":"sasl_mechanism","value":"plain"},{"key":"client_tls_cert","value":""},{"key":"client_tls_key","value":""},{"key":"tls_client_auth","value":"0"},{"key":"sasl","value":"off"},{"key":"tls","value":"off"},{"key":"tls_skip_verify","value":"off"},{"key":"version","value":""}]},"audit_webhook":{"_":[{"key":"enable","value":"off"},{"key":"endpoint","value":""},{"key":"auth_token","value":""},{"key":"client_cert","value":""},{"key":"client_key","value":""},{"key":"queue_size","value":"100000"}]},"cache":{"_":[{"key":"drives","value":""},{"key":"exclude","value":""},{"key":"expiry","value":"90"},{"key":"quota","value":"80"},{"key":"after","value":"0"},{"key":"watermark_low","value":"70"},{"key":"watermark_high","value":"80"},{"key":"range","value":"on"},{"key":"commit","value":""}]},"compression":{"_":[{"key":"enable","value":"off"},{"key":"allow_encryption","value":"off"},{"key":"extensions","value":".txt,.log,.csv,.json,.tar,.xml,.bin"},{"key":"mime_types","value":"text/*,application/json,application/xml,binary/octet-stream"}]},"credentials":{"_":[{"key":"access_key","value":"minioadmin"},{"key":"secret_key","value":"minioadmin"}]},"etcd":{"_":[{"key":"endpoints","value":""},{"key":"path_prefix","value":""},{"key":"coredns_path","value":"/skydns"},{"key":"client_cert","value":""},{"key":"client_cert_key","value":""}]},"heal":{"_":[{"key":"bitrotscan","value":"off"},{"key":"max_sleep","value":"1s"},{"key":"max_io","value":"100"}]},"identity_ldap":{"_":[{"key":"server_addr","value":""},{"key":"user_dn_search_base_dn","value":""},{"key":"user_dn_search_filter","value":""},{"key":"group_search_filter","value":""},{"key":"group_search_base_dn","value":""},{"key":"tls_skip_verify","value":"off"},{"key":"server_insecure","value":"off"},{"key":"server_starttls","value":"off"},{"key":"lookup_bind_dn","value":""},{"key":"lookup_bind_password","value":""}]},"identity_openid":{"_":[{"key":"config_url","value":""},{"key":"client_id","value":""},{"key":"client_secret","value":""},{"key":"claim_name","value":"policy"},{"key":"claim_userinfo","value":""},{"key":"role_policy","value":""},{"key":"claim_prefix","value":""},{"key":"redirect_uri","value":""},{"key":"redirect_uri_dynamic","value":"off"},{"key":"scopes","value":""}]},"identity_tls":{"_":[{"key":"skip_verify","value":"off"}]},"logger_webhook":{"_":[{"key":"enable","value":"off"},{"key":"endpoint","value":""},{"key":"auth_token","value":""},{"key":"client_cert","value":""},{"key":"client_key","value":""},{"key":"queue_size","value":"100000"}]},"notify_amqp":{"_":[{"key":"enable","value":"off"},{"key":"url","value":""},{"key":"exchange","value":""},{"key":"exchange_type","value":""},{"key":"routing_key","value":""},{"key":"mandatory","value":"off"},{"key":"durable","value":"off"},{"key":"no_wait","value":"off"},{"key":"internal","value":"off"},{"key":"auto_deleted","value":"off"},{"key":"delivery_mode","value":"0"},{"key":"publisher_confirms","value":"off"},{"key":"queue_limit","value":"0"},{"key":"queue_dir","value":""}]},"notify_elasticsearch":{"_":[{"key":"enable","value":"off"},{"key":"url","value":""},{"key":"format","value":"namespace"},{"key":"index","value":""},{"key":"queue_dir","value":""},{"key":"queue_limit","value":"0"},{"key":"username","value":""},{"key":"password","value":""}]},"notify_kafka":{"_":[{"key":"enable","value":"off"},{"key":"topic","value":""},{"key":"brokers","value":""},{"key":"sasl_username","value":""},{"key":"sasl_password","value":""},{"key":"sasl_mechanism","value":"plain"},{"key":"client_tls_cert","value":""},{"key":"client_tls_key","value":""},{"key":"tls_client_auth","value":"0"},{"key":"sasl","value":"off"},{"key":"tls","value":"off"},{"key":"tls_skip_verify","value":"off"},{"key":"queue_limit","value":"0"},{"key":"queue_dir","value":""},{"key":"version","value":""}]},"notify_mqtt":{"_":[{"key":"enable","value":"off"},{"key":"broker","value":""},{"key":"topic","value":""},{"key":"password","value":""},{"key":"username","value":""},{"key":"qos","value":"0"},{"key":"keep_alive_interval","value":"0s"},{"key":"reconnect_interval","value":"0s"},{"key":"queue_dir","value":""},{"key":"queue_limit","value":"0"}]},"notify_mysql":{"_":[{"key":"enable","value":"off"},{"key":"format","value":"namespace"},{"key":"dsn_string","value":""},{"key":"table","value":""},{"key":"queue_dir","value":""},{"key":"queue_limit","value":"0"},{"key":"max_open_connections","value":"2"}]},"notify_nats":{"_":[{"key":"enable","value":"off"},{"key":"address","value":""},{"key":"subject","value":""},{"key":"username","value":""},{"key":"password","value":""},{"key":"token","value":""},{"key":"tls","value":"off"},{"key":"tls_skip_verify","value":"off"},{"key":"cert_authority","value":""},{"key":"client_cert","value":""},{"key":"client_key","value":""},{"key":"ping_interval","value":"0"},{"key":"streaming","value":"off"},{"key":"streaming_async","value":"off"},{"key":"streaming_max_pub_acks_in_flight","value":"0"},{"key":"streaming_cluster_id","value":""},{"key":"queue_dir","value":""},{"key":"queue_limit","value":"0"}]},"notify_nsq":{"_":[{"key":"enable","value":"off"},{"key":"nsqd_address","value":""},{"key":"topic","value":""},{"key":"tls","value":"off"},{"key":"tls_skip_verify","value":"off"},{"key":"queue_dir","value":""},{"key":"queue_limit","value":"0"}]},"notify_postgres":{"_":[{"key":"enable","value":"off"},{"key":"format","value":"namespace"},{"key":"connection_string","value":""},{"key":"table","value":""},{"key":"queue_dir","value":""},{"key":"queue_limit","value":"0"},{"key":"max_open_connections","value":"2"}]},"notify_redis":{"_":[{"key":"enable","value":"off"},{"key":"format","value":"namespace"},{"key":"address","value":""},{"key":"key","value":""},{"key":"password","value":""},{"key":"queue_dir","value":""},{"key":"queue_limit","value":"0"}]},"notify_webhook":{"_":[{"key":"enable","value":"off"},{"key":"endpoint","value":""},{"key":"auth_token","value":""},{"key":"queue_limit","value":"0"},{"key":"queue_dir","value":""},{"key":"client_cert","value":""},{"key":"client_key","value":""}]},"policy_opa":{"_":[{"key":"url","value":""},{"key":"auth_token","value":""}]},"region":{"_":[{"key":"name","value":""}]},"scanner":{"_":[{"key":"delay","value":"10"},{"key":"max_wait","value":"15s"},{"key":"cycle","value":"1m"}]},"site":{"_":[{"key":"name","value":""},{"key":"region","value":""}]},"storage_class":{"_":null},"subnet":{"_":[{"key":"license","value":""},{"key":"api_key","value":""}]}}
1 change: 1 addition & 0 deletions .minio.sys/config/iam/format.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1}
1 change: 1 addition & 0 deletions .minio.sys/format.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"1","format":"fs","id":"6d992242-ba81-472d-bca5-0e3b5e7f298e","fs":{"version":"2"}}
140 changes: 140 additions & 0 deletions app/controller/solution.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
package controller

import (
"fmt"
"net/http"
"strconv"
"strings"

"github.com/EduOJ/backend/app/request"
"github.com/EduOJ/backend/app/response"
"github.com/EduOJ/backend/app/response/resource"
"github.com/EduOJ/backend/base"
"github.com/EduOJ/backend/base/utils"
"github.com/EduOJ/backend/database/models"
"github.com/labstack/echo/v4"
"github.com/pkg/errors"
"gorm.io/gorm"
)

func GetSolutions(c echo.Context) error {
req := request.GetSolutionsRequest{}
if err, ok := utils.BindAndValidate(&req, c); !ok {
return err
}

problemID, _ := strconv.ParseUint(req.ProblemID, 10, 64)
query := base.DB.Model(&models.Solution{}).Order("problem_id ASC").Where("problem_id = ?", problemID)
var solutions []*models.Solution

err := query.Find(&solutions).Error
if err != nil {
if herr, ok := err.(utils.HttpError); ok {
return herr.Response(c)
}
panic(err)
}

return c.JSON(http.StatusOK, response.GetSolutionsResponse{
Message: "SUCCESS",
Error: nil,
Data: struct {
Solutions []resource.Solution `json:"solutions"`
}{
Solutions: resource.GetSolutions(solutions),
},
})
}

func CreateSolution(c echo.Context) error {
req := request.CreateSolutionRequest{}
err, ok := utils.BindAndValidate(&req, c)
if !ok {
return err
}

solution := models.Solution{
ProblemID: req.ProblemID,
Name: req.Name,
Author: req.Author,
Description: req.Description,
Likes: "",
}
utils.PanicIfDBError(base.DB.Create(&solution), "could not create solution")

return c.JSON(http.StatusCreated, response.CreateSolutionResponse{
Message: "SUCCESS",
Error: nil,
Data: struct {
*resource.Solution `json:"solution"`
}{
resource.GetSolution(&solution),
},
})
}

func GetLikes(c echo.Context) error {
req := request.LikesRequest{}
err, ok := utils.BindAndValidate(&req, c)
if !ok {
return err
}
solution := models.Solution{}
query := base.DB.Model(&models.Solution{})
err = query.Where("id = ?", req.SolutionId).Find(&solution).Error
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return c.JSON(http.StatusNotFound, response.ErrorResp("NOT_FOUND", nil))
} else {
panic(errors.Wrap(err, "could not query solution"))
}
}
// err = query.Where("id = ?", req.SolutionId).Update("likes", "").Error
// fmt.Println(solution.Likes)
// "1,2,3,4"
likeList := strings.Split(solution.Likes, ",")
// likeList := strings.Split("2,3,4,", ",")
// fmt.Println(likeList)
count := len(likeList) - 1
isLike := false
// fmt.Println(count)
switch req.IsLike {
case 1:
newLikes := solution.Likes + fmt.Sprint(req.UserId) + ","
query.Where("id = ?", req.SolutionId).Update("likes", newLikes)
count = count + 1
isLike = true
// fmt.Println(newLikes)
case -1:
newLikes := strings.Replace(solution.Likes, fmt.Sprint(req.UserId)+",", "", -1)
query.Where("id = ?", req.SolutionId).Update("likes", newLikes)
count = count - 1
isLike = false
// fmt.Println(newLikes)

default:
for i := 0; i < count; i++ {
// fmt.Print(i)
// fmt.Print(": ")
// fmt.Println(likeList[i])
if fmt.Sprint(req.UserId) == likeList[i] {
isLike = true
}
}
}

likes := &models.Likes{
Count: count,
IsLike: isLike,
}

return c.JSON(http.StatusOK, response.GetLikesResponse{
Message: "SUCCESS",
Error: nil,
Data: struct {
Likes resource.Likes `json:"likes"`
}{
Likes: *resource.GetLikes(likes),
},
})
}
Loading