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

Friend #4

Merged
merged 13 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,22 @@ on:


jobs:
test:
environment: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22.0'

- name: Test
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
run: make test

build_and_publish:
#needs: test
Expand All @@ -27,4 +42,4 @@ jobs:
run: echo ${{ secrets.DOCKER_REGISTRY_PWD }} | docker login registry.nccupass.com --username ${{ secrets.DOCKER_REGISTRY_USER }} --password-stdin

- name: Build and push Docker image
run: make docker_push
run: make docker_push
3 changes: 2 additions & 1 deletion migrations/2405170335_create_users_table.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ CREATE TABLE user_identity(
created_at timestamp default CURRENT_TIMESTAMP,
activated boolean default false,
refresh_token varchar(100),
device_token varchar(100)
device_token varchar(100),
nick_id VARCHAR(150) UNIQUE
);

CREATE TABLE email_login(
Expand Down
97 changes: 97 additions & 0 deletions protobuf/friend.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
syntax = "proto3";
option go_package = "github.com/SpeedReach/monify";

import "google/api/annotations.proto";

message FriendEmpty{}

service FriendService{

rpc DeleteFriend(DeleteFriendRequest) returns (FriendEmpty){
option (google.api.http) = {
delete: "/v1/friend/{relation_id}"
};
}

rpc ListFriend(FriendEmpty) returns (ListFriendResponse){
option (google.api.http) = {
get: "/v1/friend"
};
}

rpc InviteFriend(InviteFriendRequest) returns (InviteFriendResponse){
option (google.api.http) = {
post: "/v1/friend/invite"
body: "*"
};
}

rpc ListFriendInvitation(FriendEmpty) returns (ListFriendInvitationResponse){
option (google.api.http) = {
get: "/v1/friend/invite"
};
}

// Add the record on the table(friend)
rpc AcceptInvitation_post_(AcceptInvitation_post_Request) returns (FriendEmpty){
option (google.api.http) = {
post: "/v1/friend"
};
}

// Delete the record from the table(friend invite)
rpc AcceptInvitation_delete_(AcceptInvitation_delete_Request) returns (FriendEmpty){
option (google.api.http) = {
delete: "/v1/friend/accept_invitation/{invite_id}"
};
}

rpc RejectInvitation(RejectInvitationRequest) returns (FriendEmpty){
option (google.api.http) = {
delete: "/v1/friend/reject_invitation/{invite_id}"
};
}
}

message DeleteFriendRequest{
string relation_id = 1;
}

message ListFriendResponse{
repeated Friend friends = 1;
}

message Friend{
string friend_id = 1;
string name = 2;
}

message InviteFriendRequest{
string receiver_nickId = 1;
}

message InviteFriendResponse{
string invite_id = 1;
}

message ListFriendInvitationResponse{
repeated Invitation invitation = 1;
}

message Invitation{
string sender_nickId = 1;
string sender_name = 2;
}

message AcceptInvitation_post_Request{
string user1_id = 1;
string user2_id = 2;
}

message AcceptInvitation_delete_Request{
string invite_id = 1;
}

message RejectInvitationRequest{
string invite_id = 1;
}
30 changes: 15 additions & 15 deletions protobuf/gen/go/auth.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 8 additions & 14 deletions protobuf/gen/go/auth_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading