-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add CRUD survey apis. #22
base: dev
Are you sure you want to change the base?
Conversation
api/http/dto/create_survey.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implement this part using presenter arch
https://github.com/babyhando/sample-service/tree/main/api/http/handlers/presenter
|
||
var validate = validator.New() | ||
|
||
type SurveyHandler struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
این چیه ؟
var validate = validator.New() | ||
|
||
type SurveyHandler struct { | ||
service port.Service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
پورت توی هندلر چیکار میکنه. مگه پورت ریپو توی سرویس ها استفاده نمیشد؟ سرویس ها هم از طریق appContainer اینجکت میشد تو هندلر ها؟
مثال کد های منو ببین
} | ||
} | ||
|
||
func (h *SurveyHandler) RegisterRoutes(api fiber.Router) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
api group?
accountGroup := router.Group("/account")
accountGroup.Post("/login", Login(appContainer, cfg))
accountGroup.Post("/register", Register)
accountGroup.Post("/verify-otp", VerifyOtp(appContainer, cfg))
accountGroup.Post("/reset-password", ResetPassword)
accountGroup.Post("/reset-password/verify", ResetPasswordVerify)
) | ||
|
||
type Survey struct { | ||
ID uint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
مشخصه هایی که خودشون به خودی خود یه ماهیت جداگانه دارن مثل id باید براشون تایپ جدا تعریف بشه
ID uint | ||
Title string | ||
CreationTime time.Time | ||
StartTime *time.Time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
پوینتر چرا ؟
NumParticipationAttempts int | ||
ResponseTime int // in seconds | ||
AnonymityLevel string | ||
OwnerID uint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
اینم همینطور. باید بری از دامین user بری UserID رو برداری بیاری
} | ||
|
||
// Merge existing and updated survey data | ||
if survey.Title != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
اینجا راه بهتر برای پیاده سازی این لاجیک هست. از GPT کمک بگیر
@@ -0,0 +1,58 @@ | |||
// pkg/adapters/storage/survey_repository.go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
نام گذاری فایل ها رو هم از رو من ببین تغییر بده که یکدست باشیم. من دارم طبق استاندارد دارا میزنم
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
کامنت ها رو بخون تغییراتت رو پوش کن بهم خبر بده دوباره چکش کنم دمت گرم خسته نباشی
Create, Get, Update, Delete survey.