Skip to content

Commit

Permalink
add task manager
Browse files Browse the repository at this point in the history
  • Loading branch information
furqanmk committed Mar 15, 2023
0 parents commit 8ae3b54
Show file tree
Hide file tree
Showing 31 changed files with 1,697 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .batect/caches/key
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file was autogenerated by Batect to track which Docker volumes are associated with this project.
# Do not modify it, and do not commit it to source control.
fwtvpg
9 changes: 9 additions & 0 deletions .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
on:
push:
branches:
- main

jobs:
build_and_publish:
uses: wattpad/github-workflows/.github/workflows/go-build-and-publish.yml@main
secrets: inherit
9 changes: 9 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
on:
pull_request:
branches:
- main

jobs:
build:
uses: wattpad/github-workflows/.github/workflows/go-test-and-build.yml@main
secrets: inherit
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TaskManager
.idea/*
*.pb.go
57 changes: 57 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
run:
go: '1.19'

# Which dirs to skip: issues from them won't be reported.
# Can use regexp here: `generated.*`, regexp is applied on full path.
skip-dirs:
- api
- mocks

linters:
enable-all: true
disable:
# Deprecated
- deadcode
- exhaustivestruct
- ifshort
- interfacer
- maligned
- nosnakecase
- golint
- scopelint
- structcheck
- varcheck
- ireturn

# Unwanted
- exhaustruct # prefer default initialization and brevity
- gofmt # replaced by gofumpt
- goimports # replaced by gci
- paralleltest # requires special care

linters-settings:
exhaustive:
default-signifies-exhaustive: true
gci:
sections:
- standard # Captures all standard packages if they do not match another section.
- default # Contains all imports that could not be matched to another section type.
- prefix(github.com/Wattpad) # All Wattpad imports
gofumpt:
lang-version: "1.19"
extra-rules: false
lll:
line-length: 132
tab-width: 4

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- bodyclose
- containedctx # test suite may want to track context
- forcetypeassert
- gomnd
- wrapcheck # we don't need to wrap errors in tests
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
PROJECT_NAME=protobuf
DB_FILE=./deploy/db.yml
LIQUIBASE_FILE=./deploy/liquibase.yml
ALL=${DB_FILE}

export COMPOSE_IGNORE_ORPHANS=True

db:
export COMPOSE_PROJECT_NAME=${PROJECT_NAME}; export COMPOSE_FILE=${DB_FILE}; docker-compose up db -d

dbtool:
export COMPOSE_PROJECT_NAME=${PROJECT_NAME}; export COMPOSE_FILE=${DB_FILE}; docker-compose up cloudbeaver -d

stop:
export COMPOSE_PROJECT_NAME=${PROJECT_NAME}; export COMPOSE_FILE=${ALL}; docker-compose down

migrate:
export COMPOSE_PROJECT_NAME=${PROJECT_NAME}; export COMPOSE_FILE=${LIQUIBASE_FILE}; docker-compose up --force-recreate liquibase
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# TaskManager

Description of a service generated by the `go-service-template`.

| Property | Description |
|----------|-------------|
| Owner | |
| Dashboard | [Dashboard](https://app.datadoghq.com/dashboard/lists?q=TaskManager) |
| Logging | [Logging](https://app.datadoghq.com/logs?query=service%3ATaskManager) |
| Monitors | [Monitors](https://app.datadoghq.com/monitors/manage?q=service%3ATaskManager) |

## Business Overview

Business overview of a service generated by the `go-service-template`.

## Technical Overview

Technical overview of a service generated by the `go-service-template`.

## Operational Details

Operational details of a service generated by the `go-service-template`.
10 changes: 10 additions & 0 deletions api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# `/api`

OpenAPI/Swagger specs, JSON schema files, protocol definition files.

Examples:

* https://github.com/kubernetes/kubernetes/tree/master/api
* https://github.com/moby/moby/tree/master/api

10 changes: 10 additions & 0 deletions api/buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: v1
plugins:
- remote: buf.build/library/plugins/go:v1.27.1-1
out: .
opt:
- paths=source_relative
- remote: buf.build/library/plugins/go-grpc:v1.1.0-2
out: .
opt:
- paths=source_relative
7 changes: 7 additions & 0 deletions api/buf.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: googleapis
repository: googleapis
commit: c0ec788bbbb747fca594a1e2347edd4e
11 changes: 11 additions & 0 deletions api/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: v1
lint:
use:
- DEFAULT
except:
- PACKAGE_VERSION_SUFFIX
ignore_only:
PACKAGE_DIRECTORY_MATCH:
- api/api.proto
deps:
- buf.build/googleapis/googleapis
93 changes: 93 additions & 0 deletions api/task_manager/api.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
syntax = "proto3";
package task_manager;
option go_package = "github.com/Wattpad/TaskManager/api/task_manager";

import "google/protobuf/timestamp.proto";

message Task {
int64 id = 1;
string title = 2;
string description = 3;
TaskStatus status = 4;
TaskDetails details = 5;
optional string assignee = 6;
}

message TaskDetails {
oneof details {
NotStartedDetails not_started_details = 1;
InProgressDetails in_progress_details = 2;
DoneTaskDetails done_details = 3;
}
}

enum TaskStatus {
TASK_STATUS_UNSPECIFIED = 0;
TASK_STATUS_NOT_STARTED = 1;
TASK_STATUS_IN_PROGRESS = 2;
TASK_STATUS_DONE = 3;
}

message NotStartedDetails {
google.protobuf.Timestamp created_date = 1;
}
message InProgressDetails {
google.protobuf.Timestamp started_date = 1;
}
message DoneTaskDetails {
google.protobuf.Timestamp completed_date = 1;
}

// CREATE
message CreateTaskRequest {
string title = 1;
string description = 2;
TaskStatus status = 3;
TaskDetails details = 4;
}

message CreateTaskResponse {
Task task = 1;
}

// GET
message GetTaskRequest {
int64 id = 1;
}

message GetTaskResponse {
Task task = 1;
}

// UPDATE
message UpdateTaskRequest {
Task task = 1;
}

message UpdateTaskResponse {
Task task = 1;
}

// DELETE
message DeleteTaskRequest {
int64 id = 1;
}

message DeleteTaskResponse {
bool success = 1;
}

message GetAllTasksRequest {}

message GetAllTasksResponse {
Task task = 1;
}

service TaskService {
rpc CreateTask(CreateTaskRequest) returns (CreateTaskResponse) {}
rpc GetTask(GetTaskRequest) returns (GetTaskResponse) {}
rpc UpdateTask(UpdateTaskRequest) returns (UpdateTaskResponse) {}
rpc DeleteTask(DeleteTaskRequest) returns (DeleteTaskResponse) {}
rpc GetAllTasks(GetAllTasksRequest) returns (stream GetAllTasksResponse) {}
// rpc AssignTask(AssignTaskRequest) returns (AssignTaskResponse) {}
}

0 comments on commit 8ae3b54

Please sign in to comment.