Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit c747dd9

Browse files
authored
FF-62 Implement Planned Api Interfaces (#1)
* FF-62 finished adding account usecases api interfaces * FF-62 renamed user endpoint in userrestcontroller for swagger * Added Tests * Added find user api. * refactored path constants structure * added fs controller and interfaces. * added permissions and PermissionSet * Changed response type of FileSystemRestController to FileSystemItem as superclass of file and folder. * Implemented requested changes due to (#1)
1 parent 126c372 commit c747dd9

File tree

55 files changed

+1153
-36
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1153
-36
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111
<groupId>de.filefighter</groupId>
1212
<artifactId>rest</artifactId>
13-
<version>0.0.1</version>
13+
<version>0.0.2-SNAPSHOT</version>
1414
<name>rest</name>
1515
<description>RestApi</description>
1616

src/main/java/de/filefighter/rest/config/RestConfiguration.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
@Configuration
1010
public class RestConfiguration {
1111

12+
//Custom static constants
13+
public static final String BASE_API_URI = "/api/v1/";
14+
public static final String AUTHORIZATION_BASIC_PREFIX = "Basic: ";
15+
public static final String AUTHORIZATION_BEARER_PREFIX = "Bearer: ";
16+
public final static String FS_BASE_URI = "/filesystem/";
17+
public final static String USER_BASE_URI = "/users/";
18+
19+
1220
@Bean
1321
public WebMvcConfigurer configurer(){
1422

src/main/java/de/filefighter/rest/config/SwaggerConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ private ApiInfo apiInfo() {
2828
return new ApiInfo(
2929
"FileFighter REST",
3030
"REST-API of the FileFighter application.",
31-
"0.1",
32-
"terms of service url",
31+
"0.2",
32+
null,
3333
new Contact("FileFighter Dev-Team", "https://github.com/filefighter/", "[email protected]"),
3434
"MIT License",
3535
"https://github.com/filefighter/restapi/blob/master/LICENSE",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package de.filefighter.rest.domain.filesystem.data.dto;
2+
3+
import de.filefighter.rest.domain.filesystem.type.FileSystemType;
4+
import de.filefighter.rest.domain.permission.data.dto.PermissionSet;
5+
6+
public class File extends FileSystemItem{
7+
public File() {
8+
}
9+
10+
public File(long id, String name, double size, long createdByUserId, boolean isPublic, long lastUpdated, FileSystemType type, PermissionSet permissionSet) {
11+
super(id, name, size, createdByUserId, isPublic, lastUpdated, type, permissionSet);
12+
}
13+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package de.filefighter.rest.domain.filesystem.data.dto;
2+
3+
import de.filefighter.rest.domain.filesystem.type.FileSystemType;
4+
import de.filefighter.rest.domain.permission.data.dto.PermissionSet;
5+
import lombok.Getter;
6+
import lombok.Setter;
7+
8+
@Getter
9+
@Setter
10+
public class FileSystemItem {
11+
private long id;
12+
private String name;
13+
private double size;
14+
private long createdByUserId; //uploadedBy
15+
private boolean isPublic;
16+
private long lastUpdated;
17+
private FileSystemType type;
18+
private PermissionSet permissionSet;
19+
20+
protected FileSystemItem() {
21+
}
22+
23+
public FileSystemItem(long id, String name, double size, long createdByUserId, boolean isPublic, long lastUpdated, FileSystemType type, PermissionSet permissionSet) {
24+
this.id = id;
25+
this.name = name;
26+
this.size = size;
27+
this.createdByUserId = createdByUserId;
28+
this.isPublic = isPublic;
29+
this.lastUpdated = lastUpdated;
30+
this.type = type;
31+
this.permissionSet = permissionSet;
32+
}
33+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package de.filefighter.rest.domain.filesystem.data.dto;
2+
3+
import de.filefighter.rest.domain.filesystem.type.FileSystemType;
4+
import lombok.Builder;
5+
import lombok.Data;
6+
7+
@Data
8+
@Builder(builderMethodName = "create")
9+
public class FileSystemItemUpdate {
10+
private String name;
11+
private FileSystemType type;
12+
private double size;
13+
private boolean isPublic;
14+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package de.filefighter.rest.domain.filesystem.data.dto;
2+
3+
import de.filefighter.rest.domain.filesystem.type.FileSystemType;
4+
import de.filefighter.rest.domain.permission.data.dto.PermissionSet;
5+
6+
public class Folder extends FileSystemItem {
7+
private String path;
8+
9+
public Folder() {
10+
}
11+
12+
public Folder(long id, String name, double size, long createdByUserId, boolean isPublic, long lastUpdated, FileSystemType type, PermissionSet permissionSet, String path) {
13+
super(id, name, size, createdByUserId, isPublic, lastUpdated, type, permissionSet);
14+
this.path = path;
15+
}
16+
17+
public String getPath() {
18+
return path;
19+
}
20+
21+
public void setPath(String path) {
22+
this.path = path;
23+
}
24+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package de.filefighter.rest.domain.filesystem.data.dto;
2+
3+
import lombok.Builder;
4+
import lombok.Getter;
5+
6+
@Getter
7+
@Builder(buildMethodName = "create")
8+
public class FolderContents {
9+
private final Folder[] folders;
10+
private final File[] files;
11+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package de.filefighter.rest.domain.filesystem.data.persistance;
2+
3+
import lombok.Builder;
4+
import lombok.Data;
5+
import org.springframework.data.mongodb.core.mapping.Document;
6+
import org.springframework.data.mongodb.core.mapping.MongoId;
7+
8+
@Data
9+
@Document(collection = "file")
10+
@Builder(buildMethodName = "create")
11+
public class FileSystemEntity {
12+
@MongoId private String _id;
13+
private long id;
14+
private String name;
15+
private String path;
16+
private long typeId;
17+
private double size;
18+
private boolean isFile;
19+
private long createdByUserId; //uploadedBy
20+
private boolean isPublic;
21+
private long lastUpdated;
22+
private long[] visibleForRoleIds;
23+
private long[] editableForRoleIds;
24+
private long[] visibleForUserIds;
25+
private long[] editableForUserIds;
26+
private long[] itemIds;
27+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package de.filefighter.rest.domain.filesystem.data.persistance;
2+
3+
import org.springframework.data.mongodb.repository.MongoRepository;
4+
import org.springframework.stereotype.Service;
5+
6+
@Service
7+
public interface FileSystemRepository extends MongoRepository<FileSystemEntity, String> {
8+
FileSystemEntity findById(long Id);
9+
}

0 commit comments

Comments
 (0)