Unverified Commit 9fadf79b authored by Simon Esposito's avatar Simon Esposito Committed by GitHub
Browse files

Add Go runtime GroupUpdate userID param (#996)

parent 4f95134c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
- Improve graceful shutdown of Google IAP receipt processor.
- If In-App Purchases validation contain mismatching userIDs, do not return an error.
- Better handling of matchmaker operations while the interval process is running.
- Add userID param to Go runtime GroupUpdate function.

### Fixed
- Consistent validation of override operator in runtime leaderboard record writes.
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ require (
	github.com/gorilla/mux v1.8.0
	github.com/gorilla/websocket v1.5.0
	github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3
	github.com/heroiclabs/nakama-common v1.26.1-0.20230227112928-be92be890386
	github.com/heroiclabs/nakama-common v1.26.1-0.20230315184120-05f3d089030f
	github.com/jackc/pgconn v1.13.0
	github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa
	github.com/jackc/pgtype v1.12.0
+2 −2
+13 −3
Original line number Diff line number Diff line
@@ -3140,7 +3140,7 @@ func (n *RuntimeGoNakamaModule) GroupCreate(ctx context.Context, userID, name, c
// @summary Update a group with various configuration settings. The group which is updated can change some or all of its fields.
// @param ctx(type=context.Context) The context object represents information about the server and requester.
// @param groupId(type=string) The ID of the group to update.
// @param userId(type=string) User ID calling the update operation for permission checking. Set as nil to enact the changes as the system user.
// @param userId(type=string) User ID calling the update operation for permission checking. Set as empty string to enact the changes as the system user.
// @param name(type=string) Group name, can be empty if not changed.
// @param creatorId(type=string) The user ID to be associated as creator. Can be empty if not changed.
// @param langTag(type=string) Group language. Empty if not updated.
@@ -3150,12 +3150,22 @@ func (n *RuntimeGoNakamaModule) GroupCreate(ctx context.Context, userID, name, c
// @param metadata(type=map[string]interface{}) Custom information to store for this group. Use nil if field is not being updated.
// @param maxCount(type=int) Maximum number of members to have in the group. Use 0, nil/null if field is not being updated.
// @return error(error) An optional error value if an error occurred.
func (n *RuntimeGoNakamaModule) GroupUpdate(ctx context.Context, id, name, creatorID, langTag, description, avatarUrl string, open bool, metadata map[string]interface{}, maxCount int) error {
func (n *RuntimeGoNakamaModule) GroupUpdate(ctx context.Context, id, userID, name, creatorID, langTag, description, avatarUrl string, open bool, metadata map[string]interface{}, maxCount int) error {
	groupID, err := uuid.FromString(id)
	if err != nil {
		return errors.New("expects group ID to be a valid identifier")
	}

	var uid uuid.UUID
	if userID != "" {
		uid, err = uuid.FromString(userID)
		if err != nil {
			return errors.New("expects user ID to be a valid identifier")
		}
	} else {
		uid = uuid.Nil
	}

	var nameWrapper *wrapperspb.StringValue
	if name != "" {
		nameWrapper = &wrapperspb.StringValue{Value: name}
@@ -3196,7 +3206,7 @@ func (n *RuntimeGoNakamaModule) GroupUpdate(ctx context.Context, id, name, creat
		metadataWrapper = &wrapperspb.StringValue{Value: string(metadataBytes)}
	}

	return UpdateGroup(ctx, n.logger, n.db, groupID, uuid.Nil, creator, nameWrapper, langTagWrapper, descriptionWrapper, avatarURLWrapper, metadataWrapper, openWrapper, maxCount)
	return UpdateGroup(ctx, n.logger, n.db, groupID, uid, creator, nameWrapper, langTagWrapper, descriptionWrapper, avatarURLWrapper, metadataWrapper, openWrapper, maxCount)
}

// @group groups
+18 −18
Original line number Diff line number Diff line
@@ -42,9 +42,9 @@ message Account {
  repeated AccountDevice devices = 4;
  // The custom id in the user's account.
  string custom_id = 5;
  // The UNIX time when the user's email was verified.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the user's email was verified.
  google.protobuf.Timestamp verify_time = 6;
  // The UNIX time when the user's account was disabled/banned.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the user's account was disabled/banned.
  google.protobuf.Timestamp disable_time = 7;
}

@@ -298,9 +298,9 @@ message ChannelMessage {
  string username = 5;
  // The content payload.
  string content = 6;
  // The UNIX time when the message was created.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was created.
  google.protobuf.Timestamp create_time = 7;
  // The UNIX time when the message was last updated.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was last updated.
  google.protobuf.Timestamp update_time = 8;
  // True if the message was persisted to the channel's history, false otherwise.
  google.protobuf.BoolValue persistent = 9;
@@ -470,9 +470,9 @@ message Group {
  int32 edge_count = 9;
  // The maximum number of members allowed.
  int32 max_count = 10;
  // The UNIX time when the group was created.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the group was created.
  google.protobuf.Timestamp create_time = 11;
  // The UNIX time when the group was last updated.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the group was last updated.
  google.protobuf.Timestamp update_time = 12;
}

@@ -562,7 +562,7 @@ message Leaderboard {
  uint32 next_reset = 5;
  // Additional information stored as a JSON object.
  string metadata = 6;
  // The UNIX time when the leaderboard was created.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the leaderboard was created.
  google.protobuf.Timestamp create_time = 7;
  // Whether the leaderboard was created authoritatively or not.
  bool authoritative = 8;
@@ -592,11 +592,11 @@ message LeaderboardRecord {
  int32 num_score = 6;
  // Metadata.
  string metadata = 7;
  // The UNIX time when the leaderboard record was created.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the leaderboard record was created.
  google.protobuf.Timestamp create_time = 8;
  // The UNIX time when the leaderboard record was updated.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the leaderboard record was updated.
  google.protobuf.Timestamp update_time = 9;
  // The UNIX time when the leaderboard record expires.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the leaderboard record expires.
  google.protobuf.Timestamp expiry_time = 10;
  // The rank of this record.
  int64 rank = 11;
@@ -850,7 +850,7 @@ message Notification {
  int32 code = 4;
  // ID of the sender, if a user. Otherwise 'null'.
  string sender_id = 5;
  // The UNIX time when the notification was created.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the notification was created.
  google.protobuf.Timestamp create_time = 6;
  // True if this notification was persisted to the database.
  bool persistent = 7;
@@ -932,9 +932,9 @@ message StorageObject {
  int32 permission_read = 6;
  // The write access permissions for the object.
  int32 permission_write = 7;
  // The UNIX time when the object was created.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the object was created.
  google.protobuf.Timestamp create_time = 8;
  // The UNIX time when the object was last updated.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the object was last updated.
  google.protobuf.Timestamp update_time = 9;
}

@@ -996,11 +996,11 @@ message Tournament {
  uint32 next_reset = 11;
  // Additional information stored as a JSON object.
  string metadata = 12;
  // The UNIX time when the tournament was created.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the tournament was created.
  google.protobuf.Timestamp create_time = 13;
  // The UNIX time when the tournament will start.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the tournament will start.
  google.protobuf.Timestamp start_time = 14;
  // The UNIX time when the tournament will be stopped.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the tournament will be stopped.
  google.protobuf.Timestamp end_time = 15;
  // Duration of the tournament in seconds.
  uint32 duration = 16;
@@ -1096,9 +1096,9 @@ message User {
  bool online = 13;
  // Number of related edges to this user.
  int32 edge_count = 14;
  // The UNIX time when the user was created.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the user was created.
  google.protobuf.Timestamp create_time = 15;
  // The UNIX time when the user was last updated.
  // The UNIX time (for gRPC clients) or ISO string (for REST clients) when the user was last updated.
  google.protobuf.Timestamp update_time = 16;
  // The Facebook Instant Game ID in the user's account.
  string facebook_instant_game_id = 17;
Loading