Skip to content
Snippets Groups Projects
Commit 91f855d9 authored by Anders Austlid's avatar Anders Austlid
Browse files

Started working on group service

parent 6fe86e25
No related branches found
No related tags found
No related merge requests found
......@@ -12,9 +12,9 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Entity(name = "groups")
@Entity(name = "group")
@Data
public class Groups {
public class Group {
@Id
@Column(name = "group_id")
......
package ntnu.idatt2016.v233.SmartMat.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import ntnu.idatt2016.v233.SmartMat.entity.Groups;
/**
* Repository for groups
*
* @author Stian Lyng
* @version 1.0
* @since 19.04.2023
*/
public interface GroupRepository extends JpaRepository<Groups, Long> {
}
package ntnu.idatt2016.v233.SmartMat.repository.group;
import org.springframework.data.jpa.repository.JpaRepository;
import ntnu.idatt2016.v233.SmartMat.entity.Group;
import java.util.Optional;
/**
* Repository for groups
*
* @author Stian Lyng, Anders Austlid
* @version 1.1
* @since 20.04.2023
*/
public interface GroupRepository extends JpaRepository<Group, Long> {
/**
* Finds a group by its name
* @param groupName the name of the group to look up
* @return an optional containing the group if it exists
*/
Optional<Group> findByGroupName(String groupName);
/**
* Finds a group by its id
* @param groupId the id of the group to look up
* @return an optional containing the group if it exists
*/
Optional<Group> findByGroupId(long groupId);
}
package ntnu.idatt2016.v233.SmartMat.service;
import lombok.AllArgsConstructor;
import ntnu.idatt2016.v233.SmartMat.entity.Group;
import ntnu.idatt2016.v233.SmartMat.repository.group.GroupRepository;
import org.springframework.stereotype.Service;
import java.util.Optional;
/**
* Service for groups
*
* @author Anders Austlid
* @version 1.0
* @since 20.04.2023
*/
@AllArgsConstructor
@Service
public class GroupService {
private final GroupRepository groupRepository;
Optional<Group>
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment