Skip to content

Commit 66bc3c5

Browse files
committed
Removed misspelled familys.
1 parent 856a4fc commit 66bc3c5

File tree

6 files changed

+67
-126
lines changed

6 files changed

+67
-126
lines changed

auth/docs/Auth_Design_Document.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## 1. Introduction
44

55
### 1.1 Purpose
6-
This document outlines the design for implementing authentication and authorization in the Family Service using JWT tokens. The solution ensures that all requests have a valid access token and that users are authorized to access specific endpoints based on their roles.
6+
This document outlines the design for implementing authentication and authorization in the Application using JWT tokens. The solution ensures that all requests have a valid access token and that users are authorized to access specific endpoints based on their roles.
77

88
### 1.2 Scope
99
The authentication and authorization system will:
@@ -15,7 +15,7 @@ The authentication and authorization system will:
1515
### 1.3 References
1616
- OAuth 2.0 and OpenID Connect (OIDC) standards
1717
- JWT (JSON Web Token) specification
18-
- Family Service GraphQL schema
18+
- Application GraphQL schema
1919

2020
## 2. Requirements
2121

@@ -208,7 +208,7 @@ The JWT token will have the following structure:
208208
{
209209
"sub": "user-id",
210210
"roles": ["admin", "authuser"],
211-
"iss": "family-service",
211+
"iss": "application",
212212
"exp": 1619712000,
213213
"iat": 1619625600,
214214
"nbf": 1619625600
@@ -270,7 +270,7 @@ Remote validation provides additional security by checking if a token has been r
270270
```
271271
+------------------+ +------------------+ +------------------+
272272
| | | | | |
273-
| Client |---->| API Gateway |---->| Family Service |
273+
| Client |---->| API Gateway |---->| Application |
274274
| | | | | |
275275
+------------------+ +------------------+ +------------------+
276276
|
@@ -292,7 +292,7 @@ auth:
292292
jwt:
293293
secretKey: ${JWT_SECRET_KEY}
294294
tokenDuration: 24h
295-
issuer: family-service
295+
issuer: application
296296
remote:
297297
enabled: ${JWT_REMOTE_ENABLED:-false}
298298
validationURL: ${JWT_REMOTE_VALIDATION_URL}
@@ -337,6 +337,6 @@ auth:
337337
338338
## 7. Conclusion
339339
340-
This design document outlines a comprehensive approach to implementing authentication and authorization in the Family Service using JWT tokens. The solution ensures that all requests have a valid access token and that users are authorized to access specific endpoints based on their roles.
340+
This design document outlines a comprehensive approach to implementing authentication and authorization in the Application using JWT tokens. The solution ensures that all requests have a valid access token and that users are authorized to access specific endpoints based on their roles.
341341
342342
The implementation will leverage the existing auth-related code in the repository and follow the architectural patterns established in the project. The solution is designed to be secure, performant, and maintainable.

config/adapter.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ func (a *GenericDatabaseConfigAdapter[T]) GetDatabaseName() string {
137137

138138
// GetCollectionName returns the collection/table name for a given entity type
139139
func (a *GenericDatabaseConfigAdapter[T]) GetCollectionName(entityType string) string {
140-
// Simple pluralization
140+
// Special case for "family" -> "families"
141+
if entityType == "family" {
142+
return "families"
143+
}
144+
// Simple pluralization for other cases
141145
return entityType + "s"
142146
}

config/adapter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ func TestGenericDatabaseConfigAdapter_GetCollectionName(t *testing.T) {
297297
{
298298
name: "Family",
299299
entityType: "family",
300-
expectedName: "familys", // Simple pluralization
300+
expectedName: "families",
301301
},
302302
{
303303
name: "User",

di/family_container.go

Lines changed: 0 additions & 117 deletions
This file was deleted.

logging/logger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) 2025 A Bit of Help, Inc.
22

3-
// Package logging provides centralized logging functionality for the family service.
3+
// Package logging provides centralized logging functionality for services.
44
// It wraps the zap logging library and adds features like trace ID extraction from context
55
// and context-aware logging methods. This package is part of the infrastructure layer
66
// and provides logging capabilities to all other layers of the application.

recommendations.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Servicelib Project Recommendations
2+
3+
## Overview
4+
This document contains recommendations for the servicelib project based on a code review. The recommendations address code organization, potential redundancies, and best practices.
5+
6+
## Specific Questions
7+
8+
### Is auth/config/example_test.go an example for using auth/config?
9+
Yes, auth/config/example_test.go is an example for using the auth/config package. It contains several example functions that demonstrate how to use the AuthConfigAdapter and various creation functions provided by the package.
10+
11+
### Should it be moved to the /examples folder?
12+
No, it should not be moved to the /examples folder. The example_test.go file follows Go's convention for package documentation examples. These examples are:
13+
1. Automatically included in the package's godoc documentation
14+
2. Run as tests to ensure they remain valid
15+
3. Referenced in the package's README.md and doc.go files
16+
17+
The examples in the /examples directory serve a different purpose - they are standalone executable examples that demonstrate how to use the package in a real application. They are more comprehensive and often involve multiple packages.
18+
19+
### Is it redundant?
20+
No, it is not redundant. While there is a configuration_example.go file in the examples/auth directory, it demonstrates how to use the main auth package's configuration, not specifically the auth/config adapter functionality. The example_test.go file provides focused examples of how to use the auth/config package's specific functionality.
21+
22+
## General Recommendations
23+
24+
### Code Organization
25+
1. **Consistent Example Patterns**: The project uses two different approaches for examples:
26+
- Example* functions in test files (like auth/config/example_test.go)
27+
- Standalone examples in the examples directory
28+
29+
This is actually a good practice, as they serve different purposes, but ensure this pattern is consistently applied across all packages.
30+
31+
2. **Package Documentation**: Ensure all packages have both a README.md and a doc.go file with consistent structure, like the auth/config package does.
32+
33+
3. **Directory Structure**: The project has a good directory structure with clear separation of concerns. Continue this pattern for new components.
34+
35+
### Best Practices
36+
1. **Configuration Management**: The project has a good approach to configuration management with the config package and adapters. Consider extending this pattern to other components that need configuration.
37+
38+
2. **Interface-Based Design**: The auth/config package demonstrates good use of interfaces for abstraction. Continue this pattern throughout the project.
39+
40+
3. **Testing**: The example_test.go file serves as both documentation and tests. Ensure all packages have comprehensive tests, including examples.
41+
42+
4. **Documentation**: The auth/config package has good documentation in README.md and doc.go. Ensure all packages have similar documentation.
43+
44+
### Potential Issues
45+
1. **Hard-Coded Values**: In the auth/config/example_test.go file, there are hard-coded values like secret keys and URLs. While these are just examples, ensure that real applications using this library don't hard-code sensitive values.
46+
47+
2. **Error Handling**: Ensure consistent error handling patterns throughout the project. The auth package has good error handling with specific error types in the errors package.
48+
49+
3. **Dependency Management**: The project uses go modules for dependency management, which is good. Ensure dependencies are kept up to date and security vulnerabilities are addressed.
50+
51+
## Conclusion
52+
The servicelib project appears to be well-organized with good separation of concerns and documentation. The auth/config/example_test.go file is not redundant and should not be moved to the examples directory, as it serves a specific purpose in the Go documentation system.
53+
54+
The project demonstrates good practices in terms of interface-based design, configuration management, and documentation. Continue these patterns throughout the project and ensure consistency in code organization and documentation.

0 commit comments

Comments
 (0)