Skip to content

Commit 84f0897

Browse files
committed
Moved api into it's own folder
1 parent 5a08433 commit 84f0897

36 files changed

+21
-12
lines changed

.gitignore

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# dependencies
2-
/node_modules
2+
**/node_modules
33

44
# misc
5-
.DS_Store
5+
**/.DS_Store
66

77
# environment config
8-
.env
8+
**/.env
99

1010
# production
11-
/build
12-
npm-debug.log*
11+
**/build
12+
**/npm-debug.log*
File renamed without changes.
File renamed without changes.
File renamed without changes.

README.md renamed to api/README.md

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/controllers/users.ts renamed to api/src/controllers/authentication.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import seedGuestUserEntities from 'database/seeds/guestUser';
99
const router = express.Router();
1010

1111
router.post(
12-
'/users/guest',
12+
'/authentication/guest',
1313
catchErrors(async (req, res) => {
1414
const user = await createEntity(User, req.body);
1515
await seedGuestUserEntities(user);
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/database/seeds/guestUser.ts renamed to api/src/database/seeds/guestUser.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,17 @@ const seedIssues = (project: Project): Promise<Issue[]> => {
9090
return Promise.all(issues);
9191
};
9292

93-
const seedComments = (issue: Issue): Promise<Comment> =>
93+
const seedComments = (issue: Issue, user: User): Promise<Comment> =>
9494
createEntity(Comment, {
9595
body: "Be nice to each other! Don't be mean to each other!",
9696
issue,
97-
user: issue.users[0],
97+
user,
9898
});
9999

100100
const seedGuestUserEntities = async (user: User): Promise<void> => {
101101
const project = await seedProject(user);
102102
const issues = await seedIssues(project);
103-
await seedComments(issues[issues.length - 1]);
103+
await seedComments(issues[issues.length - 1], project.users[0]);
104104
};
105105

106106
export default seedGuestUserEntities;
File renamed without changes.

src/entities/Issue.ts renamed to api/src/entities/Issue.ts

+6
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ class Issue extends BaseEntity {
4747
@Column({ type: 'integer', nullable: true })
4848
estimate: number | null;
4949

50+
@Column({ type: 'integer', nullable: true })
51+
timeSpent: number | null;
52+
53+
@Column({ type: 'integer', nullable: true })
54+
timeRemaining: number | null;
55+
5056
@CreateDateColumn({ type: 'timestamp' })
5157
createdAt: Date;
5258

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/index.ts renamed to api/src/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import cors from 'cors';
66

77
import createDatabaseConnection from 'database/connection';
88
import { authenticateUser } from 'middleware/authentication';
9+
import authenticationRoutes from 'controllers/authentication';
910
import projectsRoutes from 'controllers/projects';
1011
import issuesRoutes from 'controllers/issues';
1112
import { RouteNotFoundError } from 'errors';
@@ -34,6 +35,8 @@ const initializeExpress = (): void => {
3435
next();
3536
});
3637

38+
app.use('/', authenticationRoutes);
39+
3740
app.use('/', authenticateUser);
3841

3942
app.use('/', projectsRoutes);
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/utils/typeorm.ts renamed to api/src/utils/typeorm.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { Project, User, Issue, Comment } from 'entities';
44
import { EntityNotFoundError, BadUserInputError } from 'errors';
55
import { generateErrors } from 'utils/validation';
66

7-
export type EntityConstructor = typeof Project | typeof User | typeof Issue | typeof Comment;
8-
export type EntityInstance = Project | User | Issue | Comment;
7+
type EntityConstructor = typeof Project | typeof User | typeof Issue | typeof Comment;
8+
type EntityInstance = Project | User | Issue | Comment;
99

10-
export const entities: { [key: string]: EntityConstructor } = { Comment, Issue, Project, User };
10+
const entities: { [key: string]: EntityConstructor } = { Comment, Issue, Project, User };
1111

1212
export const findEntityOrThrow = async <T extends EntityConstructor>(
1313
Constructor: T,
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)