Skip to content

Conversation

@shay23b
Copy link
Contributor

@shay23b shay23b commented Oct 21, 2022

No description provided.

}

type EditTagsSchema struct {
TagsToAdd []Tag `json:"tags_to_add"`
Copy link
Contributor

Choose a reason for hiding this comment

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

this is edit so why tags to add

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's edit tags of entity - you get an array of tags to add and array of tags to remove - I'll change it to EditTagsListSchema

models/tags.go Outdated
}

type GetTagsByEntityNameSchema struct {
EntityType string `json:"entity_type"`
Copy link
Contributor

Choose a reason for hiding this comment

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

if this is by name so why type is also a parameter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

schema, station and user can all have the same name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but this endpoint not in use - I deleted it

Copy link
Contributor

Choose a reason for hiding this comment

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

I saw this endpoint is still here, should it be?

Copy link
Contributor

@avrhamNeeman avrhamNeeman left a comment

Choose a reason for hiding this comment

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

I will continue tomorrow.

models/tags.go Outdated
}

type GetTagsByEntityNameSchema struct {
EntityType string `json:"entity_type"`
Copy link
Contributor

Choose a reason for hiding this comment

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

I saw this endpoint is still here, should it be?

}
return nil
}
_, err = tagsCollection.UpdateOne(context.TODO(), bson.M{"_id": tag.ID}, bson.M{"$addToSet": bson.M{"stations": entity_id}})
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use updateOne with upsert intead of calling isExist & createTag.

After changing please ensure everything still works as expected and remove createTag function/isExist function in case no other functions use them

return nil
}

func DeleteTagsByStation(id primitive.ObjectID) {
Copy link
Contributor

Choose a reason for hiding this comment

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

change to deleteTagsFromStation and I think it not has to start with capital letter.
Check all function inside this file and change where needed

}
}

func DeleteTagsBySchema(id primitive.ObjectID) {
Copy link
Contributor

Choose a reason for hiding this comment

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

change to deleteTagsFromSchema

}
_, err = tagsCollection.UpdateOne(context.TODO(), bson.M{"_id": tag.ID},
bson.M{"$pull": bson.M{"stations": station.ID}})
_, err = tagsCollection.UpdateOne(context.TODO(), bson.M{"_id": tagToAdd.ID}, bson.M{"$addToSet": bson.M{entityDBList: body.EntityID}})
Copy link
Contributor

Choose a reason for hiding this comment

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

do the same here as we spoke with the upsert

border-bottom: 2px solid rgba(74, 73, 92, 0.8);
border-right: 2px solid rgba(74, 73, 92, 0.8);
}
.no-checkmark {
Copy link
Contributor

Choose a reason for hiding this comment

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

Talk to me about it

@avrhamNeeman avrhamNeeman merged commit e06aca5 into master Oct 26, 2022
@shay23b shay23b deleted the tagsFront branch October 27, 2022 10:20
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.

5 participants