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

Add CRUD survey apis. #22

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

Add CRUD survey apis. #22

wants to merge 2 commits into from

Conversation

abtin81badie
Copy link
Contributor

Create, Get, Update, Delete survey.

@abtin81badie abtin81badie requested a review from Hossara December 4, 2024 16:58
@abtin81badie abtin81badie self-assigned this Dec 4, 2024
Copy link
Contributor

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 {
Copy link
Contributor

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
Copy link
Contributor

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) {
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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 != "" {
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

نام گذاری فایل ها رو هم از رو من ببین تغییر بده که یکدست باشیم. من دارم طبق استاندارد دارا میزنم

Copy link
Contributor

@Hossara Hossara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

کامنت ها رو بخون تغییراتت رو پوش کن بهم خبر بده دوباره چکش کنم دمت گرم خسته نباشی

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants