Skip to content

Create endpoint for matching #1

@habibadoum

Description

@habibadoum

User story : As a female student looking for a safe and supportive way to find new friends
Acceptance criteria : Given I have created a profile without specifying my gender,

User story : I want to connect with other students in a secure and moderated environment, without being courted or judged for my looks
Acceptance criteria : When I match with someone based on their interests only and not their gender or looks

User story : so that I can build meaningful connections, without the barrier of appearance.
Acceptance criteria : Then I can interact with my chosen and matched new friends, and benefit from a moderated environment that promotes respectful interactions.

Logique avant la création des handlers :

Summary : je suis une femme, j'ai créé mon compte sans avoir spécifié mon genre. Je veux matcher avec d'autres personnes en me basant uniquement sur les intérêts en commun sans prise en compte du genre et de l'apparence physique.

Logique d'implémentation :

  • Création d'un profile sans spécification de genre : le models.User doit avoir un champ optionnel pour le genre ou un tag anonymous par exemple.
  • Pour ce cas d'usage, les genres et les photos ne devront pas apparaître lors de la suggestion des amies (lors des swipes).
  • Partie matching : suggestion d'amis basés uniquement sur les intérêts en commun (sans prise en compte du genre).

Partie technique :

  • Modifier models.User afin d'avoir l'attribut genre optionel. (Potentiellement ajouter un attribut pour l'ajout ou nom de la photo)
  • Mettre à jour l'handler CreateUser pour la prise en compte du genre (et de la photo) optionel.
  • Créer un handler MatchUsersByInterest : en entrée, on aurait les intérêts de l'utilisateur, passer cela à l'algo de matchig et avoir en sortie la liste des potentiels matchs.

Package models

type User struct {
    Name      string   `json:"name"`
    Age       int      `json:"age,gt=0"`
    Gender    *string  `json:"gender,omitempty"` // Optional gender field
    Interests []string `json:"interests,omitempty"` // List of interests
}
func CreateUser () {}

func MatchUsersByInterest () {}

Dans la partie utils : créer FindMatchesByInterests qui sera utiliser par le handler.

// CreateUser godoc
// @Summary Create a new user
// @Description Adds a new user to the database
// @Tags users
// @Accept  json
// @Produce  json
// @Param user body models.User required "User info"
// @Success 201 {object} models.User
// @Failure 400 {object} 
// @Router /users [post]
func CreateUser(ctx *gin.Context) {
    // ... handler implementation
}

// MatchUsersByInterest godoc
// @Summary Match users by interests
// @Description Finds and returns users with matching interests
// @Tags users
// @Accept  json
// @Produce  json
// @Param userID path int true "User ID"
// @Success 200 {array} models.User
// @Failure 400 {object} 
// @Router /users/match [get]
func MatchUsersByInterest(ctx *gin.Context) {
    // ... handler implementation
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions